Changeset 13607
- Timestamp:
- 10/10/12 23:15:15 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/IoModel.cpp
r13594 r13607 334 334 record_code=0; //0 means bailout 335 335 #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: */ 337 337 #endif 338 338 break; … … 346 346 #ifdef _HAVE_MPI_ 347 347 /*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: */ 349 349 350 350 /*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()); 353 353 #endif 354 354 … … 358 358 if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error_("could not read boolean "); 359 359 #ifdef _HAVE_MPI_ 360 MPI_Bcast(&booleanint,1,MPI_INT,0, MPI_COMM_WORLD);360 MPI_Bcast(&booleanint,1,MPI_INT,0,IssmComm::GetComm()); 361 361 #endif 362 362 … … 369 369 if(fread(&integer,sizeof(int),1,this->fid)!=1) _error_("could not read integer "); 370 370 #ifdef _HAVE_MPI_ 371 MPI_Bcast(&integer,1,MPI_INT,0, MPI_COMM_WORLD);371 MPI_Bcast(&integer,1,MPI_INT,0,IssmComm::GetComm()); 372 372 #endif 373 373 … … 386 386 if(fread(&pscalar,sizeof(IssmPDouble),1,this->fid)!=1) _error_("could not read scalar "); 387 387 #ifdef _HAVE_MPI_ 388 MPI_Bcast(&pscalar,1,MPI_DOUBLE,0, MPI_COMM_WORLD);388 MPI_Bcast(&pscalar,1,MPI_DOUBLE,0,IssmComm::GetComm()); 389 389 #endif 390 390 scalar=reCast<IssmDouble>(pscalar); … … 399 399 if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error_("could not read length of string "); 400 400 #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()); 402 402 #endif 403 403 … … 409 409 if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error_(" could not read string "); 410 410 #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()); 412 412 #endif 413 413 } … … 467 467 else{ //cpu ~0 {{{ 468 468 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: */ 470 470 if(record_code==0){ 471 471 break; //we are done, break from the loop 472 472 } 473 473 else{ 474 MPI_Bcast(&record_enum,1,MPI_INT,0, MPI_COMM_WORLD); //get from cpu 0 name of the data475 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()); 476 476 switch(record_code){ 477 477 case 1: 478 478 /*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()); 480 480 481 481 /*create BoolParam: */ … … 485 485 case 2: 486 486 /*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()); 488 488 489 489 /*create IntParam: */ … … 493 493 case 3: 494 494 /*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()); 496 496 497 497 /*create DoubleParam: */ … … 500 500 break; 501 501 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()); 503 503 if(string_size){ 504 504 string=xNew<char>((string_size+1)); … … 506 506 507 507 /*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()); 509 509 } 510 510 else{ … … 561 561 } 562 562 #ifdef _HAVE_MPI_ 563 MPI_Bcast(&booleanint,1,MPI_INT,0, MPI_COMM_WORLD);563 MPI_Bcast(&booleanint,1,MPI_INT,0,IssmComm::GetComm()); 564 564 #endif 565 565 … … 593 593 594 594 #ifdef _HAVE_MPI_ 595 MPI_Bcast(&integer,1,MPI_INT,0, MPI_COMM_WORLD);595 MPI_Bcast(&integer,1,MPI_INT,0,IssmComm::GetComm()); 596 596 #endif 597 597 … … 624 624 } 625 625 #ifdef _HAVE_MPI_ 626 MPI_Bcast(&scalar,1,MPI_DOUBLE,0, MPI_COMM_WORLD);626 MPI_Bcast(&scalar,1,MPI_DOUBLE,0,IssmComm::GetComm()); 627 627 #endif 628 628 … … 659 659 660 660 #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()); 662 662 #endif 663 663 … … 672 672 } 673 673 #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()); 675 675 #endif 676 676 } … … 715 715 716 716 #ifdef _HAVE_MPI_ 717 MPI_Bcast(&M,1,MPI_INT,0, MPI_COMM_WORLD);717 MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm()); 718 718 #endif 719 719 … … 722 722 } 723 723 #ifdef _HAVE_MPI_ 724 MPI_Bcast(&N,1,MPI_INT,0, MPI_COMM_WORLD);724 MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm()); 725 725 #endif 726 726 … … 735 735 736 736 #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()); 738 738 #endif 739 739 } … … 787 787 } 788 788 #ifdef _HAVE_MPI_ 789 MPI_Bcast(&M,1,MPI_INT,0, MPI_COMM_WORLD);789 MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm()); 790 790 #endif 791 791 … … 794 794 } 795 795 #ifdef _HAVE_MPI_ 796 MPI_Bcast(&N,1,MPI_INT,0, MPI_COMM_WORLD);796 MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm()); 797 797 #endif 798 798 … … 806 806 } 807 807 #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()); 809 809 #endif 810 810 … … 857 857 } 858 858 #ifdef _HAVE_MPI_ 859 MPI_Bcast(&numstrings,1,MPI_INT,0, MPI_COMM_WORLD);859 MPI_Bcast(&numstrings,1,MPI_INT,0,IssmComm::GetComm()); 860 860 #endif 861 861 … … 872 872 } 873 873 #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()); 875 875 #endif 876 876 if(string_size){ … … 883 883 } 884 884 #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()); 886 886 #endif 887 887 } … … 930 930 } 931 931 #ifdef _HAVE_MPI_ 932 MPI_Bcast(&numrecords,1,MPI_INT,0, MPI_COMM_WORLD);932 MPI_Bcast(&numrecords,1,MPI_INT,0,IssmComm::GetComm()); 933 933 #endif 934 934 … … 953 953 } 954 954 #ifdef _HAVE_MPI_ 955 MPI_Bcast(&M,1,MPI_INT,0, MPI_COMM_WORLD);955 MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm()); 956 956 #endif 957 957 … … 960 960 } 961 961 #ifdef _HAVE_MPI_ 962 MPI_Bcast(&N,1,MPI_INT,0, MPI_COMM_WORLD);962 MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm()); 963 963 #endif 964 964 … … 973 973 974 974 #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()); 976 976 #endif 977 977 matrices[i]=xNew<IssmDouble>(M*N); … … 1308 1308 /*Broadcast code and vector type: */ 1309 1309 #ifdef _HAVE_MPI_ 1310 MPI_Bcast(&lastindex,1,MPI_INT,0, MPI_COMM_WORLD);1310 MPI_Bcast(&lastindex,1,MPI_INT,0,IssmComm::GetComm()); 1311 1311 #endif 1312 1312 … … 1364 1364 } 1365 1365 #ifdef _HAVE_MPI_ 1366 MPI_Bcast(&found,1,MPI_INT,0, MPI_COMM_WORLD);1366 MPI_Bcast(&found,1,MPI_INT,0,IssmComm::GetComm()); 1367 1367 if(!found)_error_("could not find data with name " << EnumToStringx(data_enum) << " in binary file"); 1368 1368 #endif … … 1370 1370 /*Broadcast code and vector type: */ 1371 1371 #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()); 1375 1375 #endif 1376 1376 -
issm/trunk-jpl/src/c/classes/Patch.cpp
r13413 r13607 122 122 /*First, figure out total number of rows combining all the cpus: */ 123 123 #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()); 126 126 #else 127 127 total_numrows=this->numrows; … … 145 145 for (i=1;i<num_procs;i++){ 146 146 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()); 149 149 } 150 150 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); 153 153 count+=node_numrows*this->numcols; 154 154 } -
issm/trunk-jpl/src/c/classes/objects/IndependentObject.cpp
r13426 r13607 117 117 118 118 #ifdef _HAVE_MPI_ 119 MPI_Bcast(&scalar,1,MPI_DOUBLE,0, MPI_COMM_WORLD);119 MPI_Bcast(&scalar,1,MPI_DOUBLE,0,IssmComm::GetComm()); 120 120 #endif 121 121 … … 151 151 } 152 152 #ifdef _HAVE_MPI_ 153 MPI_Bcast(&M,1,MPI_INT,0, MPI_COMM_WORLD);153 MPI_Bcast(&M,1,MPI_INT,0,IssmComm::GetComm()); 154 154 #endif 155 155 … … 158 158 } 159 159 #ifdef _HAVE_MPI_ 160 MPI_Bcast(&N,1,MPI_INT,0, MPI_COMM_WORLD);160 MPI_Bcast(&N,1,MPI_INT,0,IssmComm::GetComm()); 161 161 #endif 162 162 … … 174 174 } 175 175 #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()); 177 177 #endif 178 178 -
issm/trunk-jpl/src/c/classes/objects/Profiler.cpp
r13573 r13607 71 71 if(!dontmpisync){ 72 72 #ifdef _HAVE_MPI_ 73 MPI_Barrier( MPI_COMM_WORLD);73 MPI_Barrier(IssmComm::GetComm()); 74 74 #endif 75 75 }
Note:
See TracChangeset
for help on using the changeset viewer.