ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
ghost_exchange_plan.h
Go to the documentation of this file.
1#ifndef GHOST_EXCHANGE_PLAN_H
2#define GHOST_EXCHANGE_PLAN_H
3
4#include <cstddef>
5#include <limits>
6#include <vector>
7
9{
10 int nswap;
11 int* sendnum;
12 int* recvnum;
16 int* mapping;
17 std::vector<int*> sendlist_storage;
18};
19
21{
22 std::vector<int> sendnum;
23 std::vector<int> recvnum;
24 std::vector<int> firstrecv;
25 std::vector<std::vector<int> > send_atom_indices;
26 std::vector<int> sendproc;
27 std::vector<int> recvproc;
28 // For a single rank, map every local atom (owned and ghost) to its owned
29 // atom index. Distributed DeePMD obtains this information from exchange
30 // metadata instead.
31 std::vector<int> mapping;
32 int nprocs;
33
35
37
38 bool is_valid(const std::size_t natom) const
39 {
40 const std::size_t nswap = sendnum.size();
41 const bool communication_sizes_match = recvnum.size() == nswap && firstrecv.size() == nswap
42 && send_atom_indices.size() == nswap
43 && sendproc.size() == nswap && recvproc.size() == nswap;
44 const bool nswap_fits_int = nswap <= static_cast<std::size_t>(std::numeric_limits<int>::max());
45 const bool mapping_matches_atoms = nprocs != 1 || mapping.size() == natom;
46 return communication_sizes_match && nswap_fits_int && mapping_matches_atoms;
47 }
48};
49
50#endif // GHOST_EXCHANGE_PLAN_H
Definition ghost_exchange_plan.h:9
int * recvproc
Definition ghost_exchange_plan.h:15
int * sendnum
Definition ghost_exchange_plan.h:11
int nswap
Definition ghost_exchange_plan.h:10
int * recvnum
Definition ghost_exchange_plan.h:12
int * firstrecv
Definition ghost_exchange_plan.h:13
std::vector< int * > sendlist_storage
Definition ghost_exchange_plan.h:17
int * sendproc
Definition ghost_exchange_plan.h:14
int * mapping
Definition ghost_exchange_plan.h:16
std::vector< std::vector< int > > send_atom_indices
Definition ghost_exchange_plan.h:25
GhostExchangePlanView make_view()
Definition dom_ghost.cpp:20
std::vector< int > recvnum
Definition ghost_exchange_plan.h:23
int nprocs
Definition ghost_exchange_plan.h:32
GhostExchangePlan()
Definition ghost_exchange_plan.h:34
std::vector< int > mapping
Definition ghost_exchange_plan.h:31
std::vector< int > firstrecv
Definition ghost_exchange_plan.h:24
std::vector< int > sendproc
Definition ghost_exchange_plan.h:26
std::vector< int > sendnum
Definition ghost_exchange_plan.h:22
bool is_valid(const std::size_t natom) const
Definition ghost_exchange_plan.h:38
std::vector< int > recvproc
Definition ghost_exchange_plan.h:27