Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / smpi / include / smpi_datatype.hpp
index 19ad3ab..8e99738 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -82,18 +82,18 @@ struct integer128_t {
   int64_t index;
 };
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid::smpi {
 class Datatype_contents {
   public:
   int combiner_;
   std::vector<int> integers_;
   std::vector<MPI_Aint> addresses_;
   std::vector<MPI_Datatype> datatypes_;
-  Datatype_contents(int combiner, 
-                    int number_of_integers, const int* integers, 
-                    int number_of_addresses, const MPI_Aint* addresses, 
-                    int number_of_datatypes, const MPI_Datatype* datatypes);
+  Datatype_contents(int combiner, int number_of_integers, const int* integers, int number_of_addresses,
+                    const MPI_Aint* addresses, int number_of_datatypes, const MPI_Datatype* datatypes);
+  Datatype_contents(const Datatype_contents&) = delete;
+  Datatype_contents& operator=(const Datatype_contents&) = delete;
+  ~Datatype_contents();
 };
 
 class Datatype : public F2C, public Keyval{
@@ -109,6 +109,7 @@ class Datatype : public F2C, public Keyval{
   int flags_;
   int refcount_ = 1;
   std::unique_ptr<Datatype_contents> contents_ = nullptr;
+  MPI_Datatype duplicated_datatype_ = MPI_DATATYPE_NULL;
 
 protected:
   template <typename... Args> void set_contents(Args&&... args)
@@ -127,12 +128,13 @@ public:
   Datatype(const Datatype&) = delete;
   Datatype& operator=(const Datatype&) = delete;
   ~Datatype() override;
-  std::string name() const {return name_.empty() ? std::string("MPI_Datatype") : name_;}
+  std::string name() const override { return name_.empty() ? "MPI_Datatype" : name_; }
   size_t size() const { return size_; }
   MPI_Aint lb() const { return lb_; }
   MPI_Aint ub() const { return ub_; }
   int flags() const { return flags_; }
   int refcount() const { return refcount_; }
+  MPI_Datatype duplicated_datatype() const { return duplicated_datatype_; }
 
   void ref();
   static void unref(MPI_Datatype datatype);
@@ -142,7 +144,6 @@ public:
   bool is_basic() const;
   static const char* encode(const Datatype* dt) { return dt->id.c_str(); }
   static MPI_Datatype decode(const std::string& datatype_id);
-  bool is_replayable() const;
   void addflag(int flag);
   int extent(MPI_Aint* lb, MPI_Aint* extent) const;
   MPI_Aint get_extent() const { return ub_ - lb_; };
@@ -153,9 +154,6 @@ public:
   virtual int clone(MPI_Datatype* type);
   virtual void serialize(const void* noncontiguous, void* contiguous, int count);
   virtual void unserialize(const void* contiguous, void* noncontiguous, int count, MPI_Op op);
-  static int keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
-                           void* extra_state);
-  static int keyval_free(int* keyval);
   int pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, const Comm* comm);
   int unpack(const void* inbuf, int insize, int* position, void* outbuf, int outcount, const Comm* comm);
   int get_contents(int max_integers, int max_addresses, int max_datatypes, int* array_of_integers,
@@ -177,7 +175,6 @@ public:
   static Datatype* f2c(int id);
 };
 
-}
-}
+} // namespace simgrid::smpi
 
 #endif