X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f3b7e5f4b4d7c87ee3e8827313ec966ea8fc8387..4c753f8d4cabd4104f3f7109823f16be2ebdcce3:/src/smpi/include/smpi_win.hpp diff --git a/src/smpi/include/smpi_win.hpp b/src/smpi/include/smpi_win.hpp index cb84e72828..6bcab2d3c2 100644 --- a/src/smpi/include/smpi_win.hpp +++ b/src/smpi/include/smpi_win.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2020. The SimGrid Team. +/* Copyright (c) 2010-2022. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -11,12 +11,12 @@ #include "smpi_errhandler.hpp" #include "smpi_f2c.hpp" #include "smpi_keyvals.hpp" +#include "smpi_config.hpp" #include #include -namespace simgrid{ -namespace smpi{ +namespace simgrid::smpi { class Win : public F2C, public Keyval { void* base_; @@ -25,39 +25,43 @@ class Win : public F2C, public Keyval { int assert_ = 0; MPI_Info info_; MPI_Comm comm_; - std::vector *requests_; - s4u::MutexPtr mut_; - s4u::Barrier* bar_; - MPI_Win* connected_wins_; - char* name_; - int opened_; - MPI_Group group_; - int count_; //for ordering the accs - s4u::MutexPtr lock_mut_; - s4u::MutexPtr atomic_mut_; + std::vector requests_; + s4u::MutexPtr mut_ = s4u::Mutex::create(); + s4u::BarrierPtr bar_; + std::vector connected_wins_; + std::string name_; + int opened_ = 0; + MPI_Group src_group_ = MPI_GROUP_NULL; // for post/wait + MPI_Group dst_group_ = MPI_GROUP_NULL; // for start/complete + int count_ = 0; // for ordering the accs + s4u::MutexPtr lock_mut_ = s4u::Mutex::create(); + s4u::MutexPtr atomic_mut_ = s4u::Mutex::create(); std::list lockers_; int rank_; // to identify owner for barriers in MPI_COMM_WORLD - int mode_; // exclusive or shared lock - int allocated_; - int dynamic_; - MPI_Errhandler errhandler_; + int mode_ = 0; // exclusive or shared lock + bool allocated_; + bool dynamic_; + MPI_Errhandler errhandler_ = _smpi_cfg_default_errhandler_is_error ? MPI_ERRORS_ARE_FATAL : MPI_ERRORS_RETURN; public: static std::unordered_map keyvals_; static int keyval_id_; - Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated = 0, int dynamic = 0); - Win(MPI_Info info, MPI_Comm comm) : Win(MPI_BOTTOM, 0, 1, info, comm, 0, 1) {}; + Win(void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, bool allocated = false, + bool dynamic = false); + Win(MPI_Info info, MPI_Comm comm) : Win(MPI_BOTTOM, 0, 1, info, comm, false, true){}; Win(const Win&) = delete; Win& operator=(const Win&) = delete; - ~Win() override; + static int del(Win* win); int attach (void *base, MPI_Aint size); int detach (const void *base); void get_name(char* name, int* length) const; + std::string name() const override { return name_.empty() ? "MPI_Win" : name_; } void get_group( MPI_Group* group); void set_name(const char* name); int rank() const; - int dynamic() const; + MPI_Comm comm() const; + bool dynamic() const; int start(MPI_Group group, int assert); int post(MPI_Group group, int assert); int complete(); @@ -68,6 +72,7 @@ public: void* base() const; int disp_unit() const; int fence(int assert); + int opened() const {return opened_;} int put(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Request* request=nullptr); int get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, @@ -96,8 +101,6 @@ public: void set_errhandler( MPI_Errhandler errhandler); }; - -} -} +} // namespace simgrid::smpi #endif