Changeset 13607


Ignore:
Timestamp:
10/10/12 23:15:15 (12 years ago)
Author:
Eric.Larour
Message:

CHG: more changes to switch from my_rank and num_procs to IssmComm::GetSize and IssmComm::GetRank

Location:
issm/trunk-jpl/src/c/classes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r13594 r13607  
    334334                                record_code=0; //0 means bailout
    335335                                #ifdef _HAVE_MPI_
    336                                 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*tell others cpus we are bailing: */
     336                                MPI_Bcast(&record_code,1,MPI_INT,0,IssmComm::GetComm());  /*tell others cpus we are bailing: */
    337337                                #endif
    338338                                break;
     
    346346                                #ifdef _HAVE_MPI_
    347347                                /*Tell other cpus what we are doing: */
    348                                 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*tell other cpus what we are going to do: */
     348                                MPI_Bcast(&record_code,1,MPI_INT,0,IssmComm::GetComm());  /*tell other cpus what we are going to do: */
    349349
    350350                                /*Tell other cpus the name of the data, then branch according to the data type: */
    351                                 MPI_Bcast(&record_enum,1,MPI_INT,0,MPI_COMM_WORLD); 
    352                                 MPI_Bcast(&record_length,1,MPI_INT,0,MPI_COMM_WORLD); 
     351                                MPI_Bcast(&record_enum,1,MPI_INT,0,IssmComm::GetComm()); 
     352                                MPI_Bcast(&record_length,1,MPI_INT,0,IssmComm::GetComm()); 
    353353                                #endif
    354354                               
     
    358358                                                if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error_("could not read boolean ");
    359359                                                #ifdef _HAVE_MPI_
    360                                                 MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     360                                                MPI_Bcast(&booleanint,1,MPI_INT,0,IssmComm::GetComm());
    361361                                                #endif
    362362
     
    369369                                                if(fread(&integer,sizeof(int),1,this->fid)!=1) _error_("could not read integer ");
    370370                                                #ifdef _HAVE_MPI_
    371                                                 MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     371                                                MPI_Bcast(&integer,1,MPI_INT,0,IssmComm::GetComm());
    372372                                                #endif
    373373
     
    386386                                                        if(fread(&pscalar,sizeof(IssmPDouble),1,this->fid)!=1) _error_("could not read scalar ");
    387387                                                        #ifdef _HAVE_MPI_
    388                                                         MPI_Bcast(&pscalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     388                                                        MPI_Bcast(&pscalar,1,MPI_DOUBLE,0,IssmComm::GetComm());
    389389                                                        #endif
    390390                                                        scalar=reCast<IssmDouble>(pscalar);
     
    399399                                                if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error_("could not read length of string ");
    400400                                                #ifdef _HAVE_MPI_
    401                                                 MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     401                                                MPI_Bcast(&string_size,1,MPI_INT,0,IssmComm::GetComm());
    402402                                                #endif
    403403
     
    409409                                                        if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error_(" could not read string ");
    410410                                                        #ifdef _HAVE_MPI_
    411                                                         MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     411                                                        MPI_Bcast(string,string_size,MPI_CHAR,0,IssmComm::GetComm());
    412412                                                        #endif
    413413                                                }
     
    467467        else{ //cpu ~0 {{{
    468468                for(;;){ //wait on cpu 0
    469                         MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*get from cpu 0 what we are going to do: */
     469                        MPI_Bcast(&record_code,1,MPI_INT,0,IssmComm::GetComm());  /*get from cpu 0 what we are going to do: */
    470470                        if(record_code==0){
    471471                                break; //we are done, break from the loop
    472472                        }
    473473                        else{
    474                                 MPI_Bcast(&record_enum,1,MPI_INT,0,MPI_COMM_WORLD);   //get from cpu 0 name of the data
    475                                 MPI_Bcast(&record_length,1,MPI_INT,0,MPI_COMM_WORLD); 
     474                                MPI_Bcast(&record_enum,1,MPI_INT,0,IssmComm::GetComm());   //get from cpu 0 name of the data
     475                                MPI_Bcast(&record_length,1,MPI_INT,0,IssmComm::GetComm()); 
    476476                                switch(record_code){
    477477                                case 1:
    478478                                        /*boolean. get it from cpu 0 */
    479                                         MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     479                                        MPI_Bcast(&booleanint,1,MPI_INT,0,IssmComm::GetComm());
    480480                                               
    481481                                        /*create BoolParam: */
     
    485485                                case 2:
    486486                                        /*integer. get it from cpu 0 */
    487                                         MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     487                                        MPI_Bcast(&integer,1,MPI_INT,0,IssmComm::GetComm());
    488488                                               
    489489                                        /*create IntParam: */
     
    493493                                case 3:
    494494                                        /*scalar. get it from cpu 0 */
    495                                         MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     495                                        MPI_Bcast(&scalar,1,MPI_DOUBLE,0,IssmComm::GetComm());
    496496                                               
    497497                                        /*create DoubleParam: */
     
    500500                                        break;
    501501                                case 4:
    502                                         MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     502                                        MPI_Bcast(&string_size,1,MPI_INT,0,IssmComm::GetComm());
    503503                                        if(string_size){
    504504                                                string=xNew<char>((string_size+1));
     
    506506
    507507                                                /*Read string from cpu 0: */
    508                                                 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     508                                                MPI_Bcast(string,string_size,MPI_CHAR,0,IssmComm::GetComm());
    509509                                        }
    510510                                        else{
     
    561561        }
    562562        #ifdef _HAVE_MPI_
    563         MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     563        MPI_Bcast(&booleanint,1,MPI_INT,0,IssmComm::GetComm());
    564564        #endif
    565565
     
    593593
    594594        #ifdef _HAVE_MPI_
    595         MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     595        MPI_Bcast(&integer,1,MPI_INT,0,IssmComm::GetComm());
    596596        #endif
    597597
     
    624624        }
    625625        #ifdef _HAVE_MPI_
    626         MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     626        MPI_Bcast(&scalar,1,MPI_DOUBLE,0,IssmComm::GetComm());
    627627        #endif
    628628
     
    659659
    660660        #ifdef _HAVE_MPI_
    661         MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     661        MPI_Bcast(&string_size,1,MPI_INT,0,IssmComm::GetComm());
    662662        #endif
    663663
     
    672672                }
    673673                #ifdef _HAVE_MPI_
    674                 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     674                MPI_Bcast(string,string_size,MPI_CHAR,0,IssmComm::GetComm());
    675675                #endif
    676676        }
     
    715715
    716716        #ifdef _HAVE_MPI_
    717         MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     717        MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm());
    718718        #endif
    719719
     
    722722        }
    723723        #ifdef _HAVE_MPI_
    724         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     724        MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm());
    725725        #endif
    726726
     
    735735               
    736736                #ifdef _HAVE_MPI_
    737                 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     737                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,IssmComm::GetComm());
    738738                #endif
    739739        }
     
    787787        }
    788788        #ifdef _HAVE_MPI_
    789         MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     789        MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm());
    790790        #endif
    791791
     
    794794        }
    795795        #ifdef _HAVE_MPI_
    796         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     796        MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm());
    797797        #endif
    798798
     
    806806                }
    807807                #ifdef _HAVE_MPI_
    808                 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     808                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,IssmComm::GetComm());
    809809                #endif
    810810
     
    857857        }
    858858        #ifdef _HAVE_MPI_
    859         MPI_Bcast(&numstrings,1,MPI_INT,0,MPI_COMM_WORLD);
     859        MPI_Bcast(&numstrings,1,MPI_INT,0,IssmComm::GetComm());
    860860        #endif
    861861
     
    872872                        }
    873873                        #ifdef _HAVE_MPI_
    874                         MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     874                        MPI_Bcast(&string_size,1,MPI_INT,0,IssmComm::GetComm());
    875875                        #endif
    876876                        if(string_size){
     
    883883                                }
    884884                                #ifdef _HAVE_MPI_
    885                                 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     885                                MPI_Bcast(string,string_size,MPI_CHAR,0,IssmComm::GetComm());
    886886                                #endif
    887887                        }
     
    930930        }
    931931        #ifdef _HAVE_MPI_
    932         MPI_Bcast(&numrecords,1,MPI_INT,0,MPI_COMM_WORLD);
     932        MPI_Bcast(&numrecords,1,MPI_INT,0,IssmComm::GetComm());
    933933        #endif
    934934
     
    953953                        }
    954954                        #ifdef _HAVE_MPI_
    955                         MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     955                        MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm());
    956956                        #endif
    957957
     
    960960                        }
    961961                        #ifdef _HAVE_MPI_
    962                         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     962                        MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm());
    963963                        #endif
    964964
     
    973973
    974974                                #ifdef _HAVE_MPI_
    975                                 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     975                                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,IssmComm::GetComm());
    976976                                #endif
    977977                                matrices[i]=xNew<IssmDouble>(M*N);
     
    13081308        /*Broadcast code and vector type: */
    13091309#ifdef _HAVE_MPI_
    1310         MPI_Bcast(&lastindex,1,MPI_INT,0,MPI_COMM_WORLD);
     1310        MPI_Bcast(&lastindex,1,MPI_INT,0,IssmComm::GetComm());
    13111311#endif
    13121312
     
    13641364        }
    13651365        #ifdef _HAVE_MPI_
    1366         MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD);
     1366        MPI_Bcast(&found,1,MPI_INT,0,IssmComm::GetComm());
    13671367        if(!found)_error_("could not find data with name " << EnumToStringx(data_enum) << " in binary file");
    13681368        #endif
     
    13701370        /*Broadcast code and vector type: */
    13711371        #ifdef _HAVE_MPI_
    1372         MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);
    1373         MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
    1374         if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
     1372        MPI_Bcast(&record_code,1,MPI_INT,0,IssmComm::GetComm());
     1373        MPI_Bcast(&vector_type,1,MPI_INT,0,IssmComm::GetComm());
     1374        if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,IssmComm::GetComm());
    13751375        #endif
    13761376
  • issm/trunk-jpl/src/c/classes/Patch.cpp

    r13413 r13607  
    122122        /*First, figure out total number of rows combining all the cpus: */
    123123        #ifdef _HAVE_MPI_
    124         MPI_Reduce(&this->numrows,&total_numrows,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    125         MPI_Bcast(&total_numrows,1,MPI_INT,0,MPI_COMM_WORLD);
     124        MPI_Reduce(&this->numrows,&total_numrows,1,MPI_INT,MPI_SUM,0,IssmComm::GetComm() );
     125        MPI_Bcast(&total_numrows,1,MPI_INT,0,IssmComm::GetComm());
    126126        #else
    127127        total_numrows=this->numrows;
     
    145145        for (i=1;i<num_procs;i++){
    146146                if (my_rank==i){
    147                         MPI_Send(&this->numrows,1,MPI_INT,0,1,MPI_COMM_WORLD);   
    148                         if (this->numrows)MPI_Send(this->values,this->numrows*this->numcols,MPI_DOUBLE,0,1,MPI_COMM_WORLD);
     147                        MPI_Send(&this->numrows,1,MPI_INT,0,1,IssmComm::GetComm());   
     148                        if (this->numrows)MPI_Send(this->values,this->numrows*this->numcols,MPI_DOUBLE,0,1,IssmComm::GetComm());
    149149                }
    150150                if (my_rank==0){
    151                         MPI_Recv(&node_numrows,1,MPI_INT,i,1,MPI_COMM_WORLD,&status);
    152                         if (node_numrows)MPI_Recv(total_values+count,node_numrows*this->numcols,MPI_DOUBLE,i,1,MPI_COMM_WORLD,&status);
     151                        MPI_Recv(&node_numrows,1,MPI_INT,i,1,IssmComm::GetComm(),&status);
     152                        if (node_numrows)MPI_Recv(total_values+count,node_numrows*this->numcols,MPI_DOUBLE,i,1,IssmComm::GetComm(),&status);
    153153                        count+=node_numrows*this->numcols;
    154154                }
  • issm/trunk-jpl/src/c/classes/objects/IndependentObject.cpp

    r13426 r13607  
    117117               
    118118                #ifdef _HAVE_MPI_
    119                 MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     119                MPI_Bcast(&scalar,1,MPI_DOUBLE,0,IssmComm::GetComm());
    120120                #endif
    121121
     
    151151                }
    152152                #ifdef _HAVE_MPI_
    153                 MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     153                MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm());
    154154                #endif
    155155
     
    158158                }
    159159                #ifdef _HAVE_MPI_
    160                 MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     160                MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm());
    161161                #endif
    162162
     
    174174                        }
    175175                        #ifdef _HAVE_MPI_
    176                         MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     176                        MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,IssmComm::GetComm());
    177177                        #endif
    178178                       
  • issm/trunk-jpl/src/c/classes/objects/Profiler.cpp

    r13573 r13607  
    7171        if(!dontmpisync){
    7272                #ifdef _HAVE_MPI_
    73                 MPI_Barrier(MPI_COMM_WORLD);
     73                MPI_Barrier(IssmComm::GetComm());
    7474                #endif
    7575        }
Note: See TracChangeset for help on using the changeset viewer.