/[escript]/trunk/escript/src/Utils.cpp
ViewVC logotype

Diff of /trunk/escript/src/Utils.cpp

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

revision 3258 by caltinay, Fri Feb 19 00:38:45 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 27  Line 27 
27  #include <omp.h>  #include <omp.h>
28  #endif  #endif
29    
30  #ifdef PASO_MPI  #ifdef ESYS_MPI
31  #include <mpi.h>  #include <mpi.h>
32  #endif  #endif
33    
# Line 85  void printParallelThreadCnt() Line 85  void printParallelThreadCnt()
85    strcpy(hname, "unknown host");    strcpy(hname, "unknown host");
86  #endif  #endif
87    
88    #ifdef PASO_MPI    #ifdef ESYS_MPI
89    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_iam);    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_iam);
90    MPI_Comm_size(MPI_COMM_WORLD, &mpi_num);    MPI_Comm_size(MPI_COMM_WORLD, &mpi_num);
91    #endif    #endif
# Line 124  int getNumberOfThreads() Line 124  int getNumberOfThreads()
124    
125  ESCRIPT_DLL_API int getMPISizeWorld() {  ESCRIPT_DLL_API int getMPISizeWorld() {
126    int mpi_num = 1;    int mpi_num = 1;
127    #ifdef PASO_MPI    #ifdef ESYS_MPI
128    MPI_Comm_size(MPI_COMM_WORLD, &mpi_num);    MPI_Comm_size(MPI_COMM_WORLD, &mpi_num);
129    #endif    #endif
130    return mpi_num;    return mpi_num;
# Line 132  ESCRIPT_DLL_API int getMPISizeWorld() { Line 132  ESCRIPT_DLL_API int getMPISizeWorld() {
132    
133  ESCRIPT_DLL_API int getMPIRankWorld() {  ESCRIPT_DLL_API int getMPIRankWorld() {
134    int mpi_iam = 0;    int mpi_iam = 0;
135    #ifdef PASO_MPI    #ifdef ESYS_MPI
136    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_iam);    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_iam);
137    #endif    #endif
138    return mpi_iam;    return mpi_iam;
139  }  }
140    
141  ESCRIPT_DLL_API int getMPIWorldMax(const int val) {  ESCRIPT_DLL_API int getMPIWorldMax(const int val) {
142    #ifdef PASO_MPI    #ifdef ESYS_MPI
143    int val2 = val;    int val2 = val;
144    int out = val;    int out = val;
145    MPI_Allreduce( &val2, &out, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD );    MPI_Allreduce( &val2, &out, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD );
# Line 150  ESCRIPT_DLL_API int getMPIWorldMax(const Line 150  ESCRIPT_DLL_API int getMPIWorldMax(const
150  }  }
151    
152  ESCRIPT_DLL_API int getMPIWorldSum(const int val) {  ESCRIPT_DLL_API int getMPIWorldSum(const int val) {
153    #ifdef PASO_MPI    #ifdef ESYS_MPI
154    int val2 = val;    int val2 = val;
155    int out = 0;    int out = 0;
156    MPI_Allreduce( &val2, &out, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );    MPI_Allreduce( &val2, &out, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
# Line 167  ESCRIPT_DLL_API double getMaxFloat() { Line 167  ESCRIPT_DLL_API double getMaxFloat() {
167     return DBL_MAX;     return DBL_MAX;
168  }  }
169  ESCRIPT_DLL_API void MPIBarrierWorld() {  ESCRIPT_DLL_API void MPIBarrierWorld() {
170    #ifdef PASO_MPI    #ifdef ESYS_MPI
171    MPI_Barrier(MPI_COMM_WORLD );    MPI_Barrier(MPI_COMM_WORLD );
172    #endif    #endif
173  }  }
# Line 406  bool append) Line 406  bool append)
406      } catch (...)      } catch (...)
407      {      {
408      error=1;      error=1;
409  #ifndef PASO_MPI  #ifndef ESYS_MPI
410      throw;      throw;
411  #endif  #endif
412      }      }
413  #ifdef PASO_MPI  #ifdef ESYS_MPI
414      MPI_Comm com=data[0].getDomain()->getMPIComm();      MPI_Comm com=data[0].getDomain()->getMPIComm();
415      int rerror=0;      int rerror=0;
416      MPI_Allreduce( &error, &rerror, 1, MPI_INT, MPI_MAX, com );      MPI_Allreduce( &error, &rerror, 1, MPI_INT, MPI_MAX, com );
# Line 422  bool append) Line 422  bool append)
422  #endif  #endif
423    
424      // at this point os will contain the text to be written      // at this point os will contain the text to be written
425  #ifndef PASO_MPI  #ifndef ESYS_MPI
426    
427      std::ofstream ofs;      std::ofstream ofs;
428      if (append)      if (append)

Legend:
Removed from v.3258  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26