X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dc1466c0fbb38cdbe51b35767cf6e7adce81597d..46b56a2fa00e6db1409f4c07c50b50ab726950ed:/src/smpi/smpi_topo.hpp diff --git a/src/smpi/smpi_topo.hpp b/src/smpi/smpi_topo.hpp index ab16147fde..f4ce792510 100644 --- a/src/smpi/smpi_topo.hpp +++ b/src/smpi/smpi_topo.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2015. The SimGrid Team. +/* Copyright (c) 2010-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,66 +9,72 @@ #include "private.h" +typedef enum MPIR_Topo_type { + MPI_GRAPH=1, + MPI_CART=2, + MPI_DIST_GRAPH=3, + MPI_INVALID_TOPO=-1 +} MPIR_Topo_type; + +typedef SMPI_Topology *MPI_Topology; namespace simgrid{ namespace smpi{ class Topo { + public: + virtual ~Topo()=default; protected: - MPI_Comm m_comm; + MPI_Comm comm_; }; -class Cart: public Topo { +class Topo_Cart: public Topo { private: - int m_nnodes; - int m_ndims; - int *m_dims; - int *m_periodic; - int *m_position; + int nnodes_ = 0; + int ndims_; + int *dims_; + int *periodic_; + int *position_; public: - Cart(int ndims); - ~Cart(); - Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart); - Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ; + Topo_Cart(int ndims); + ~Topo_Cart(); + Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart); + Topo_Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ; int coords(int rank, int maxdims, int coords[]) ; int get(int maxdims, int* dims, int* periods, int* coords); int rank(int* coords, int* rank); int shift(int direction, int disp, int *rank_source, int *rank_dest) ; int dim_get(int *ndims); + static int Dims_create(int nnodes, int ndims, int dims[]); }; -class Graph: public Topo { +class Topo_Graph: public Topo { private: - int m_nnodes; - int m_nedges; - int *m_index; - int *m_edges; + int nnodes_; + int nedges_; + int *index_; + int *edges_; public: - Graph(); - ~Graph(); + Topo_Graph(); + ~Topo_Graph(); }; -class Dist_Graph: public Topo { +class Topo_Dist_Graph: public Topo { private: - int m_indegree; - int *m_in; - int *m_in_weights; - int m_outdegree; - int *m_out; - int *m_out_weights; - int m_is_weighted; + int indegree_; + int *in_; + int *in_weights_; + int outdegree_; + int *out_; + int *out_weights_; + int is_weighted_; public: - Dist_Graph(); - ~Dist_Graph(); + Topo_Dist_Graph(); + ~Topo_Dist_Graph(); }; -/* - * This is a utility function, no need to have anything in the lower layer for this at all - */ -extern int Dims_create(int nnodes, int ndims, int dims[]); - } }