Changeset 14330


Ignore:
Timestamp:
02/07/13 16:16:06 (12 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixed kriging with new communication tools

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

Legend:

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

    r13612 r14330  
    2828        Observations *observations = NULL;
    2929
     30        /*timing*/
     31        double   start, finish;
     32        double   start_core, finish_core;
     33        double   start_init, finish_init;
     34
    3035        /*Get my_rank: */
    3136        my_rank=IssmComm::GetRank();
     
    3338
    3439        /*Get some Options*/
     40        MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime();
    3541        options->Get(&radius,"searchradius",0.);
    3642        options->Get(&mindata,"mindata",1);
     
    3844
    3945        /*Process observation dataset*/
     46        MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
    4047        observations=new Observations(obs_list,obs_x,obs_y,obs_length,options);
     48        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    4149
    4250        /*Allocate output*/
     
    4755        options->Get(&output,"output",(char*)"prediction");
    4856
     57        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    4958        if(strcmp(output,"quadtree")==0){
    5059                observations->QuadtreeColoring(predictions,x_interp,y_interp,n_interp);
     
    109118                _error_("output '" << output << "' not supported yet");
    110119        }
     120        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    111121
    112122        /*clean-up and Assign output pointer*/
     
    116126        *ppredictions = predictions;
    117127        *perror       = error;
     128
     129        MPI_Barrier(MPI_COMM_WORLD); finish=MPI_Wtime( );
     130        _printf_(true,"\n   %-34s %f seconds  \n","Observation fitering elapsed time:",finish_init-start_init);
     131        _printf_(true,"   %-34s %f seconds  \n","Kriging prediction elapsed time:",finish_core-start_core);
     132        _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60);
    118133        return 1;
    119134}/*}}}*/
  • issm/trunk-jpl/src/c/solutions/kriging.cpp

    r13798 r14330  
    88void ProcessArguments2(char** pbinfilename,char** poutbinfilename,char** plockfilename,char** prootpath,int argc,char **argv);
    99void ProcessInputfile(IssmDouble **px,IssmDouble **py,IssmDouble **pdata,int *pnobs,IssmDouble **px_interp,IssmDouble **py_interp,int *pninterp,Options **poptions,FILE* fid);
    10 
    11 int my_rank;
    12 int num_procs;
    1310
    1411int main(int argc,char **argv){
     
    2623
    2724        MPI_Comm comm;
    28         extern int my_rank;
    29         extern int num_procs;
    3025
    3126        /*Input*/
     
    4742        /*Initialize environment (MPI, PETSC, MUMPS, etc ...)*/
    4843        comm=EnvironmentInit(argc,argv);
     44        IssmComm::SetComm(comm);
    4945
    50         MPI_Comm_size(comm,&num_procs);
    51         MPI_Comm_rank(comm,&my_rank);
    52 
    53         /*First process inputs*/
    54         _pprintLine_("");
    55         _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION);
    56         _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")");
    57         _pprintLine_("");
    5846        ProcessArguments2(&binfilename,&outbinfilename,&lockfilename,&rootpath,argc,argv);
    5947
     
    6856        _pprintLine_("write results to disk:");
    6957        Results *results = new Results();
    70         if(my_rank==0){
     58        if(IssmComm::GetRank()==0){
    7159                output_fid=pfopen(outbinfilename,"wb");
    7260                results->AddObject(new GenericExternalResult<double*>(results->Size()+1,0,predictions,ninterp,1,1,0));
Note: See TracChangeset for help on using the changeset viewer.