forked from deepmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpara_diag_world.h
More file actions
51 lines (41 loc) · 1.28 KB
/
Copy pathpara_diag_world.h
File metadata and controls
51 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef PARA_DIAG_WORLD_H
#define PARA_DIAG_WORLD_H
#include "para_world.h"
namespace Parallel
{
/**
* @brief diag parallel domain: diagonalization group topology.
*
* Self-contained replacement for DIAG_WORLD + GlobalV::DRANK/DSIZE/DCOLOR.
* The diag domain is created by splitting MPI_COMM_WORLD into groups
* for parallel diagonalization (PEXSI, ScaLAPACK).
*
* Tests only need this header; no parallel_comm.h or parallel_global.h.
*/
class ParaDiagWorld : public ParaWorld
{
public:
/**
* @brief Construct a serial diag domain (single-process group).
*/
ParaDiagWorld();
#ifdef __MPI
/**
* @brief Construct a diag domain from an existing communicator.
*
* @param[in] comm diag communicator (e.g. DIAG_WORLD)
* @param[in] dcolor color used in MPI_Comm_split to create this group
*/
ParaDiagWorld(const MPI_Comm& comm, int dcolor);
#endif
/// Color used in MPI_Comm_split to create this diag group.
int dcolor() const { return dcolor_; }
/// Rank within the diag group (alias for rank()).
int drank() const { return rank(); }
/// Number of processes in the diag group (alias for size()).
int dsize() const { return size(); }
private:
int dcolor_ = 0;
};
} // namespace Parallel
#endif // PARA_DIAG_WORLD_H