Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MPI_Topo -> c++
[simgrid.git] / src / smpi / smpi_topo.hpp
1 /* Copyright (c) 2010-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SMPI_TOPO_HPP_INCLUDED
8 #define SMPI_TOPO_HPP_INCLUDED
9
10 #include "private.h"
11
12
13 namespace simgrid{
14 namespace SMPI{
15
16 class Topo {
17   protected:
18   MPI_Comm m_comm;
19 };
20
21
22 class Cart: public Topo {
23   private:
24     int m_nnodes;
25     int m_ndims;
26     int *m_dims;
27     int *m_periodic;
28     int *m_position;
29   public:
30     Cart(int ndims);
31     ~Cart();
32     Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart);
33     Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ;
34     int coords(int rank, int maxdims, int coords[]) ;
35     int get(int maxdims, int* dims, int* periods, int* coords);
36     int rank(int* coords, int* rank);
37     int shift(int direction, int disp, int *rank_source, int *rank_dest) ;
38     int dim_get(int *ndims);
39 };
40
41
42 class Graph: public Topo {
43   private:
44     int m_nnodes;
45     int m_nedges;
46     int *m_index;
47     int *m_edges;
48   public:
49     Graph();
50     ~Graph();
51 };
52
53 class Dist_Graph: public Topo {
54   private:
55     int m_indegree;
56     int *m_in;
57     int *m_in_weights;
58     int m_outdegree;
59     int *m_out;
60     int *m_out_weights;
61     int m_is_weighted;
62   public:
63     Dist_Graph();
64     ~Dist_Graph();
65 };
66
67 /*
68  * This is a utility function, no need to have anything in the lower layer for this at all
69  */
70 extern int Dims_create(int nnodes, int ndims, int dims[]);
71
72 }
73 }
74
75
76 #endif