Skip to content

Commit

Permalink
Write less warnings when partitioning is crappy and exit early.
Browse files Browse the repository at this point in the history
  • Loading branch information
raback committed Oct 8, 2024
1 parent 01c43e3 commit b2b7676
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
27 changes: 20 additions & 7 deletions elmergrid/src/egparallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ int PartitionMetisMesh(struct FemType *data,struct ElmergridType *eg,
used. If the elements are higher order nodal elements then use only the linear basis. */
{
int i,j,k,periodic, noelements, noknots, sides, highorder;
int nodesd2, etype, numflag,mintype,maxtype,elemtype,minnodes;
int nodesd2, etype, numflag,mintype,maxtype,elemtype,minnodes,ninv;
int *neededby,*indxper,*inpart;
idx_t *metistopo,*eptr,*npart,*epart;
idx_t ne,nn,ncommon,edgecut,nparts;
Expand Down Expand Up @@ -2560,12 +2560,19 @@ int PartitionMetisMesh(struct FemType *data,struct ElmergridType *eg,
}

/* Set the partition given by Metis for each element. */
ninv = 0;
for(i=1;i<=noelements;i++) {
inpart[i] = epart[i-1]+1;
if(inpart[i] < 1 || inpart[i] > partitions)
printf("Invalid partition %d for element %d\n",inpart[i],i);
if(inpart[i] < 1 || inpart[i] > partitions) {
if(ninv < 10 ) printf("Invalid partition %d for element %d\n",inpart[i],i);
ninv++;
}
}

if(ninv) {
printf("Number of invalid element partitions by Metis %d\n",ninv);
bigerror("Cannot continue with invalid partitioning!");
}

if( highorder ) {
PartitionNodesByElements(data,info);
}
Expand All @@ -2580,11 +2587,17 @@ int PartitionMetisMesh(struct FemType *data,struct ElmergridType *eg,
j = i;
if(!j) printf("Cannot set partitioning for node %d\n",i);
data->nodepart[i] = npart[j-1]+1;
if(data->nodepart[i] < 1 || data->nodepart[i] > partitions)
printf("Invalid partition %d for node %d\n",data->nodepart[i],i);
if(data->nodepart[i] < 1 || data->nodepart[i] > partitions) {
if(ninv < 10) printf("Invalid partition %d for node %d\n",data->nodepart[i],i);
ninv++;
}
}
if(ninv) {
printf("Number of invalid node partitions by Metis %d\n",ninv);
bigerror("Cannot continue with invalid partitioning!");
}
}

free_Ivector(neededby,1,noknots);
free_Ivector(metistopo,0,k-1);
free_Ivector(epart,0,noelements-1);
Expand Down
2 changes: 1 addition & 1 deletion fem/tests/EMWaveBoxHexasEigen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ IF(HAVE_UMFPACK OR HAVE_MUMPS)

file(COPY ELMERSOLVER_STARTINFO shoebox_hexas.grd DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")

ADD_ELMER_TEST(EMWaveBoxHexasEigen LABELS whitney eigen em-wave)
ADD_ELMER_TEST(EMWaveBoxHexasEigen LABELS whitney eigen em-wave slow)
ENDIF()

0 comments on commit b2b7676

Please sign in to comment.