/* smpi_mpi_dt.c -- MPI primitives to handle datatypes */
/* FIXME: a very incomplete implementation */
-/* Copyright (c) 2009-2014. The SimGrid Team.
+/* Copyright (c) 2009-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
NULL, /* pointer on extended struct*/ \
0 /* in_use counter */ \
}; \
-MPI_Datatype name = &mpi_##name;
+const MPI_Datatype name = &mpi_##name;
#define CREATE_MPI_DATATYPE_NULL(name) \
static s_smpi_mpi_datatype_t mpi_##name = { \
NULL, /* pointer on extended struct*/ \
0 /* in_use counter */ \
}; \
-MPI_Datatype name = &mpi_##name;
+const MPI_Datatype name = &mpi_##name;
//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
typedef struct {
memcpy((*new_t)->substruct, datatype->substruct, sizeof(s_smpi_mpi_struct_t));
}
if(datatype->name)
- (*new_t)->name = strdup(datatype->name);
+ (*new_t)->name = xbt_strdup(datatype->name);
if(datatype->attributes !=NULL){
(*new_t)->attributes=xbt_dict_new();
xbt_dict_cursor_t cursor = NULL;
}
void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
- datatype->name = strdup(name);;
+ datatype->name = xbt_strdup(name);;
}
int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
}
void smpi_datatype_free(MPI_Datatype* type){
+ xbt_assert((*type)->in_use >= 0);
if((*type)->attributes !=NULL){
xbt_dict_cursor_t cursor = NULL;
int* key;
*position += outcount * size;
return MPI_SUCCESS;
}
-