MpiHelper.cc 718 Bytes
Newer Older
1
2
#include "MpiHelper.h"

3
4
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS

5
6
7
8
9
10
11
12
13
namespace AMDiS {

  namespace mpi {

    void globalAdd(double &value)
    {
      double valCopy = value;
      MPI::COMM_WORLD.Allreduce(&valCopy, &value, 1, MPI_DOUBLE, MPI_SUM);
    }
14
15
16
17
18
19

    void globalAdd(int &value)
    {
      int valCopy = value;
      MPI::COMM_WORLD.Allreduce(&valCopy, &value, 1, MPI_INT, MPI_SUM);
    }
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
    
    void globalMin(double &value)
    {
      double valCopy = value;
      MPI::COMM_WORLD.Allreduce(&valCopy, &value, 1, MPI_DOUBLE, MPI_MIN);
    }
    
    void globalMax(double &value)
    {
      double valCopy = value;
      MPI::COMM_WORLD.Allreduce(&valCopy, &value, 1, MPI_DOUBLE, MPI_MAX);
    }

  }
}
35
36

#endif