Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
yet another attempt to handle MPI special values in fortran
[simgrid.git] / src / smpi / include / smpi_topo.hpp
1 /* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SMPI_TOPO_HPP_INCLUDED
7 #define SMPI_TOPO_HPP_INCLUDED
8
9 #include "smpi_comm.hpp"
10 #include "smpi_status.hpp"
11
12 typedef SMPI_Topology *MPI_Topology;
13
14 namespace simgrid{
15 namespace smpi{
16
17 class Topo {
18   MPI_Comm comm_;
19
20 public:
21   virtual ~Topo() = default;
22   MPI_Comm getComm() const { return comm_; }
23   void setComm(MPI_Comm comm) { comm_ = comm; }
24 };
25
26 class Topo_Cart: public Topo {
27   int nnodes_ = 0;
28   int ndims_;
29   int* dims_;
30   int* periodic_;
31   int* position_;
32
33 public:
34   explicit Topo_Cart(int ndims);
35   Topo_Cart(const Topo_Cart&) = delete;
36   Topo_Cart& operator=(const Topo_Cart&) = delete;
37   ~Topo_Cart();
38   Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm* comm_cart);
39   Topo_Cart* sub(const int remain_dims[], MPI_Comm* newcomm);
40   int coords(int rank, int maxdims, int coords[]);
41   int get(int maxdims, int* dims, int* periods, int* coords);
42   int rank(int* coords, int* rank);
43   int shift(int direction, int disp, int* rank_source, int* rank_dest);
44   int dim_get(int* ndims);
45   static int Dims_create(int nnodes, int ndims, int dims[]);
46 };
47
48
49 class Topo_Graph: public Topo {
50   int nnodes_;
51   int* index_;
52   int* edges_;
53
54 public:
55   Topo_Graph();
56   Topo_Graph(const Topo_Graph&) = delete;
57   Topo_Graph& operator=(const Topo_Graph&) = delete;
58   ~Topo_Graph();
59 };
60
61 class Topo_Dist_Graph: public Topo {
62   int* in_;
63   int* in_weights_;
64   int* out_;
65   int* out_weights_;
66
67 public:
68   Topo_Dist_Graph();
69   Topo_Dist_Graph(const Topo_Dist_Graph&) = delete;
70   Topo_Dist_Graph& operator=(const Topo_Dist_Graph&) = delete;
71   ~Topo_Dist_Graph();
72 };
73
74 }
75 }
76
77
78 #endif