Changeset 11059
- Timestamp:
- 12/24/11 09:22:30 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Elements.cpp
r11026 r11059 167 167 168 168 extern int my_rank; 169 extern int num_procs; 169 170 170 171 Patch *patch = NULL; … … 179 180 int numberofvertices,numberofelements; 180 181 int numberofresults,vectorsize; 182 int rank; 183 int minrank; 181 184 182 185 /*Recover parameters: */ … … 189 192 /*No patch here, we prepare vectors*/ 190 193 194 /*Get rank of first cpu that has results*/ 195 if(this->Size()) rank=my_rank; 196 else rank=num_procs; 197 MPI_Allreduce (&rank,&minrank,1,MPI_INT,MPI_MIN,MPI_COMM_WORLD); 198 191 199 /*see what the first element of this partition has in stock (this is common to all partitions)*/ 192 if(my_rank== 0){193 if(this->Size()==0) _error_("Cannot write results because first partition has no element. Maybe too many cpus were requested");200 if(my_rank==minrank){ 201 if(this->Size()==0) _error_("Cannot write results because there is no element??"); 194 202 Element* element=(Element*)this->GetObjectByOffset(0); 195 203 element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults); … … 199 207 /*Get out if there is no results. Otherwise broadcast info*/ 200 208 if(!numberofresults) return; 201 if(my_rank!= 0){209 if(my_rank!=minrank){ 202 210 resultsenums=(int*)xmalloc(numberofresults*sizeof(int)); 203 211 resultssizes=(int*)xmalloc(numberofresults*sizeof(int));
Note:
See TracChangeset
for help on using the changeset viewer.