Changeset 12330 for issm/trunk/src/c/Container/Elements.cpp
- Timestamp:
- 06/01/12 17:26:03 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Elements.cpp
r11995 r12330 124 124 } 125 125 126 #ifdef _PARALLEL_127 126 /*Synchronize across cluster, so as to not end up with different sizes for each patch on each cpu: */ 127 #ifdef _HAVE_MPI_ 128 128 MPI_Reduce (&numvertices,&max_numvertices,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD ); 129 129 MPI_Bcast(&max_numvertices,1,MPI_INT,0,MPI_COMM_WORLD); … … 193 193 194 194 /*Get rank of first cpu that has results*/ 195 #ifdef _HAVE_MPI_ 195 196 if(this->Size()) rank=my_rank; 196 197 else rank=num_procs; 197 198 MPI_Allreduce (&rank,&minrank,1,MPI_INT,MPI_MIN,MPI_COMM_WORLD); 199 #else 200 minrank=my_rank; 201 #endif 198 202 199 203 /*see what the first element of this partition has in stock (this is common to all partitions)*/ … … 203 207 element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults); 204 208 } 209 #ifdef _HAVE_MPI_ 205 210 MPI_Bcast(&numberofresults,1,MPI_DOUBLE,minrank,MPI_COMM_WORLD); 211 #endif 206 212 207 213 /*Get out if there is no results. Otherwise broadcast info*/ 208 214 if(!numberofresults) return; 215 #ifdef _HAVE_MPI_ 209 216 if(my_rank!=minrank){ 210 217 resultsenums=(int*)xmalloc(numberofresults*sizeof(int)); … … 217 224 MPI_Bcast(resultstimes,numberofresults,MPI_DOUBLE,minrank,MPI_COMM_WORLD); 218 225 MPI_Bcast(resultssteps,numberofresults,MPI_INT,minrank,MPI_COMM_WORLD); 226 #endif 219 227 220 228 /*Loop over all results and get nodal vector*/ … … 250 258 251 259 /*Gather onto master cpu 0, if needed: */ 252 #ifdef _PARALLEL_253 260 if(io_gather)patch->Gather(); 254 #endif255 261 256 262 /*create result object and add to results dataset:*/ … … 276 282 int numberofelements; 277 283 278 #ifdef _PARALLEL_279 284 local_nelem=this->Size(); 285 #ifdef _HAVE_MPI_ 280 286 MPI_Allreduce ( (void*)&local_nelem,(void*)&numberofelements,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD); 281 287 #else 282 numberofelements= this->Size();288 numberofelements=local_nelem; 283 289 #endif 284 290
Note:
See TracChangeset
for help on using the changeset viewer.