#include <xbt/base.h>
#include "private.h"
+#include <unordered_map>
#define DT_FLAG_DESTROYED 0x0001 /**< user destroyed but some other layers still have a reference */
#define DT_FLAG_COMMITED 0x0002 /**< ready to be used for a send/recv operation */
extern const MPI_Datatype MPI_PTR;
+typedef struct s_smpi_mpi_type_key_elem {
+ MPI_Type_copy_attr_function* copy_fn;
+ MPI_Type_delete_attr_function* delete_fn;
+} s_smpi_mpi_type_key_elem_t;
+typedef struct s_smpi_mpi_type_key_elem *smpi_type_key_elem;
+
//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
typedef struct {
float value;
MPI_Aint ub_;
int flags_;
xbt_dict_t attributes_;
- int in_use_;
+ int refcount_;
+
+ static std::unordered_map<int, smpi_type_key_elem> keyvals_;
+ static int keyval_id_;
+
public:
static MPI_Datatype null_id_;
Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags);
Datatype(Datatype *datatype, int* ret);
virtual ~Datatype();
- void use();
- void unuse();
+ void ref();
+ static void unref(MPI_Datatype datatype);
void commit();
bool is_valid();
size_t size();