Changeset 13593


Ignore:
Timestamp:
10/10/12 21:09:15 (13 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
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp

    r13592 r13593  
    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         extern int num_procs;
     16        int num_procs2;
    1717        int my_rank2;
    1818
     
    3030        /*Get my_rank2: */
    3131        my_rank2=IssmComm::GetRank();
     32        num_procs2=IssmComm::GetSize();
    3233
    3334        /*Get some Options*/
     
    5859
    5960                /*partition loop across threads: */
    60                 for(int idx=my_rank2;idx<n_interp;idx+=num_procs){
     61                for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
    6162                        _pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
    6263                        observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram);
     
    7677
    7778                /*partition loop across threads: */
    78                 for(int idx=my_rank2;idx<n_interp;idx+=num_procs){
     79                for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
    7980                        _pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
    8081                        observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
     
    9394
    9495                /*partition loop across threads: */
    95                 for(int idx=my_rank2;idx<n_interp;idx+=num_procs){
     96                for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
    9697                        _pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
    9798                        observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r13592 r13593  
    2323
    2424        int my_rank2;
    25         extern int num_procs;
     25        int num_procs2;
    2626        int    numberofelements;
    2727        int    numberofvertices;
     
    4949        /*Get my_rank2:*/
    5050        my_rank2=IssmComm::GetRank();
     51        num_procs2=IssmComm::GetSize();
    5152
    5253        /*Fetch parameters: */
     
    7677        }
    7778
    78         MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,elements, numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width, dim,num_procs);
     79        MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,elements, numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width, dim,num_procs2);
    7980
    8081        /*Free elements and elements2d: */
  • issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp

    r13591 r13593  
    4545       
    4646        int i;
    47         extern int my_rank;
    4847       
    4948        char   **responses_descriptors     = NULL; //these are our!  there are only numresponsedescriptors of them, not d_numresponses!!!
     
    104103
    105104        int i;
    106         extern int my_rank;
     105        int my_rank2;
    107106
    108107        /*inputs and outputs: */
     
    116115        int   string_length;
    117116
     117        /*recover my_rank2:*/
     118        my_rank2=IssmComm::GetRank();
    118119
    119120        /*recover inputs from pointers: */
     
    127128       
    128129        /*variables:*/
    129         if(my_rank!=0)variables=xNew<double>(numvariables);
     130        if(my_rank2!=0)variables=xNew<double>(numvariables);
    130131        MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,IssmComm::GetComm());
    131132
    132133        /*variables_descriptors: */
    133         if(my_rank!=0){
     134        if(my_rank2!=0){
    134135                variables_descriptors=xNew<char*>(numvariables);
    135136        }
    136137        for(i=0;i<numvariables;i++){
    137                 if(my_rank==0){
     138                if(my_rank2==0){
    138139                        string=variables_descriptors[i];
    139140                        string_length=(strlen(string)+1)*sizeof(char);
    140141                }
    141142                MPI_Bcast(&string_length,1,MPI_INT,0,IssmComm::GetComm());
    142                 if(my_rank!=0)string=xNew<char>(string_length);
     143                if(my_rank2!=0)string=xNew<char>(string_length);
    143144                MPI_Bcast(string,string_length,MPI_CHAR,0,IssmComm::GetComm());
    144                 if(my_rank!=0)variables_descriptors[i]=string;
     145                if(my_rank2!=0)variables_descriptors[i]=string;
    145146        }
    146147
     
    159160
    160161        int i;
    161         extern int my_rank;
     162        int my_rank2;
    162163       
    163164        double  *variables             = NULL;
     
    171172        responses_descriptors=*presponses_descriptors;
    172173
     174        /*recover my_rank2:*/
     175        my_rank2=IssmComm::GetRank();
    173176
    174177        /*Free variables and variables_descriptors only on cpu !=0*/
    175         if(my_rank!=0){
     178        if(my_rank2!=0){
    176179                xDelete<double>(variables);
    177180                for(i=0;i<numvariables;i++){
Note: See TracChangeset for help on using the changeset viewer.