XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
domain_decomposition.hpp
Go to the documentation of this file.
1 #ifndef DOMAIN_DECOMPOSITION_HPP
2 #define DOMAIN_DECOMPOSITION_HPP
3 #include "space_settings.hpp"
4 #include "NamelistReader.hpp"
5 #ifdef USE_MPI
6 # include "my_mpi.hpp"
7 #endif
9 #include "grid_weights.hpp"
10 
11 #include "vertex_list.hpp"
12 #include "host_array.hpp"
13 
15  View<int*,CLayout,HostType> cnts;
16  View<int*,CLayout,HostType> displs;
17  int my_rank;
18 
19  DistributionPlan(int my_rank_in, int nranks)
20  : cnts(NoInit("cnts"), nranks),
21  displs(NoInit("displs"), nranks),
22  my_rank(my_rank_in)
23  {}
24 
25  int my_count() const{
26  return cnts(my_rank);
27  }
28 
29  int my_displ() const{
30  return displs(my_rank);
31  }
32 };
33 
34 // Decomposition class
35 template<class Device>
37  public:
38 
39  // Constructor
41 
42  DomainDecomposition(NLReader::NamelistReader& nlr, int nnodes_in);
43 
44  DomainDecomposition(int nranks_in);
45 
46  void setup_gvid0_pid(NLReader::NamelistReader& nlr, int nnodes_in);
47 
48  int nplanes;
49 
50 #ifdef USE_MPI
51  // MPI communicators etc
52  const MyMPI mpi;
53 #endif
54 
55  // Updater
56  void update(int new_f0_inode1);
57 
58  void update_pol_decomp();
59 
60  void update_flux_surf(const HostArray<VertexList>& surfaces);
61 
62  KOKKOS_INLINE_FUNCTION int node_to_plane_rank(int node) const;
63 
64  KOKKOS_INLINE_FUNCTION void node_to_rank(const SimdGridWeights<Order::Zero, PIT_GLOBAL>& grid_wts0, const Simd<int>& iphi, bool plane_sort_only, Simd<int>& pid) const;
65 
66  int node_to_plane_rank_h(int node, int initial_guess) const;
67 
69 
70  VertexList vertex_list() const;
71 
72  VertexList vertex_list(int ipid) const;
73 
74  // Constants
75  bool pol_decomp;
78  int n_pids;
79  int my_pid;
83 
86 
87  // Variables
89  int nnodes;
90 
91  // Views
92  Kokkos::View<int*,Kokkos::LayoutRight,HostType> gvid0_pid_h;
93  Kokkos::View<int*,Kokkos::LayoutRight,Device> gvid0_pid;
94 
95  View<int*,CLayout,HostType> surfs;
96  View<int*,CLayout,HostType> ranks_sharing_flux_surf;
97 
98 };
99 
100 #include "domain_decomposition.tpp"
101 #endif
Definition: domain_decomposition.hpp:14
bool decompose_fields
Whether to decompose fields.
Definition: domain_decomposition.hpp:84
DistributionPlan(int my_rank_in, int nranks)
Definition: domain_decomposition.hpp:19
View< int *, CLayout, HostType > ranks_sharing_flux_surf
Which processors share a flux surface with this one.
Definition: domain_decomposition.hpp:96
int plane_totalpe
Processors per plane?
Definition: domain_decomposition.hpp:77
int my_displ() const
Definition: domain_decomposition.hpp:29
View< int *, CLayout, HostType > displs
Definition: domain_decomposition.hpp:16
int plane_index
Offset of local plane.
Definition: domain_decomposition.hpp:81
Definition: grid_weights.hpp:47
Definition: NamelistReader.hpp:193
View< int *, CLayout, HostType > cnts
Definition: domain_decomposition.hpp:15
VertexList vertex_list() const
Definition: domain_decomposition.cpp:282
int node_offset
Offset of first mesh node belonging to this MPI rank.
Definition: domain_decomposition.hpp:88
void update_pol_decomp()
Definition: domain_decomposition.cpp:229
int nnodes
Number of nodes belonging to this MPI rank.
Definition: domain_decomposition.hpp:89
int my_pid
ID of this processor.
Definition: domain_decomposition.hpp:79
int pe_per_plane
Processors per plane.
Definition: domain_decomposition.hpp:76
Definition: my_mpi.hpp:19
int n_pids
Processors per plane?
Definition: domain_decomposition.hpp:78
int nnodes_on_plane
Number of nodes on local plane.
Definition: domain_decomposition.hpp:82
void setup_gvid0_pid(NLReader::NamelistReader &nlr, int nnodes_in)
Definition: domain_decomposition.cpp:68
void update(int new_f0_inode1)
Definition: domain_decomposition.cpp:209
Definition: field_decomposition.hpp:12
int nplanes
Definition: domain_decomposition.hpp:48
View< int *, CLayout, HostType > surfs
Which surfaces are at least partially on this rank.
Definition: domain_decomposition.hpp:95
Kokkos::View< int *, Kokkos::LayoutRight, Device > gvid0_pid
Which processors get which vertices.
Definition: domain_decomposition.hpp:93
int my_plane_pid
Poloidal ID of this processor.
Definition: domain_decomposition.hpp:80
void update_flux_surf(const HostArray< VertexList > &surfaces)
Definition: domain_decomposition.cpp:118
KOKKOS_INLINE_FUNCTION void node_to_rank(const SimdGridWeights< Order::Zero, PIT_GLOBAL > &grid_wts0, const Simd< int > &iphi, bool plane_sort_only, Simd< int > &pid) const
Definition: domain_decomposition.tpp:32
DomainDecomposition(NLReader::NamelistReader &nlr)
Definition: domain_decomposition.cpp:21
Definition: domain_decomposition.hpp:36
Definition: vertex_list.hpp:53
FieldDecomposition< Device > field_decomp
Definition: domain_decomposition.hpp:85
int my_count() const
Definition: domain_decomposition.hpp:25
int node_to_plane_rank_h(int node, int initial_guess) const
Definition: domain_decomposition.cpp:252
bool pol_decomp
Use poloidal decomposition.
Definition: domain_decomposition.hpp:75
KOKKOS_INLINE_FUNCTION int node_to_plane_rank(int node) const
Definition: domain_decomposition.tpp:14
Kokkos::ViewAllocateWithoutInitializing NoInit
Definition: space_settings.hpp:69
int my_rank
Definition: domain_decomposition.hpp:17
DistributionPlan mpi_distribution_plan(int nv) const
Kokkos::View< int *, Kokkos::LayoutRight, HostType > gvid0_pid_h
Which processors get which vertices (host)
Definition: domain_decomposition.hpp:92