/[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 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC revision 1568 by ksteube, Sat May 24 03:15:08 2008 UTC
# Line 20  Line 20 
20  #include <omp.h>  #include <omp.h>
21  #endif  #endif
22    
23    #ifdef PASO_MPI
24    #include <mpi.h>
25    #endif
26    
27  namespace escript {  namespace escript {
28    
29  int getSvnVersion()  int getSvnVersion()
# Line 31  int getSvnVersion() Line 35  int getSvnVersion()
35  #endif  #endif
36  }  }
37    
38    void printParallelThreadCnt()
39    {
40      int mpi_iam=0, mpi_num=1;
41      char hname[64];
42    
43      gethostname(hname, 64);
44    
45      #ifdef PASO_MPI
46      MPI_Comm_rank(MPI_COMM_WORLD, &mpi_iam);
47      MPI_Comm_size(MPI_COMM_WORLD, &mpi_num);
48      #endif
49    
50      #ifdef _OPENMP
51      #pragma omp parallel
52      #endif
53      {
54        int omp_iam=0, omp_num=1;
55        #ifdef _OPENMP
56        omp_iam = omp_get_thread_num(); /* Call in a parallel region */
57        omp_num = omp_get_num_threads();
58        #endif
59        printf("printParallelThreadCounts: MPI=%d/%d OpenMP=%d/%d running on %s\n", mpi_iam, mpi_num, omp_iam, omp_num, hname);
60      }
61    }
62    
63  void setNumberOfThreads(const int num_threads)  void setNumberOfThreads(const int num_threads)
64  {  {
65    

Legend:
Removed from v.1312  
changed lines
  Added in v.1568

  ViewVC Help
Powered by ViewVC 1.1.26