/[escript]/trunk-mpi-branch/paso/src/Paso_MPI.c
ViewVC logotype

Diff of /trunk-mpi-branch/paso/src/Paso_MPI.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1086 by gross, Tue Mar 6 04:41:55 2007 UTC revision 1087 by gross, Thu Apr 12 10:01:47 2007 UTC
# Line 14  Paso_MPIInfo* Paso_MPIInfo_alloc( MPI_Co Line 14  Paso_MPIInfo* Paso_MPIInfo_alloc( MPI_Co
14    out = MEMALLOC( 1, Paso_MPIInfo );    out = MEMALLOC( 1, Paso_MPIInfo );
15        
16    out->reference_counter = 0;    out->reference_counter = 0;
17      out->msg_tag_counter = 0;
18    #ifdef PASO_MPI    #ifdef PASO_MPI
19       error = MPI_Comm_rank( comm, &out->rank )==MPI_SUCCESS && MPI_Comm_size( comm, &out->size )==MPI_SUCCESS;       error = MPI_Comm_rank( comm, &out->rank )==MPI_SUCCESS && MPI_Comm_size( comm, &out->size )==MPI_SUCCESS;
20       if( !error ) {       if( !error ) {
# Line 45  Paso_MPIInfo *Paso_MPIInfo_getReference( Line 46  Paso_MPIInfo *Paso_MPIInfo_getReference(
46        
47    return in;    return in;
48  }  }
49    index_t PASO_MPI_mod(index_t k, index_t n)
50    {
51        index_t q, out=0;
52        if (n>0) {
53            q=k/n;
54            if (k>0) {
55               out=k-n*q;
56            } else if (k<0) {
57               out=k-n*(q-1);
58            }
59        }
60        return out;
61    }
62    
63    
64  /* checks that there is no error accross all processes in a communicator */  /* checks that there is no error accross all processes in a communicator */
65  /* NOTE : does not make guarentee consistency of error string on each process */  /* NOTE : does not make guarentee consistency of error string on each process */
66  bool_t Paso_MPI_noError( Paso_MPIInfo *mpi_info )  bool_t Paso_MPI_noError( Paso_MPIInfo *mpi_info )
67  {  {
   int errorGlobal=0;  
68    int errorLocal = (int)Paso_noError();    int errorLocal = (int)Paso_noError();
69    #ifdef PASO_MPI    int errorGlobal=errorLocal;
70      if (mpi_info->size>1) {
71         #ifdef PASO_MPI
72       MPI_Allreduce( &errorLocal, &errorGlobal, 1, MPI_INT, MPI_LAND, mpi_info->comm  );       MPI_Allreduce( &errorLocal, &errorGlobal, 1, MPI_INT, MPI_LAND, mpi_info->comm  );
73         #else
            // take care of the case where the error was on another processor  
            if( errorLocal && !errorGlobal )  
                    Paso_setError( PASO_MPI_ERROR, "Paso_MPI_noError() : there was an error on another MPI process" );  
   #else  
74       errorGlobal=errorLocal;       errorGlobal=errorLocal;
75    #endif       #endif
76         // take care of the case where the error was on another processor
77         if( errorLocal && !errorGlobal )
78                       Paso_setError( PASO_MPI_ERROR, "Paso_MPI_noError() : there was an error on another MPI process" );
79      }
80    return (bool_t) errorGlobal;    return (bool_t) errorGlobal;
81  }  }
82    

Legend:
Removed from v.1086  
changed lines
  Added in v.1087

  ViewVC Help
Powered by ViewVC 1.1.26