From: Augustin Degomme Date: Fri, 3 Oct 2014 20:43:49 +0000 (+0200) Subject: activate some more tests X-Git-Tag: v3_12~773 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e08b50479b9a8dc340b8bf143b38d48ac07a1fb7 activate some more tests --- diff --git a/src/smpi/private.h b/src/smpi/private.h index 3757eade3a..d6b87e070d 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -256,7 +256,7 @@ int smpi_comm_size(MPI_Comm comm); void smpi_comm_get_name(MPI_Comm comm, char* name, int* len); int smpi_comm_rank(MPI_Comm comm); MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key); -MPI_Comm smpi_comm_dup(MPI_Comm comm); +int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm); void smpi_comm_use(MPI_Comm comm); void smpi_comm_unuse(MPI_Comm comm); void smpi_comm_set_leaders_comm(MPI_Comm comm, MPI_Comm leaders); diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 8398a13f0d..30bb6ab31d 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -1624,8 +1624,10 @@ int smpi_attr_delete(MPI_Comm comm, int keyval){ if(elem->delete_fn!=MPI_NULL_DELETE_FN){ void * value; int flag; - if(smpi_attr_get(comm, keyval, &value, &flag)==MPI_SUCCESS) - elem->delete_fn(comm, keyval, &value, &flag); + if(smpi_attr_get(comm, keyval, &value, &flag)==MPI_SUCCESS){ + int ret = elem->delete_fn(comm, keyval, &value, &flag); + if(ret!=MPI_SUCCESS) return ret; + } } return smpi_comm_attr_delete(comm, keyval);; } @@ -1645,6 +1647,13 @@ int smpi_attr_put(MPI_Comm comm, int keyval, void* attr_value){ smpi_key_elem elem = xbt_dict_get_or_null(smpi_keyvals, (const char*)&keyval); if(!elem ) return MPI_ERR_ARG; + int flag; + void* value; + smpi_attr_get(comm, keyval, &value, &flag); + if(flag){ + int ret = elem->delete_fn(comm, keyval, &value, &flag); + if(ret!=MPI_SUCCESS) return ret; + } return smpi_comm_attr_put(comm, keyval, attr_value);; } diff --git a/src/smpi/smpi_comm.c b/src/smpi/smpi_comm.c index 7ed1a3253c..ee2a7c32dc 100644 --- a/src/smpi/smpi_comm.c +++ b/src/smpi/smpi_comm.c @@ -89,14 +89,33 @@ void smpi_comm_destroy(MPI_Comm comm) smpi_comm_unuse(comm); } -MPI_Comm smpi_comm_dup(MPI_Comm comm){ +int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){ if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables smpi_switch_data_segment(smpi_process_index()); } - MPI_Comm newcomm = smpi_comm_new(smpi_comm_group(comm), smpi_comm_topo(comm)); - + (*newcomm) = smpi_comm_new(smpi_comm_group(comm), smpi_comm_topo(comm)); + int ret = MPI_SUCCESS; + //todo: faire en sorte que ça fonctionne avec un communicator dupliqué (refaire un init_smp ?) + + /* MPI_Comm tmp=smpi_comm_get_intra_comm(comm); + if( tmp != MPI_COMM_NULL) + smpi_comm_set_intra_comm((*newcomm), smpi_comm_dup(tmp)); + tmp=smpi_comm_get_leaders_comm(comm); + if( tmp != MPI_COMM_NULL) + smpi_comm_set_leaders_comm((*newcomm), smpi_comm_dup(tmp)); + if(comm->non_uniform_map !=NULL){ + (*newcomm)->non_uniform_map= + xbt_malloc(smpi_comm_size(comm->leaders_comm)*sizeof(int)); + memcpy((*newcomm)->non_uniform_map, + comm->non_uniform_map,smpi_comm_size(comm->leaders_comm)*sizeof(int) ); + } + if(comm->leaders_map !=NULL){ + (*newcomm)->leaders_map=xbt_malloc(smpi_comm_size(comm)*sizeof(int)); + memcpy((*newcomm)->leaders_map, + comm->leaders_map,smpi_comm_size(comm)*sizeof(int) ); + }*/ if(comm->attributes !=NULL){ - newcomm->attributes=xbt_dict_new(); + (*newcomm)->attributes=xbt_dict_new(); xbt_dict_cursor_t cursor = NULL; int *key; int flag; @@ -105,13 +124,18 @@ MPI_Comm smpi_comm_dup(MPI_Comm comm){ xbt_dict_foreach(comm->attributes, cursor, key, value_in){ smpi_key_elem elem = xbt_dict_get_or_null(smpi_keyvals, (const char*)key); if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){ - elem->copy_fn(comm, *key, NULL, value_in, &value_out, &flag ); + ret = elem->copy_fn(comm, *key, NULL, value_in, &value_out, &flag ); + if(ret!=MPI_SUCCESS){ + smpi_comm_destroy(*newcomm); + *newcomm=MPI_COMM_NULL; + return ret; + } if(flag) - xbt_dict_set(newcomm->attributes, (const char*)key,value_out, NULL); + xbt_dict_set((*newcomm)->attributes, (const char*)key,value_out, NULL); } } } - return newcomm; + return ret; } @@ -307,11 +331,11 @@ void smpi_comm_unuse(MPI_Comm comm){ if(comm->attributes !=NULL){ xbt_dict_cursor_t cursor = NULL; int* key; - smpi_key_elem elem; void * value; int flag; - xbt_dict_foreach(comm->attributes, cursor, key, elem){ - if(smpi_attr_get(comm, *key, &value, &flag)==MPI_SUCCESS) + xbt_dict_foreach(comm->attributes, cursor, key, value){ + smpi_key_elem elem = xbt_dict_get_or_null(smpi_keyvals, (const char*)key); + if(elem) elem->delete_fn(comm, *key, &value, &flag); } } diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index dac9d03373..2c7ec2c77c 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -773,8 +773,7 @@ int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm) } else if (newcomm == NULL) { retval = MPI_ERR_ARG; } else { - *newcomm = smpi_comm_dup(comm); - retval = MPI_SUCCESS; + retval = smpi_comm_dup(comm, newcomm); } return retval; } @@ -2985,7 +2984,7 @@ int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) { //FIXME : not ideal and leaky, but should not be called too much int* res = xbt_new(int, 1); *res=keyval; - attr_value=(void*)res; + *(int**)attr_value=res; return MPI_SUCCESS; } else return smpi_attr_get(comm, keyval, attr_value, flag); diff --git a/teshsuite/smpi/mpich3-test/attr/testlist b/teshsuite/smpi/mpich3-test/attr/testlist index 7a71bcd03a..480ea27996 100644 --- a/teshsuite/smpi/mpich3-test/attr/testlist +++ b/teshsuite/smpi/mpich3-test/attr/testlist @@ -1,8 +1,7 @@ attrt 2 #needs MPI_Intercomm_create #attric 4 -#TODO -#attrerr 1 +attrerr 1 # The MPI-2 specification makes it clear that delect attributes are # called on MPI_COMM_WORLD and MPI_COMM_SELF at the very beginning of # MPI_Finalize. This is useful for tools that want to perform the MPI @@ -23,12 +22,10 @@ attrorder 1 #attrordercomm 1 #needs MPI_Type_create_keyval, MPI_Type_delete_keyval, MPI_Type_set_attr, MPI_Type_delete_attr #attrordertype 1 -#TODO -#baseattr2 1 +baseattr2 1 #needs MPI_Comm_get_attr #baseattrcomm 1 #MPI_Keyval_create, MPI_Keyval_free for type and comm also -#TODO #fkeyval 1 #fkeyvalcomm 1 #fkeyvaltype 1