Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1680528630eeb219b7a7c3bceae51d7de399b3e2
[simgrid.git] / src / smpi / smpi_win.hpp
1 /* Copyright (c) 2010, 2013-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_WIN_HPP_INCLUDED
8 #define SMPI_WIN_HPP_INCLUDED
9
10 #include "private.h"
11 #include <vector>
12 #include <list>
13
14 namespace simgrid{
15 namespace smpi{
16
17 class Win : public F2C, public Keyval {
18   private :
19   void* base_;
20   MPI_Aint size_;
21   int disp_unit_;
22   int assert_;
23   MPI_Info info_;
24   MPI_Comm comm_;
25   std::vector<MPI_Request> *requests_;
26   xbt_mutex_t mut_;
27   msg_bar_t bar_;
28   MPI_Win* connected_wins_;
29   char* name_;
30   int opened_;
31   MPI_Group group_;
32   int count_; //for ordering the accs
33   xbt_mutex_t lock_mut_;
34   std::list<int> lockers_;
35   int rank_; // to identify owner for barriers in MPI_COMM_WORLD
36   int mode_; // exclusive or shared lock
37
38 public:
39   static std::unordered_map<int, smpi_key_elem> keyvals_;
40   static int keyval_id_;
41
42   Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm);
43   ~Win();
44   void get_name( char* name, int* length);
45   void get_group( MPI_Group* group);
46   void set_name( char* name);
47   int rank();
48   int start(MPI_Group group, int assert);
49   int post(MPI_Group group, int assert);
50   int complete();
51   int wait();
52   MPI_Aint size();
53   void* base();
54   int disp_unit();
55   int fence(int assert);
56   int put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
57               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype);
58   int get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
59               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype);
60   int accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
61               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op);
62   int get_accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr, 
63               int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count, 
64               MPI_Datatype target_datatype, MPI_Op op);
65   static Win* f2c(int id);
66   int lock(int lock_type, int rank, int assert);
67   int unlock(int rank);
68   int finish_comms();
69 };
70
71
72 }
73 }
74
75 #endif