Logo AND Algorithmique Numérique Distribuée

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