source: XIOS/dev/branch_openmp/extern/remap/src/mpi_cascade.hpp @ 1538

Last change on this file since 1538 was 1538, checked in by yushan, 3 years ago

tests in XIOS OK (client, complete, remap, toy)

File size: 967 bytes
Line 
1#ifndef  __MPI_CASCADE_HPP__
2#define  __MPI_CASCADE_HPP__
3
4#include "mpi.hpp"
5#include <vector>
6#include <cassert>
7#include "misc.hpp"
8
9namespace sphereRemap {
10
11class CCascadeLevel
12{
13public:
14  CCascadeLevel(ep_lib::MPI_Comm comm) : comm(comm)
15  {
16    ep_lib::MPI_Comm_size(comm, &size);
17    ep_lib::MPI_Comm_rank(comm, &rank);
18  }
19  int colour() const { return rank % group_size; };
20  int key() const { return p_colour() + rank/(p_grp_size*group_size)*p_grp_size; }
21
22  // perpendicular group
23  int p_colour() const { return (rank%group_size + rank/group_size) % p_grp_size; }
24  int p_key() const { return colour() + rank/(p_grp_size*group_size)*group_size; }
25
26  ep_lib::MPI_Comm comm, pg_comm;
27  int rank;
28  int size;
29  int group_size; // group_size and p_grp_size are interchanged?? FIXME
30  int p_grp_size;
31};
32
33class CMPICascade
34{
35public:
36  CMPICascade(int nodes_per_level, ep_lib::MPI_Comm comm);
37
38  int num_levels;
39  std::vector<CCascadeLevel> level;
40};
41
42}
43#endif
Note: See TracBrowser for help on using the repository browser.