Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e8773ecd4c69437c22bdcfb16297cf26b7081c44
[simgrid.git] / src / smpi / smpi_comm.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_COMM_HPP_INCLUDED
8 #define SMPI_COMM_HPP_INCLUDED
9
10 #include "private.h"
11
12 namespace simgrid{
13 namespace SMPI{
14
15 class Comm {
16
17   private:
18     MPI_Group m_group;
19     MPIR_Topo_type m_topoType; 
20     MPI_Topology m_topo; // to be replaced by an union
21     int m_refcount;
22     MPI_Comm m_leaders_comm;//inter-node communicator
23     MPI_Comm m_intra_comm;//intra-node communicator . For MPI_COMM_WORLD this can't be used, as var is global.
24     //use an intracomm stored in the process data instead
25     int* m_leaders_map; //who is the leader of each process
26     int m_is_uniform;
27     int* m_non_uniform_map; //set if smp nodes have a different number of processes allocated
28     int m_is_blocked;// are ranks allocated on the same smp node contiguous ?
29     xbt_dict_t m_attributes;
30
31   public:
32     Comm();
33     Comm(MPI_Group group, MPI_Topology topo);
34
35     void destroy();
36     int dup(MPI_Comm* newcomm);
37     MPI_Group group();
38     MPI_Topology topo();
39     int size();
40     int rank();
41     void get_name (char* name, int* len);
42     void set_leaders_comm(MPI_Comm leaders);
43     void set_intra_comm(MPI_Comm leaders);
44     int* get_non_uniform_map();
45     int* get_leaders_map();
46     MPI_Comm get_leaders_comm();
47     MPI_Comm get_intra_comm();
48     int is_uniform();
49     int is_blocked();
50     MPI_Comm split(int color, int key);
51     void use();
52     void cleanup_attributes();
53     void cleanup_smp();
54     void unuse();
55     void init_smp();
56     int attr_delete(int keyval);
57     int attr_get(int keyval, void* attr_value, int* flag);
58     int attr_put(int keyval, void* attr_value);
59
60 };
61
62 }
63 }
64
65
66 #endif