Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove spurious ;
[simgrid.git] / src / smpi / smpi_win.hpp
1 /* Copyright (c) 2010, 2013-2017. 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 "src/smpi/smpi_keyvals.hpp"
11 #include "xbt/synchro.h"
12
13 #include <vector>
14 #include <list>
15
16 namespace simgrid{
17 namespace smpi{
18
19 class Win : public F2C, public Keyval {
20   private :
21   void* base_;
22   MPI_Aint size_;
23   int disp_unit_;
24   int assert_;
25   MPI_Info info_;
26   MPI_Comm comm_;
27   std::vector<MPI_Request> *requests_;
28   xbt_mutex_t mut_;
29   msg_bar_t bar_;
30   MPI_Win* connected_wins_;
31   char* name_;
32   int opened_;
33   MPI_Group group_;
34   int count_; //for ordering the accs
35   xbt_mutex_t lock_mut_;
36   xbt_mutex_t atomic_mut_;
37   std::list<int> lockers_;
38   int rank_; // to identify owner for barriers in MPI_COMM_WORLD
39   int mode_; // exclusive or shared lock
40   int allocated_;
41   int dynamic_;
42
43 public:
44   static std::unordered_map<int, smpi_key_elem> keyvals_;
45   static int keyval_id_;
46
47   Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated = 0, int dynamic = 0);
48   Win(MPI_Info info, MPI_Comm comm) : Win(MPI_BOTTOM, 0, 1, info, comm, 0, 1) {};
49   ~Win();
50   int attach (void *base, MPI_Aint size);
51   int detach (void *base);
52   void get_name( char* name, int* length);
53   void get_group( MPI_Group* group);
54   void set_name( char* name);
55   int rank();
56   int dynamic();
57   int start(MPI_Group group, int assert);
58   int post(MPI_Group group, int assert);
59   int complete();
60   MPI_Info info();
61   void set_info( MPI_Info info);
62   int wait();
63   MPI_Aint size();
64   void* base();
65   int disp_unit();
66   int fence(int assert);
67   int put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
68               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Request* request=nullptr);
69   int get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
70               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Request* request=nullptr);
71   int accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
72               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Request* request=nullptr);
73   int get_accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
74               int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
75               MPI_Datatype target_datatype, MPI_Op op, MPI_Request* request=nullptr);
76   int compare_and_swap(void *origin_addr, void *compare_addr,
77         void *result_addr, MPI_Datatype datatype, int target_rank,
78         MPI_Aint target_disp);
79   static Win* f2c(int id);
80
81   int lock(int lock_type, int rank, int assert);
82   int unlock(int rank);
83   int lock_all(int assert);
84   int unlock_all();
85   int flush(int rank);
86   int flush_local(int rank);
87   int flush_all();
88   int flush_local_all();
89   int finish_comms();
90   int finish_comms(int rank);
91 };
92
93
94 }
95 }
96
97 #endif