Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
actuvate few more working rma tests
[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
13 namespace simgrid{
14 namespace smpi{
15
16 class Comm : public F2C, public Keyval{
17
18   private:
19     MPI_Group group_;
20     MPIR_Topo_type topoType_; 
21     MPI_Topology topo_; // to be replaced by an union
22     int refcount_;
23     MPI_Comm leaders_comm_;//inter-node communicator
24     MPI_Comm intra_comm_;//intra-node communicator . For MPI_COMM_WORLD this can't be used, as var is global.
25     //use an intracomm stored in the process data instead
26     int* leaders_map_; //who is the leader of each process
27     int is_uniform_;
28     int* non_uniform_map_; //set if smp nodes have a different number of processes allocated
29     int is_blocked_;// are ranks allocated on the same smp node contiguous ?
30
31   public:
32     static std::unordered_map<int, smpi_key_elem> keyvals_;
33     static int keyval_id_;
34
35     Comm() = default;
36     Comm(MPI_Group group, MPI_Topology topo);
37     int dup(MPI_Comm* newcomm);
38     MPI_Group group();
39     MPI_Topology topo();
40     int size();
41     int rank();
42     void get_name (char* name, int* len);
43     void set_leaders_comm(MPI_Comm leaders);
44     void set_intra_comm(MPI_Comm leaders);
45     int* get_non_uniform_map();
46     int* get_leaders_map();
47     MPI_Comm get_leaders_comm();
48     MPI_Comm get_intra_comm();
49     int is_uniform();
50     int is_blocked();
51     MPI_Comm split(int color, int key);
52     void cleanup_smp();
53     void ref();
54     static void unref(MPI_Comm comm);
55     static void destroy(MPI_Comm comm);
56     void init_smp();
57
58     int add_f();
59     static void free_f(int id);
60     static Comm* f2c(int);
61
62     static int keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state);
63     static int keyval_free(int* keyval);
64     static void keyval_cleanup();
65
66 };
67
68 }
69 }
70
71
72 #endif