A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[SMPI] Only allocate memory for call-loc when cfg-option is given
[simgrid.git]
/
src
/
smpi
/
smpi_mpi_dt.cpp
diff --git
a/src/smpi/smpi_mpi_dt.cpp
b/src/smpi/smpi_mpi_dt.cpp
index
559db5e
..
6e6410f
100644
(file)
--- a/
src/smpi/smpi_mpi_dt.cpp
+++ b/
src/smpi/smpi_mpi_dt.cpp
@@
-201,6
+201,7
@@
int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t)
if(ret!=MPI_SUCCESS){
smpi_datatype_unuse(*new_t);
*new_t=MPI_DATATYPE_NULL;
if(ret!=MPI_SUCCESS){
smpi_datatype_unuse(*new_t);
*new_t=MPI_DATATYPE_NULL;
+ xbt_dict_cursor_free(&cursor);
return ret;
}
if(flag)
return ret;
}
if(flag)
@@
-236,6
+237,8
@@
void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length){
}
void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
}
void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
+ if(datatype->name!=NULL && !(datatype->flags & DT_FLAG_PREDEFINED))
+ xbt_free(datatype->name);
datatype->name = xbt_strdup(name);;
}
datatype->name = xbt_strdup(name);;
}
@@
-388,6
+391,15
@@
void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int s
void smpi_datatype_free(MPI_Datatype* type){
xbt_assert((*type)->in_use >= 0);
void smpi_datatype_free(MPI_Datatype* type){
xbt_assert((*type)->in_use >= 0);
+
+ if((*type)->flags & DT_FLAG_PREDEFINED)return;
+
+ //if still used, mark for deletion
+ if((*type)->in_use!=0){
+ (*type)->flags |=DT_FLAG_DESTROYED;
+ return;
+ }
+
if((*type)->attributes !=NULL){
xbt_dict_cursor_t cursor = NULL;
int* key;
if((*type)->attributes !=NULL){
xbt_dict_cursor_t cursor = NULL;
int* key;
@@
-399,23
+411,15
@@
void smpi_datatype_free(MPI_Datatype* type){
if(elem && elem->delete_fn)
elem->delete_fn(*type,*key, value, &flag);
}
if(elem && elem->delete_fn)
elem->delete_fn(*type,*key, value, &flag);
}
- }
-
- if((*type)->flags & DT_FLAG_PREDEFINED)return;
-
- //if still used, mark for deletion
- if((*type)->in_use!=0){
- (*type)->flags |=DT_FLAG_DESTROYED;
- return;
+ xbt_dict_free(&(*type)->attributes);
}
if ((*type)->sizeof_substruct != 0){
//((s_smpi_subtype_t *)(*type)->substruct)->subtype_free(type);
xbt_free((*type)->substruct);
}
}
if ((*type)->sizeof_substruct != 0){
//((s_smpi_subtype_t *)(*type)->substruct)->subtype_free(type);
xbt_free((*type)->substruct);
}
- if ((*type)->name != NULL){
- xbt_free((*type)->name);
- }
+ xbt_free((*type)->name);
+ xbt_free(*type);
*type = MPI_DATATYPE_NULL;
}
*type = MPI_DATATYPE_NULL;
}
@@
-441,11
+445,7
@@
void smpi_datatype_unuse(MPI_Datatype type){
}
if(type && type->in_use == 0){
}
if(type && type->in_use == 0){
- MPI_Datatype t = type;
- if (!(type->flags & DT_FLAG_DESTROYED))
- smpi_datatype_free(&type);
- if(t->flags & DT_FLAG_PREDEFINED) return;
- xbt_free(t);
+ smpi_datatype_free(&type);
}
#if HAVE_MC
if(MC_is_active())
}
#if HAVE_MC
if(MC_is_active())
@@
-500,6
+500,7
@@
void use_contiguous(MPI_Datatype* d){
* erived from s_smpi_subtype which required the functions unserialize and serialize */
s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count, MPI_Datatype old_type,
int size_oldtype){
* erived from s_smpi_subtype which required the functions unserialize and serialize */
s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count, MPI_Datatype old_type,
int size_oldtype){
+ if(block_count==0)return NULL;
s_smpi_mpi_contiguous_t *new_t= xbt_new(s_smpi_mpi_contiguous_t,1);
new_t->base.serialize = &serialize_contiguous;
new_t->base.unserialize = &unserialize_contiguous;
s_smpi_mpi_contiguous_t *new_t= xbt_new(s_smpi_mpi_contiguous_t,1);
new_t->base.serialize = &serialize_contiguous;
new_t->base.unserialize = &unserialize_contiguous;