Changeset 13612


Ignore:
Timestamp:
10/11/12 00:03:06 (12 years ago)
Author:
Eric.Larour
Message:

CHG: switched my_rank2 to my_rank and num_procs2 to num_procs

Location:
issm/trunk-jpl/src/c
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Container/Elements.cpp

    r13604 r13612  
    168168        int i;
    169169       
    170         int my_rank2;
    171         int num_procs2;
     170        int my_rank;
     171        int num_procs;
    172172
    173173        Patch  *patch        = NULL;
     
    185185        int    minrank;
    186186       
    187         /*recover my_rank2:*/
    188         my_rank2=IssmComm::GetRank();
    189         num_procs2=IssmComm::GetSize();
     187        /*recover my_rank:*/
     188        my_rank=IssmComm::GetRank();
     189        num_procs=IssmComm::GetSize();
    190190
    191191        /*Recover parameters: */
     
    200200                /*Get rank of first cpu that has results*/
    201201                #ifdef _HAVE_MPI_
    202                 if(this->Size()) rank=my_rank2;
    203                 else rank=num_procs2;
     202                if(this->Size()) rank=my_rank;
     203                else rank=num_procs;
    204204                MPI_Allreduce (&rank,&minrank,1,MPI_INT,MPI_MIN,IssmComm::GetComm());
    205205                #else
    206                 minrank=my_rank2;
     206                minrank=my_rank;
    207207                #endif
    208208
    209209                /*see what the first element of this partition has in stock (this is common to all partitions)*/
    210                 if(my_rank2==minrank){
     210                if(my_rank==minrank){
    211211                        if(this->Size()==0) _error_("Cannot write results because there is no element??");
    212212                        Element* element=(Element*)this->GetObjectByOffset(0);
     
    220220                if(!numberofresults) return;
    221221                #ifdef _HAVE_MPI_
    222                 if(my_rank2!=minrank){
     222                if(my_rank!=minrank){
    223223                        resultsenums=xNew<int>(numberofresults);
    224224                        resultssizes=xNew<int>(numberofresults);
     
    249249                        /*Serialize and add to results*/
    250250                        vector_serial=vector->ToMPISerial();
    251                         if(my_rank2==0){
     251                        if(my_rank==0){
    252252                                /*No need to add this vector for all cpus*/
    253253                                #ifdef _HAVE_ADOLC_
  • issm/trunk-jpl/src/c/Container/Nodes.cpp

    r13605 r13612  
    5656void  Nodes::DistributeDofs(int analysis_type,int setenum){
    5757
    58         int num_procs2;
    59         int my_rank2;
     58        int num_procs;
     59        int my_rank;
    6060
    6161        int  i;
     
    6767        int  numnodes=0;
    6868       
    69         /*recover my_rank2:*/
    70         my_rank2=IssmComm::GetRank();
    71         num_procs2=IssmComm::GetSize();
     69        /*recover my_rank:*/
     70        my_rank=IssmComm::GetRank();
     71        num_procs=IssmComm::GetSize();
    7272
    7373        /*some check: */
     
    8888         * cpus by the total last dofs of the previus cpu, starting from 0.
    8989         * First: get number of dofs for each cpu*/
    90         alldofcount=xNew<int>(num_procs2);
     90        alldofcount=xNew<int>(num_procs);
    9191        #ifdef _HAVE_MPI_
    9292        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,IssmComm::GetComm());
    93         MPI_Bcast(alldofcount,num_procs2,MPI_INT,0,IssmComm::GetComm());
     93        MPI_Bcast(alldofcount,num_procs,MPI_INT,0,IssmComm::GetComm());
    9494        #else
    9595        alldofcount[0]=dofcount;
     
    9898        /* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
    9999        dofcount=0;
    100         if(my_rank2!=0){
    101                 for(i=0;i<my_rank2;i++){
     100        if(my_rank!=0){
     101                for(i=0;i<my_rank;i++){
    102102                        dofcount+=alldofcount[i];
    103103                }
     
    152152
    153153        int i;
    154         int num_procs2;
     154        int num_procs;
    155155
    156156        int* ranks=NULL;
     
    158158        int  numnodes;
    159159
    160         /*recover num_procs2: */
    161         num_procs2=IssmComm::GetSize();
     160        /*recover num_procs: */
     161        num_procs=IssmComm::GetSize();
    162162
    163163        /*Figure out number of nodes for this analysis: */
     
    167167        ranks=xNew<int>(numnodes);
    168168        minranks=xNew<int>(numnodes);
    169         for(i=0;i<numnodes;i++)ranks[i]=num_procs2; //no cpu can have rank num_procs. This is the maximum limit.
     169        for(i=0;i<numnodes;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit.
    170170
    171171        /*Now go through all our objects and ask them to report to who they belong (which rank): */
     
    335335void   Nodes::Ranks(int* ranks,int analysis_type){
    336336
    337         int my_rank2;
     337        int my_rank;
    338338        int        sid;
    339339       
    340         /*recover my_rank2:*/
    341         my_rank2=IssmComm::GetRank();
     340        /*recover my_rank:*/
     341        my_rank=IssmComm::GetRank();
    342342
    343343        /*Go through nodes, and for each object, report it cpu: */
     
    350350                        /*Plug rank into ranks, according to sid: */
    351351                        sid=node->Sid();
    352                         ranks[sid]=my_rank2;
     352                        ranks[sid]=my_rank;
    353353                }
    354354        }
  • issm/trunk-jpl/src/c/Container/Vertices.cpp

    r13604 r13612  
    4141void  Vertices::DistributePids(int numberofobjects){
    4242
    43         int num_procs2;
    44         int my_rank2;
     43        int num_procs;
     44        int my_rank;
    4545
    4646        int  i;
     
    5050        int *alltruepids = NULL;
    5151       
    52         /*recover my_rank2:*/
    53         my_rank2=IssmComm::GetRank();
    54         num_procs2=IssmComm::GetSize();
     52        /*recover my_rank:*/
     53        my_rank=IssmComm::GetRank();
     54        num_procs=IssmComm::GetSize();
    5555
    5656        /*Go through objects, and distribute pids locally, from 0 to numberofpidsperobject*/
     
    6464         * cpus by the total last pids of the previus cpu, starting from 0.
    6565         * First: get number of pids for each cpu*/
    66         allpidcount=xNew<int>(num_procs2);
     66        allpidcount=xNew<int>(num_procs);
    6767        #ifdef _HAVE_MPI_
    6868        MPI_Gather(&pidcount,1,MPI_INT,allpidcount,1,MPI_INT,0,IssmComm::GetComm());
    69         MPI_Bcast(allpidcount,num_procs2,MPI_INT,0,IssmComm::GetComm());
     69        MPI_Bcast(allpidcount,num_procs,MPI_INT,0,IssmComm::GetComm());
    7070        #else
    7171        allpidcount[0]=pidcount;
     
    7474        /* Every cpu should start its own pid count at the end of the pidcount from cpu-1*/
    7575        pidcount=0;
    76         if(my_rank2!=0){
    77                 for(i=0;i<my_rank2;i++){
     76        if(my_rank!=0){
     77                for(i=0;i<my_rank;i++){
    7878                        pidcount+=allpidcount[i];
    7979                }
     
    115115
    116116        int i;
    117         int num_procs2;
     117        int num_procs;
    118118
    119119        int* ranks=NULL;
    120120        int* minranks=NULL;
    121121       
    122         /*recover num_procs2:*/
    123         num_procs2=IssmComm::GetSize();
     122        /*recover num_procs:*/
     123        num_procs=IssmComm::GetSize();
    124124
    125125        /*Allocate ranks: */
     
    127127        minranks=xNew<int>(numberofobjects);
    128128
    129         for(i=0;i<numberofobjects;i++)ranks[i]=num_procs2; //no cpu can have rank num_procs. This is the maximum limit.
     129        for(i=0;i<numberofobjects;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit.
    130130
    131131        /*Now go through all our objects and ask them to report to who they belong (which rank): */
     
    184184void   Vertices::Ranks(int* ranks){
    185185
    186         int my_rank2;
     186        int my_rank;
    187187        int        sid;
    188188       
    189         /*recover my_rank2:*/
    190         my_rank2=IssmComm::GetRank();
     189        /*recover my_rank:*/
     190        my_rank=IssmComm::GetRank();
    191191
    192192        /*Go through a dataset, and for each object, report it cpu: */
     
    195195                Vertex* vertex=(Vertex*)this->GetObjectByOffset(i);
    196196                sid=vertex->Sid();
    197                 ranks[sid]=my_rank2;
    198         }
    199 }
    200 /*}}}*/
     197                ranks[sid]=my_rank;
     198        }
     199}
     200/*}}}*/
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r13609 r13612  
    8484        FILE       *petscoptionsfid = NULL;
    8585        FILE       *output_fid = NULL;
    86         int         my_rank2;
    87        
    88         /*recover my_rank2:*/
    89         my_rank2=IssmComm::GetRank();
     86        int         my_rank;
     87       
     88        /*recover my_rank:*/
     89        my_rank=IssmComm::GetRank();
    9090
    9191        /*Open input file on cpu 0: */
    92         if(my_rank2==0) IOMODEL = pfopen(inputfilename ,"rb");
     92        if(my_rank==0) IOMODEL = pfopen(inputfilename ,"rb");
    9393
    9494        /*Initialize internal data: */
     
    130130       
    131131        /*Close input file descriptors: */
    132         if(my_rank2==0) pfclose(IOMODEL,inputfilename);
     132        if(my_rank==0) pfclose(IOMODEL,inputfilename);
    133133
    134134        /*Open output file once for all and add output file name and file descriptor to parameters*/
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r13607 r13612  
    104104void  IoModel::CheckEnumSync(void){
    105105
    106         int my_rank2;
     106        int my_rank;
    107107        int record_enum = 0;
    108108
    109         /*recover my_rank2:*/
    110         my_rank2=IssmComm::GetRank();
     109        /*recover my_rank:*/
     110        my_rank=IssmComm::GetRank();
    111111
    112112        /*Check that some fields have been allocated*/
    113         _assert_(this->fid || my_rank2);
     113        _assert_(this->fid || my_rank);
    114114
    115115        /*Go find in the binary file, the position of the data we want to fetch: */
    116         if(my_rank2==0){ //cpu 0
     116        if(my_rank==0){ //cpu 0
    117117
    118118                /*First set FILE* position to the beginning of the file: */
     
    299299void  IoModel::FetchConstants(void){
    300300
    301         int my_rank2;
     301        int my_rank;
    302302       
    303303        /*record descriptions; */
     
    314314        int   string_size;
    315315
    316         /*recover my_rank2:*/
    317         my_rank2=IssmComm::GetRank();
     316        /*recover my_rank:*/
     317        my_rank=IssmComm::GetRank();
    318318
    319319        /*Check that some fields have been allocated*/
    320         _assert_(this->fid || my_rank2);
     320        _assert_(this->fid || my_rank);
    321321        _assert_(this->constants);
    322322
    323323        /*Go find in the binary file, the position of the data we want to fetch: */
    324         if(my_rank2==0){ //cpu 0{{{
     324        if(my_rank==0){ //cpu 0{{{
    325325       
    326326                /*First set FILE* position to the beginning of the file: */
     
    540540void  IoModel::FetchData(bool* pboolean,int data_enum){
    541541
    542         int my_rank2;
     542        int my_rank;
    543543       
    544544
     
    547547        int   code;
    548548       
    549         /*recover my_rank2:*/
    550         my_rank2=IssmComm::GetRank();
     549        /*recover my_rank:*/
     550        my_rank=IssmComm::GetRank();
    551551
    552552       
     
    557557       
    558558        /*We have to read a boolean from disk. */
    559         if(my_rank2==0){ 
     559        if(my_rank==0){ 
    560560                if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_("could not read boolean ");
    561561        }
     
    573573void  IoModel::FetchData(int* pinteger,int data_enum){
    574574
    575         int my_rank2;
     575        int my_rank;
    576576
    577577        /*output: */
     
    579579        int   code;
    580580       
    581         /*recover my_rank2:*/
    582         my_rank2=IssmComm::GetRank();
     581        /*recover my_rank:*/
     582        my_rank=IssmComm::GetRank();
    583583       
    584584        /*Set file pointer to beginning of the data: */
     
    588588       
    589589        /*We have to read a integer from disk. First read the dimensions of the integer, then the integer: */
    590         if(my_rank2==0){ 
     590        if(my_rank==0){ 
    591591                if(fread(&integer,sizeof(int),1,fid)!=1) _error_("could not read integer ");
    592592        }
     
    604604
    605605
    606         int my_rank2;
     606        int my_rank;
    607607       
    608608
     
    611611        int      code;
    612612       
    613         /*recover my_rank2:*/
    614         my_rank2=IssmComm::GetRank();
     613        /*recover my_rank:*/
     614        my_rank=IssmComm::GetRank();
    615615
    616616        /*Set file pointer to beginning of the data: */
     
    620620       
    621621        /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */
    622         if(my_rank2==0){
     622        if(my_rank==0){
    623623                if(fread(&scalar,sizeof(IssmPDouble),1,fid)!=1)_error_("could not read scalar ");
    624624        }
     
    635635void  IoModel::FetchData(char** pstring,int data_enum){
    636636
    637         int my_rank2;
     637        int my_rank;
    638638       
    639639
     
    643643        int code=0;
    644644       
    645         /*recover my_rank2:*/
    646         my_rank2=IssmComm::GetRank();
     645        /*recover my_rank:*/
     646        my_rank=IssmComm::GetRank();
    647647
    648648        /*Set file pointer to beginning of the data: */
     
    654654       
    655655        /*We have to read a string from disk. First read the dimensions of the string, then the string: */
    656         if(my_rank2==0){ 
     656        if(my_rank==0){ 
    657657                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
    658658        }
     
    668668
    669669                /*Read string on node 0, then broadcast: */
    670                 if(my_rank2==0){ 
     670                if(my_rank==0){ 
    671671                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
    672672                }
     
    688688void  IoModel::FetchData(int** pmatrix,int* pM,int* pN,int data_enum){
    689689
    690         int my_rank2;
     690        int my_rank;
    691691        int i,j;
    692692
     
    698698        int vector_type=0;
    699699       
    700         /*recover my_rank2:*/
    701         my_rank2=IssmComm::GetRank();
     700        /*recover my_rank:*/
     701        my_rank=IssmComm::GetRank();
    702702
    703703        /*Set file pointer to beginning of the data: */
     
    710710        /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
    711711        /*numberofelements: */
    712         if(my_rank2==0){ 
     712        if(my_rank==0){ 
    713713                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    714714        }
     
    718718        #endif
    719719
    720         if(my_rank2==0){ 
     720        if(my_rank==0){ 
    721721                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    722722        }
     
    730730
    731731                /*Read matrix on node 0, then broadcast: */
    732                 if(my_rank2==0){ 
     732                if(my_rank==0){ 
    733733                        if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
    734734                }
     
    764764void  IoModel::FetchData(IssmDouble** pmatrix,int* pM,int* pN,int data_enum){
    765765
    766         int my_rank2;
     766        int my_rank;
    767767
    768768        /*output: */
     
    772772        int vector_type=0;
    773773       
    774         /*recover my_rank2:*/
    775         my_rank2=IssmComm::GetRank();
     774        /*recover my_rank:*/
     775        my_rank=IssmComm::GetRank();
    776776
    777777        /*Set file pointer to beginning of the data: */
     
    783783        /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
    784784        /*numberofelements: */
    785         if(my_rank2==0){ 
     785        if(my_rank==0){ 
    786786                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    787787        }
     
    790790        #endif
    791791
    792         if(my_rank2==0){ 
     792        if(my_rank==0){ 
    793793                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    794794        }
     
    802802
    803803                /*Read matrix on node 0, then broadcast: */
    804                 if(my_rank2==0){ 
     804                if(my_rank==0){ 
    805805                        if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
    806806                }
     
    831831void  IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){
    832832
    833         int my_rank2;
     833        int my_rank;
    834834       
    835835        int i;
     
    844844        int   code;
    845845       
    846         /*recover my_rank2:*/
    847         my_rank2=IssmComm::GetRank();
     846        /*recover my_rank:*/
     847        my_rank=IssmComm::GetRank();
    848848
    849849        /*Set file pointer to beginning of the data: */
     
    853853       
    854854        /*We have to read a bunch of strings from disk. First read the number of strings, and allocate: */
    855         if(my_rank2==0){ 
     855        if(my_rank==0){ 
    856856                if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_("could not read length of string array");
    857857        }
     
    868868                for(i=0;i<numstrings;i++){
    869869                       
    870                         if(my_rank2==0){ 
     870                        if(my_rank==0){ 
    871871                                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
    872872                        }
     
    879879
    880880                                /*Read string on node 0, then broadcast: */
    881                                 if(my_rank2==0){ 
     881                                if(my_rank==0){ 
    882882                                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
    883883                                }
     
    905905        int i;
    906906
    907         int my_rank2;
     907        int my_rank;
    908908
    909909        /*output: */
     
    918918        int     code;
    919919       
    920         /*recover my_rank2:*/
    921         my_rank2=IssmComm::GetRank();
     920        /*recover my_rank:*/
     921        my_rank=IssmComm::GetRank();
    922922
    923923        /*Set file pointer to beginning of the data: */
     
    926926       
    927927        /*Now fetch: */
    928         if(my_rank2==0){ 
     928        if(my_rank==0){ 
    929929                if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
    930930        }
     
    949949                for(i=0;i<numrecords;i++){
    950950
    951                         if(my_rank2==0){ 
     951                        if(my_rank==0){ 
    952952                                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows in " << i << "th matrix of matrix array");
    953953                        }
     
    956956                        #endif
    957957
    958                         if(my_rank2==0){ 
     958                        if(my_rank==0){ 
    959959                                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns in " << i << "th matrix of matrix array");
    960960                        }
     
    968968
    969969                                /*Read matrix on node 0, then broadcast: */
    970                                 if(my_rank2==0){ 
     970                                if(my_rank==0){ 
    971971                                        if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
    972972                                }
     
    12791279void IoModel::LastIndex(int *pindex){
    12801280
    1281         int my_rank2;
     1281        int my_rank;
    12821282        int        lastindex,index;
    12831283        int        record_length;
    12841284       
    1285         /*recover my_rank2:*/
    1286         my_rank2=IssmComm::GetRank();
     1285        /*recover my_rank:*/
     1286        my_rank=IssmComm::GetRank();
    12871287
    12881288        /*Go find in the binary file, the position of the data we want to fetch: */
    1289         if(my_rank2==0){
     1289        if(my_rank==0){
    12901290
    12911291                /*First set FILE* position to the beginning of the file: */
     
    13181318FILE* IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){
    13191319
    1320         int my_rank2;
     1320        int my_rank;
    13211321
    13221322        int found         = 0;
     
    13261326        int vector_type   = 0; //nodal or elementary
    13271327
    1328         /*recover my_rank2:*/
    1329         my_rank2=IssmComm::GetRank();
     1328        /*recover my_rank:*/
     1329        my_rank=IssmComm::GetRank();
    13301330
    13311331        /*Go find in the binary file, the position of the data we want to fetch: */
    1332         if(my_rank2==0){
     1332        if(my_rank==0){
    13331333
    13341334                /*First set FILE* position to the beginning of the file: */
  • issm/trunk-jpl/src/c/classes/IssmComm.cpp

    r13610 r13612  
    1818}/*}}}*/
    1919int IssmComm::GetRank(){  /*{{{*/
    20         int my_rank2;
     20        int my_rank;
    2121        #ifdef _HAVE_MPI_
    22         MPI_Comm_rank(comm,&my_rank2);
     22        MPI_Comm_rank(comm,&my_rank);
    2323        #else
    24         my_rank2=0;
     24        my_rank=0;
    2525        #endif
    26         return my_rank2;
     26        return my_rank;
    2727
    2828}/*}}}*/
  • issm/trunk-jpl/src/c/classes/Patch.cpp

    r13609 r13612  
    111111        int         i;
    112112        int         count;
    113         int         my_rank2;
    114         int         num_procs2;
     113        int         my_rank;
     114        int         num_procs;
    115115        int         total_numrows;
    116116        int         node_numrows;
     
    120120        #endif
    121121       
    122         /*recover my_rank2:*/
    123         my_rank2=IssmComm::GetRank();
    124         num_procs2=IssmComm::GetSize();
     122        /*recover my_rank:*/
     123        my_rank=IssmComm::GetRank();
     124        num_procs=IssmComm::GetSize();
    125125
    126126        /*First, figure out total number of rows combining all the cpus: */
     
    136136
    137137        /*Now, allocate buffer to holds all the values, on node 0: */
    138         if(my_rank2==0)total_values=xNew<IssmDouble>(this->numcols*total_numrows);
     138        if(my_rank==0)total_values=xNew<IssmDouble>(this->numcols*total_numrows);
    139139
    140140        /*Start by copying node 0 values onto total_values: */
    141         if(my_rank2==0){
     141        if(my_rank==0){
    142142                count=0;
    143143                xMemCpy<IssmDouble>(total_values+count,this->values,this->numcols*this->numrows);
     
    147147        /*Now, ask other nodes to send their values: */
    148148        #ifdef _HAVE_MPI_
    149         for (i=1;i<num_procs2;i++){
    150                 if (my_rank2==i){
     149        for (i=1;i<num_procs;i++){
     150                if (my_rank==i){
    151151                        MPI_Send(&this->numrows,1,MPI_INT,0,1,IssmComm::GetComm());   
    152152                        if (this->numrows)MPI_Send(this->values,this->numrows*this->numcols,MPI_DOUBLE,0,1,IssmComm::GetComm());
    153153                }
    154                 if (my_rank2==0){
     154                if (my_rank==0){
    155155                        MPI_Recv(&node_numrows,1,MPI_INT,i,1,IssmComm::GetComm(),&status);
    156156                        if (node_numrows)MPI_Recv(total_values+count,node_numrows*this->numcols,MPI_DOUBLE,i,1,IssmComm::GetComm(),&status);
     
    162162        /*Now, node 0 has total_values, of size total_numrows*this->numcols. Update the fields in the patch, to reflect this new
    163163         * reality. For other cpus, no point in keeping their data anymore: */
    164         if(my_rank2==0){
     164        if(my_rank==0){
    165165                this->numrows=total_numrows;
    166166                xDelete<IssmDouble>(this->values);
  • issm/trunk-jpl/src/c/classes/objects/ExternalResults/GenericExternalResult.h

    r13609 r13612  
    110110void WriteData(FILE* fid,bool io_gather){ /*{{{*/
    111111                       
    112         int     my_rank2;
     112        int     my_rank;
    113113        int     type;
    114114        int     size;
    115115        IssmPDouble  passiveDouble;
    116116       
    117         /*recover my_rank2:*/
    118         my_rank2=IssmComm::GetRank();
     117        /*recover my_rank:*/
     118        my_rank=IssmComm::GetRank();
    119119
    120120        /*return if now on cpu 0: */
    121         if(my_rank2)return;
     121        if(my_rank)return;
    122122
    123123        /*use generic part, same for all ResultTypes: */
     
    205205template <> inline void GenericExternalResult<char*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
    206206
    207         int     my_rank2;
     207        int     my_rank;
    208208        int     type;
    209209        int     length;
    210210       
    211         /*recover my_rank2:*/
    212         my_rank2=IssmComm::GetRank();
     211        /*recover my_rank:*/
     212        my_rank=IssmComm::GetRank();
    213213
    214214        /*return if now on cpu 0: */
    215         if(my_rank2)return;
     215        if(my_rank)return;
    216216
    217217        /*use generic part, same for all ResultTypes: */
     
    287287template <> inline void GenericExternalResult<IssmPDouble*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
    288288       
    289         int     my_rank2;
     289        int     my_rank;
    290290        int     length;
    291291        int     type;
     
    294294        IssmPDouble passiveDouble;
    295295       
    296         /*recover my_rank2:*/
    297         my_rank2=IssmComm::GetRank();
     296        /*recover my_rank:*/
     297        my_rank=IssmComm::GetRank();
    298298
    299299        if(io_gather){
    300300                /*we are gathering the data on cpu 0, don't write on other cpus: */
    301                 if(my_rank2) return;
     301                if(my_rank) return;
    302302        }
    303303
  • issm/trunk-jpl/src/c/classes/objects/IndependentObject.cpp

    r13608 r13612  
    8282void IndependentObject::FetchIndependent(IoModel* iomodel){
    8383
    84         int my_rank2;
     84        int my_rank;
    8585        FILE* fid=NULL;
    8686       
    87         /*recover my_rank2:*/
    88         my_rank2=IssmComm::GetRank();
     87        /*recover my_rank:*/
     88        my_rank=IssmComm::GetRank();
    8989
    9090        #ifdef _HAVE_ADOLC_ //cannot come here unless you are running AD mode, from DeclaredIndependents:
     
    105105
    106106                /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */
    107                 if(my_rank2==0){
     107                if(my_rank==0){
    108108                        if(fread(&pscalar,sizeof(IssmPDouble),1,fid)!=1)_error_("could not read scalar ");
    109109                }
     
    143143                /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
    144144                /*numberofelements: */
    145                 if(my_rank2==0){ 
     145                if(my_rank==0){ 
    146146                        if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    147147                }
     
    150150                #endif
    151151
    152                 if(my_rank2==0){ 
     152                if(my_rank==0){ 
    153153                        if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    154154                }
     
    163163
    164164                        /*Read matrix on node 0, then broadcast: */
    165                         if(my_rank2==0){ 
     165                        if(my_rank==0){ 
    166166                                if(fread(buffer,M*N*sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix ");
    167167                               
  • issm/trunk-jpl/src/c/classes/objects/Node.cpp

    r13608 r13612  
    979979void  Node::SetClone(int* minranks){
    980980
    981         int my_rank2;
     981        int my_rank;
    982982       
    983         /*recover my_rank2:*/
    984         my_rank2=IssmComm::GetRank();
    985 
    986         if (minranks[sid]==my_rank2){
     983        /*recover my_rank:*/
     984        my_rank=IssmComm::GetRank();
     985
     986        if (minranks[sid]==my_rank){
    987987                indexing.clone=false;
    988988        }
  • issm/trunk-jpl/src/c/classes/objects/Vertex.cpp

    r13608 r13612  
    178178void  Vertex::SetClone(int* minranks){
    179179
    180         int my_rank2;
     180        int my_rank;
    181181       
    182         /*recover my_rank2:*/
    183         my_rank2=IssmComm::GetRank();
     182        /*recover my_rank:*/
     183        my_rank=IssmComm::GetRank();
    184184
    185         if (minranks[this->sid]==my_rank2){
     185        if (minranks[this->sid]==my_rank){
    186186                this->clone=false;
    187187        }
  • issm/trunk-jpl/src/c/io/Disk/WriteLockFile.cpp

    r13606 r13612  
    99
    1010        int i;
    11         int my_rank2;
     11        int my_rank;
    1212
    13         /*recover my_rank2:*/
    14         my_rank2=IssmComm::GetRank();
     13        /*recover my_rank:*/
     14        my_rank=IssmComm::GetRank();
    1515       
    1616        /* output: */
     
    1818
    1919        /* Open lock file and write 1 into it: */
    20         if(my_rank2==0){
     20        if(my_rank==0){
    2121                fid=fopen(filename,"w");
    2222                if(fid==NULL) _error_("error message: could not open lock file " << filename);
  • issm/trunk-jpl/src/c/io/PrintfFunction.cpp

    r13609 r13612  
    1616        int   n,size = 100;
    1717        int   string_size;
    18         int   my_rank2;
     18        int   my_rank;
    1919        //variable list of arguments
    2020        va_list args;
    2121       
    22         /*recover my_rank2:*/
    23         my_rank2=IssmComm::GetRank();
     22        /*recover my_rank:*/
     23        my_rank=IssmComm::GetRank();
    2424
    2525        while(true){
     
    4646
    4747        /*Ok, if we are running in parallel, get node 0 to print*/
    48         if(my_rank2==0)_printString_(buffer);
     48        if(my_rank==0)_printString_(buffer);
    4949
    5050        /*Clean up and return*/
     
    5353}
    5454int PrintfFunction(const string & message){
    55         int  my_rank2;
     55        int  my_rank;
    5656       
    57         /*recover my_rank2:*/
    58         my_rank2=IssmComm::GetRank();
     57        /*recover my_rank:*/
     58        my_rank=IssmComm::GetRank();
    5959
    60         if(my_rank2==0){
     60        if(my_rank==0){
    6161                printf("%s\n",message.c_str());
    6262        }
     
    6464}
    6565int PrintfFunction2(const string & message){
    66         int  my_rank2;
     66        int  my_rank;
    6767
    68         /*recover my_rank2:*/
    69         my_rank2=IssmComm::GetRank();
     68        /*recover my_rank:*/
     69        my_rank=IssmComm::GetRank();
    7070
    71         if(my_rank2==0){
     71        if(my_rank==0){
    7272                printf("%s",message.c_str());
    7373        }
  • issm/trunk-jpl/src/c/matlab/io/PrintfFunction.cpp

    r13609 r13612  
    1818        int   n,size = 100;
    1919        int         string_size;
    20         int  my_rank2;
     20        int  my_rank;
    2121       
    22         /*recover my_rank2:*/
    23         my_rank2=IssmComm::GetRank();
     22        /*recover my_rank:*/
     23        my_rank=IssmComm::GetRank();
    2424
    2525        //variable list of arguments
     
    5353
    5454        /*Ok, if we are running in parallel, get node 0 to print*/
    55         if(my_rank2==0)_printString_(buffer);
     55        if(my_rank==0)_printString_(buffer);
    5656
    5757        /*Clean up and return*/
  • issm/trunk-jpl/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp

    r13592 r13612  
    2121
    2222        int        i,j,k;
    23         int        my_rank2;
     23        int        my_rank;
    2424        bool       process_units = true;
    2525
     
    3636        /*retrieve npart: */
    3737        parameters->FindParam(&npart,QmuNumberofpartitionsEnum);
    38         my_rank2=IssmComm::GetRank();
     38        my_rank=IssmComm::GetRank();
    3939
    4040        /*save the d_responses pointer: */
     
    5757
    5858                        /*Copy onto our dakota responses: */
    59                         if(my_rank2==0){
     59                        if(my_rank==0){
    6060                                /*plug response: */
    6161                                for(i=0;i<npart;i++)responses_pointer[i]=qmu_response[i];
     
    7878                        Responsex(&femmodel_response,elements,nodes, vertices,loads,materials, parameters,root,process_units,0);//0 is the index for weights
    7979                       
    80                         if(my_rank2==0){
     80                        if(my_rank==0){
    8181                                /*plug response: */
    8282                                responses_pointer[0]=femmodel_response;
     
    9797                        Responsex(&femmodel_response,elements,nodes, vertices,loads,materials, parameters,root,process_units,0);//0 is the weight index
    9898
    99                         if(my_rank2==0){
     99                        if(my_rank==0){
    100100                                /*plug response: */
    101101                                responses_pointer[0]=femmodel_response;
     
    110110
    111111        /*Synthesize echo: {{{*/
    112         if(my_rank2==0){
     112        if(my_rank==0){
    113113                _printString_("   responses: " << d_numresponses << ": ");
    114114                for(i=0;i<d_numresponses-1;i++)_printString_(d_responses[i] << "|");
  • issm/trunk-jpl/src/c/modules/ElementResponsex/ElementResponsex.cpp

    r13592 r13612  
    1313       
    1414
    15         int my_rank2;
     15        int my_rank;
    1616        int i;
    1717
     
    2525        /*retrieve element we are interested in: */
    2626        parameters->FindParam(&index,IndexEnum);
    27         my_rank2=IssmComm::GetRank();
     27        my_rank=IssmComm::GetRank();
    2828
    2929        /*now, go through our elements, and retrieve the one with this id: index: */
     
    3232                if (element->Id()==index){
    3333                        found=1;
    34                         cpu_found=my_rank2;
     34                        cpu_found=my_rank;
    3535                        break;
    3636                }
     
    4444
    4545        /*Ok, we found the element, compute responseocity: */
    46         if(my_rank2==cpu_found){
     46        if(my_rank==cpu_found){
    4747                element->ElementResponse(&response,response_enum,IuToExtEnum);
    4848        }
  • issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp

    r13593 r13612  
    1414int pKrigingx(double** ppredictions,double **perror,double* obs_x, double* obs_y, double* obs_list, int obs_length,double* x_interp,double* y_interp,int n_interp,Options* options){
    1515
    16         int num_procs2;
    17         int my_rank2;
     16        int num_procs;
     17        int my_rank;
    1818
    1919        /*output*/
     
    2828        Observations *observations = NULL;
    2929
    30         /*Get my_rank2: */
    31         my_rank2=IssmComm::GetRank();
    32         num_procs2=IssmComm::GetSize();
     30        /*Get my_rank: */
     31        my_rank=IssmComm::GetRank();
     32        num_procs=IssmComm::GetSize();
    3333
    3434        /*Get some Options*/
     
    5959
    6060                /*partition loop across threads: */
    61                 for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
     61                for(int idx=my_rank;idx<n_interp;idx+=num_procs){
    6262                        _pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
    6363                        observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram);
     
    7777
    7878                /*partition loop across threads: */
    79                 for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
     79                for(int idx=my_rank;idx<n_interp;idx+=num_procs){
    8080                        _pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
    8181                        observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
     
    9494
    9595                /*partition loop across threads: */
    96                 for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
     96                for(int idx=my_rank;idx<n_interp;idx+=num_procs){
    9797                        _pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
    9898                        observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r13593 r13612  
    2222        int i;
    2323
    24         int my_rank2;
    25         int num_procs2;
     24        int my_rank;
     25        int num_procs;
    2626        int    numberofelements;
    2727        int    numberofvertices;
     
    4747        IssmDouble* vertex_pairing=NULL;
    4848
    49         /*Get my_rank2:*/
    50         my_rank2=IssmComm::GetRank();
    51         num_procs2=IssmComm::GetSize();
     49        /*Get my_rank:*/
     50        my_rank=IssmComm::GetRank();
     51        num_procs=IssmComm::GetSize();
    5252
    5353        /*Fetch parameters: */
     
    7777        }
    7878
    79         MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,elements, numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width, dim,num_procs2);
     79        MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,elements, numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width, dim,num_procs);
    8080
    8181        /*Free elements and elements2d: */
     
    103103
    104104                /*!All elements have been partitioned above, only deal with elements for this cpu: */
    105                 if(my_rank2==epart[i]){
     105                if(my_rank==epart[i]){
    106106
    107107                        my_elements[i]=true;
  • issm/trunk-jpl/src/c/modules/NodalValuex/NodalValuex.cpp

    r13592 r13612  
    1212void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){
    1313
    14         int my_rank2;
     14        int my_rank;
    1515        int i;
    1616        int index;
     
    2121        int cpu_found;
    2222
    23         /*Get my_rank2:*/
    24         my_rank2=IssmComm::GetRank();
     23        /*Get my_rank:*/
     24        my_rank=IssmComm::GetRank();
    2525
    2626        /*retrieve element we are interested in: */
     
    3333                found=element->NodalValue(&value,index,natureofdataenum,process_units);
    3434                if (found){
    35                         cpu_found=my_rank2;
     35                        cpu_found=my_rank;
    3636                        break;
    3737                }
  • issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp

    r13609 r13612  
    1818void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
    1919
    20         int         my_rank2;
     20        int         my_rank;
    2121        FILE       *fid                     = NULL;
    2222        char       *outputfilename          = NULL;
     
    3030        parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
    3131       
    32         /*recover my_rank2:*/
    33         my_rank2=IssmComm::GetRank();
     32        /*recover my_rank:*/
     33        my_rank=IssmComm::GetRank();
    3434
    3535        if(dakota_analysis){
     
    4545        /*Results do not include the type of solution being run . In parallel, we output results to a filename,
    4646         *therefore, we need to include the solutiontype into the filename: */
    47         if(my_rank2==0){
     47        if(my_rank==0){
    4848                parameters->FindParam(&solutiontype,SolutionTypeEnum);
    4949                EnumToStringx(&solutiontypestring,solutiontype);
     
    6363                if(io_gather){
    6464                        /*Just open the file for output on cpu 0. We are gathering the data on cpu 0 from all other cpus: */
    65                         if(my_rank2==0) fid=pfopen(outputfilename ,"wb");
     65                        if(my_rank==0) fid=pfopen(outputfilename ,"wb");
    6666                }
    6767                else{
    6868                        /*We are opening different  files for output on all cpus. Append the  rank to the filename, and open: */
    6969                        parameters->FindParam(&fid,OutputFilePointerEnum);
    70                         sprintf(cpu_outputfilename,"%s.%i",outputfilename,my_rank2);
     70                        sprintf(cpu_outputfilename,"%s.%i",outputfilename,my_rank);
    7171                        fid=pfopen(cpu_outputfilename ,"wb");
    7272                }
     
    8787          if((step==1) && (time==0)){
    8888          if(io_gather){
    89           if(my_rank2==0) pfclose(fid,outputfilename);
     89          if(my_rank==0) pfclose(fid,outputfilename);
    9090          }
    9191          else pfclose(fid,cpu_outputfilename);
  • issm/trunk-jpl/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp

    r13592 r13612  
    2323
    2424        char line [1000];
    25         int my_rank2;
     25        int my_rank;
    2626        int i;
    2727
     
    3535        int   stringlength;
    3636
    37         /*Get my_rank2:*/
    38         my_rank2=IssmComm::GetRank();
     37        /*Get my_rank:*/
     38        my_rank=IssmComm::GetRank();
    3939
    40         if(my_rank2==0){
     40        if(my_rank==0){
    4141
    4242                /*Now, go through lines and figure out how many analyses we have: */
     
    100100        #ifdef _HAVE_MPI_
    101101        MPI_Bcast(&numanalyses,1,MPI_INT,0,IssmComm::GetComm());
    102         if(my_rank2!=0){
     102        if(my_rank!=0){
    103103                analyses=xNew<IssmPDouble>(numanalyses);
    104104                strings=xNew<char*>(numanalyses);
     
    108108        for(i=0;i<numanalyses;i++){
    109109                char* string=strings[i];
    110                 if(my_rank2==0){
     110                if(my_rank==0){
    111111                        if(string==NULL) _error_("PETSc options for analysis " << EnumToStringx(reCast<int>(analyses[i])) << " have been declared but were not found");
    112112                }
    113                 if(my_rank2==0)stringlength=(strlen(string)+1)*sizeof(char);
     113                if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char);
    114114                #ifdef _HAVE_MPI_
    115115                MPI_Bcast(&stringlength,1,MPI_INT,0,IssmComm::GetComm());
    116                 if(my_rank2!=0)string=xNew<char>(stringlength);
     116                if(my_rank!=0)string=xNew<char>(stringlength);
    117117                MPI_Bcast(string,stringlength,MPI_CHAR,0,IssmComm::GetComm());
    118                 if(my_rank2!=0)strings[i]=string;
     118                if(my_rank!=0)strings[i]=string;
    119119                #endif
    120120        }
  • issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp

    r13594 r13612  
    3030ErrorException::~ErrorException() throw(){
    3131       
    32         int num_procs2;
     32        int num_procs;
    3333       
    34         /*recover num_procs2:*/
    35         num_procs2=IssmComm::GetSize();
     34        /*recover num_procs:*/
     35        num_procs=IssmComm::GetSize();
    3636
    3737        /*We want the report only for matlab modules, otherwise we get twice the report
    3838         * We assume that if num_procs==1, it is a module (FIXME)*/
    39         if(num_procs2==1) this->Report();
     39        if(num_procs==1) this->Report();
    4040}
    4141
     
    4646void ErrorException::Report() const{
    4747       
    48         int my_rank2;
    49         int num_procs2;
     48        int my_rank;
     49        int num_procs;
    5050       
    51         /*recover my_rank2 and num_procs2:*/
    52         my_rank2=IssmComm::GetRank();
    53         num_procs2=IssmComm::GetSize();
     51        /*recover my_rank and num_procs:*/
     52        my_rank=IssmComm::GetRank();
     53        num_procs=IssmComm::GetSize();
    5454
    5555
     
    5959        }
    6060        else{
    61                 if(num_procs2==1){
     61                if(num_procs==1){
    6262                        _printLine_("\n??? Error using ==> " << file_name.c_str() << ":" << file_line);
    6363                        _printLine_(function_name.c_str() << " error message: " << what() << "\n");
    6464                }
    6565                else{
    66                         _printLine_("\n[" << my_rank2<< "] ??? Error using ==> " << file_name.c_str() << ":" << file_line);
    67                         _printLine_("[" << my_rank2 << "] " << function_name.c_str() << " error message: " << what() << "\n");
     66                        _printLine_("\n[" << my_rank<< "] ??? Error using ==> " << file_name.c_str() << ":" << file_line);
     67                        _printLine_("[" << my_rank << "] " << function_name.c_str() << " error message: " << what() << "\n");
    6868                }
    6969        }
  • issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp

    r13593 r13612  
    103103
    104104        int i;
    105         int my_rank2;
     105        int my_rank;
    106106
    107107        /*inputs and outputs: */
     
    115115        int   string_length;
    116116
    117         /*recover my_rank2:*/
    118         my_rank2=IssmComm::GetRank();
     117        /*recover my_rank:*/
     118        my_rank=IssmComm::GetRank();
    119119
    120120        /*recover inputs from pointers: */
     
    128128       
    129129        /*variables:*/
    130         if(my_rank2!=0)variables=xNew<double>(numvariables);
     130        if(my_rank!=0)variables=xNew<double>(numvariables);
    131131        MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,IssmComm::GetComm());
    132132
    133133        /*variables_descriptors: */
    134         if(my_rank2!=0){
     134        if(my_rank!=0){
    135135                variables_descriptors=xNew<char*>(numvariables);
    136136        }
    137137        for(i=0;i<numvariables;i++){
    138                 if(my_rank2==0){
     138                if(my_rank==0){
    139139                        string=variables_descriptors[i];
    140140                        string_length=(strlen(string)+1)*sizeof(char);
    141141                }
    142142                MPI_Bcast(&string_length,1,MPI_INT,0,IssmComm::GetComm());
    143                 if(my_rank2!=0)string=xNew<char>(string_length);
     143                if(my_rank!=0)string=xNew<char>(string_length);
    144144                MPI_Bcast(string,string_length,MPI_CHAR,0,IssmComm::GetComm());
    145                 if(my_rank2!=0)variables_descriptors[i]=string;
     145                if(my_rank!=0)variables_descriptors[i]=string;
    146146        }
    147147
     
    160160
    161161        int i;
    162         int my_rank2;
     162        int my_rank;
    163163       
    164164        double  *variables             = NULL;
     
    172172        responses_descriptors=*presponses_descriptors;
    173173
    174         /*recover my_rank2:*/
    175         my_rank2=IssmComm::GetRank();
     174        /*recover my_rank:*/
     175        my_rank=IssmComm::GetRank();
    176176
    177177        /*Free variables and variables_descriptors only on cpu !=0*/
    178         if(my_rank2!=0){
     178        if(my_rank!=0){
    179179                xDelete<double>(variables);
    180180                for(i=0;i<numvariables;i++){
  • issm/trunk-jpl/src/c/solutions/dakota_core.cpp

    r13609 r13612  
    5757        #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
    5858       
    59         int                my_rank2;
     59        int                my_rank;
    6060        char*              dakota_input_file  = NULL;
    6161        char*              dakota_output_file = NULL;
     
    7070        femmodel->parameters->FindParam(&dakota_error_file,QmuErrNameEnum);
    7171       
    72         /*recover my_rank2:*/
    73         my_rank2=IssmComm::GetRank();
     72        /*recover my_rank:*/
     73        my_rank=IssmComm::GetRank();
    7474
    75         if(my_rank2==0){
     75        if(my_rank==0){
    7676       
    7777                // Instantiate/initialize the parallel library and problem description
  • issm/trunk-jpl/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp

    r13602 r13612  
    1919
    2020        /*from MPI: */
    21         int num_procs2;
    22         int my_rank2;
     21        int num_procs;
     22        int my_rank;
    2323
    24         /*recover my_rank2*/
    25         MPI_Comm_rank(comm,&my_rank2);
    26         MPI_Comm_size(comm,&num_procs2);
     24        /*recover my_rank*/
     25        MPI_Comm_rank(comm,&my_rank);
     26        MPI_Comm_size(comm,&num_procs);
    2727
    2828       
    2929        /*We are  not bound by any library, just use what seems most logical*/
    30         num_local_rows=xNew<int>(num_procs2);   
     30        num_local_rows=xNew<int>(num_procs);   
    3131
    32         for (i=0;i<num_procs2;i++){
     32        for (i=0;i<num_procs;i++){
    3333                /*Here, we use floor. We under distribute rows. The rows
    3434                  left  are then redistributed, therefore resulting in a
    3535                  more even distribution.*/
    36                 num_local_rows[i]=(int)floor((double)global_size/(double)num_procs2);
     36                num_local_rows[i]=(int)floor((double)global_size/(double)num_procs);
    3737        }
    3838       
    3939        /*There may be some rows left. Distribute evenly.*/
    40         row_rest=global_size - num_procs2*(int)floor((double)global_size/(double)num_procs2);
     40        row_rest=global_size - num_procs*(int)floor((double)global_size/(double)num_procs);
    4141        for (i=0;i<row_rest;i++){
    4242                num_local_rows[i]++;
    4343        }
    44         local_size=num_local_rows[my_rank2];
     44        local_size=num_local_rows[my_rank];
    4545       
    4646        /*free ressources: */
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/GetOwnershipBoundariesFromRange.cpp

    r13601 r13612  
    1717
    1818        /*externals :*/
    19         int my_rank2;
    20         int num_procs2;
     19        int my_rank;
     20        int num_procs;
    2121       
    22         /*recover my_rank2 and num_procs2:*/
    23         MPI_Comm_size(comm,&num_procs2);
    24         MPI_Comm_rank(comm,&my_rank2);
     22        /*recover my_rank and num_procs:*/
     23        MPI_Comm_size(comm,&num_procs);
     24        MPI_Comm_rank(comm,&my_rank);
    2525
    2626        /*output: */
     
    3232
    3333        /*Gather all range values into allranges, for all nodes*/
    34         allranges=xNew<int>(num_procs2);
     34        allranges=xNew<int>(num_procs);
    3535        MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,comm);
    3636
     
    3838        lower_row=0;
    3939        upper_row=lower_row+allranges[0];
    40         for (i=1;i<=my_rank2;i++){
     40        for (i=1;i<=my_rank;i++){
    4141                lower_row=lower_row+allranges[i-1];
    4242                upper_row=upper_row+allranges[i];
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/MatMultPatch.cpp

    r13603 r13612  
    5050        int result=1;
    5151        int sumresult;
    52         int num_procs2;
     52        int num_procs;
    5353       
    54         /*recover num_procs2:*/
    55         MPI_Comm_size(comm,&num_procs2);
     54        /*recover num_procs:*/
     55        MPI_Comm_size(comm,&num_procs);
    5656
    5757        MatGetLocalSize(A,&local_m,&local_n);;
     
    6363        MPI_Reduce (&result,&sumresult,1,MPI_INT,MPI_SUM,0,comm );
    6464        MPI_Bcast(&sumresult,1,MPI_INT,0,comm);               
    65         if (sumresult!=num_procs2){
     65        if (sumresult!=num_procs){
    6666                result=0;
    6767        }
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/MatToSerial.cpp

    r13601 r13612  
    1616
    1717        int i;
    18         int my_rank2;
    19         int num_procs2;
     18        int my_rank;
     19        int num_procs;
    2020       
    2121        /*Petsc variables*/
     
    2929        int buffer[3];
    3030       
    31         /*recover my_rank2 and num_procs2:*/
    32         MPI_Comm_size(comm,&num_procs2);
    33         MPI_Comm_rank(comm,&my_rank2);
     31        /*recover my_rank and num_procs:*/
     32        MPI_Comm_size(comm,&num_procs);
     33        MPI_Comm_rank(comm,&my_rank);
    3434
    3535        /*Output*/
     
    4545       
    4646        /*Local and global allocation*/
    47         if (my_rank2==0)outmatrix=xNew<double>(M*N);
     47        if (my_rank==0)outmatrix=xNew<double>(M*N);
    4848       
    4949        if (range){
     
    6565         * We send these rows to the matrix on node 0*/
    6666       
    67         for (i=1;i<num_procs2;i++){
    68                 if (my_rank2==i){
    69                         buffer[0]=my_rank2;
     67        for (i=1;i<num_procs;i++){
     68                if (my_rank==i){
     69                        buffer[0]=my_rank;
    7070                        buffer[1]=lower_row;
    7171                        buffer[2]=range;
     
    7373                        if (range)MPI_Send(local_matrix,N*range,MPI_DOUBLE,0,1,comm);
    7474                }
    75                 if (my_rank2==0){
     75                if (my_rank==0){
    7676                        MPI_Recv(buffer,3,MPI_INT,i,1,comm,&status);
    7777                        if (buffer[2])MPI_Recv(outmatrix+(buffer[1]*N),N*buffer[2],MPI_DOUBLE,i,1,comm,&status);
    7878                }
    7979        }
    80         if (my_rank2==0){
     80        if (my_rank==0){
    8181                //Still have the local_matrix on node 0 to take care of.
    8282                memcpy(outmatrix,local_matrix,N*range*sizeof(double));
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/VecToMPISerial.cpp

    r13601 r13612  
    1616       
    1717        int i;
    18         int num_procs2;
    19         int my_rank2;
     18        int num_procs;
     19        int my_rank;
    2020
    2121        /*Petsc*/
     
    3535        double* gathered_vector=NULL; //Global vector holding the final assembled vector on all nodes.
    3636       
    37         /*recover my_rank2 and num_procs2*/
    38         MPI_Comm_size(comm,&num_procs2);
    39         MPI_Comm_rank(comm,&my_rank2);
     37        /*recover my_rank and num_procs*/
     38        MPI_Comm_size(comm,&num_procs);
     39        MPI_Comm_rank(comm,&my_rank);
    4040
    4141        VecGetSize(vector,&vector_size);
     
    6565        /*Now each node holds its local_vector containing range rows.
    6666         * We send this local_vector  to the gathered_vector on node 0*/
    67         for (i=1;i<num_procs2;i++){
    68                 if (my_rank2==i){
    69                         buffer[0]=my_rank2;
     67        for (i=1;i<num_procs;i++){
     68                if (my_rank==i){
     69                        buffer[0]=my_rank;
    7070                        buffer[1]=lower_row;
    7171                        buffer[2]=range;
     
    7373                        if (range)MPI_Send(local_vector,range,MPI_DOUBLE,0,1,comm);
    7474                }
    75                 if (my_rank2==0){
     75                if (my_rank==0){
    7676                        MPI_Recv(buffer,3,MPI_INT,i,1,comm,&status);
    7777                        if (buffer[2])MPI_Recv(gathered_vector+buffer[1],buffer[2],MPI_DOUBLE,i,1,comm,&status);
     
    7979        }
    8080
    81         if (my_rank2==0){
     81        if (my_rank==0){
    8282                //Still have the local_vector on node 0 to take care of.
    8383                if (range)memcpy(gathered_vector+lower_row,local_vector,range*sizeof(double));
Note: See TracChangeset for help on using the changeset viewer.