ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
parallel_reduce.h
Go to the documentation of this file.
1#ifndef PARALLEL_REDUCE_H
2#define PARALLEL_REDUCE_H
3
4#ifdef __MPI
5#include <mpi.h>
6#endif
7
8#include <cassert>
9#include <complex>
10
12{
13
14#ifdef __MPI
15template <typename T>
16struct MPI_Type;
17
18template <>
19struct MPI_Type<int>
20{
21 static const MPI_Datatype value;
22};
23
24template <>
25struct MPI_Type<double>
26{
27 static const MPI_Datatype value;
28};
29
30template <>
31struct MPI_Type<float>
32{
33 static const MPI_Datatype value;
34};
35
36template <>
37struct MPI_Type<std::complex<double>>
38{
39 static const MPI_Datatype value;
40};
41
42template <>
43struct MPI_Type<std::complex<float>>
44{
45 static const MPI_Datatype value;
46};
47
48template <>
49struct MPI_Type<long long>
50{
51 static const MPI_Datatype value;
52};
53#endif
54
56template <typename T>
57void reduce_all(T& object);
58template <typename T>
59void reduce_all(T* object, const int n);
60template <typename T>
61void reduce_pool(T& object);
62template <typename T>
63void reduce_pool(T* object, const int n);
64template <typename T>
65void reduce_min(T& v);
66template <typename T>
67void reduce_max(T& v);
69void reduce_max(double* values, const int count);
70template <typename T>
71void reduce_min_pool(const int& nproc_in_pool, T& v);
72template <typename T>
73void reduce_max_pool(const int& nproc_in_pool, T& v);
74
75// reduce double only in this pool
76// (each pool contain different k points)
77void reduce_double_grid(double* object, const int n);
78void reduce_double_diag(double* object, const int n);
79
80void reduce_double_allpool(const int& npool, const int& nproc_in_pool, double& object);
81void reduce_double_allpool(const int& npool, const int& nproc_in_pool, double* object, const int n);
82
83void gather_int_all(int& v, int* all);
84
85} // namespace Parallel_Reduce
86
87#endif
#define complex
Definition elpa_new.h:28
#define T
Definition exp.cpp:237
Definition parallel_reduce.h:12
void reduce_all(T &object)
reduce in all process
Definition depend_mock.cpp:14
void reduce_double_grid(double *object, const int n)
Definition parallel_reduce.cpp:129
void reduce_double_allpool(const int &npool, const int &nproc_in_pool, double &object)
Definition parallel_reduce.cpp:145
void reduce_double_diag(double *object, const int n)
Definition parallel_reduce.cpp:137
void reduce_max(T &v)
Definition parallel_reduce.cpp:57
void gather_int_all(int &v, int *all)
Definition parallel_reduce.cpp:173
void reduce_min(T &v)
Definition parallel_reduce.cpp:49
void reduce_max_pool(const int &nproc_in_pool, T &v)
Definition parallel_reduce.cpp:84
void reduce_min_pool(const int &nproc_in_pool, T &v)
Definition parallel_reduce.cpp:65
void reduce_pool(T &object)
Definition depend_mock.cpp:15
static const MPI_Datatype value
Definition parallel_reduce.h:27
static const MPI_Datatype value
Definition parallel_reduce.h:33
static const MPI_Datatype value
Definition parallel_reduce.h:21
static const MPI_Datatype value
Definition parallel_reduce.h:51
static const MPI_Datatype value
Definition parallel_reduce.h:39
static const MPI_Datatype value
Definition parallel_reduce.h:45
Definition parallel_reduce.h:16
int nproc_in_pool
Definition pw_test.cpp:12