for(j = 0; j < count; j++) {
if(rankmap[2 * j] != 0) {
group_snd[reqs]=smpi_group_copy(group_out);
- requests[reqs] = smpi_isend_init(&(group_snd[reqs]), 1, MPI_PTR, rankmap[2 * j], system_tag, comm);
+ requests[reqs] = smpi_mpi_isend(&(group_snd[reqs]), 1, MPI_PTR, rankmap[2 * j], system_tag, comm);
reqs++;
}
}
- smpi_mpi_startall(reqs, requests);
+ if(i != 0) {
+ smpi_group_destroy(group_out);
+ }
smpi_mpi_waitall(reqs, requests, MPI_STATUS_IGNORE);
xbt_free(requests);
}
comm->refcount++;
}
-void smpi_comm_unuse(MPI_Comm comm){
- if (comm == MPI_COMM_UNINITIALIZED)
- comm = smpi_process_comm_world();
- comm->refcount--;
- smpi_group_unuse(comm->group);
- if(comm->refcount==0){
+void smpi_comm_cleanup_attributes(MPI_Comm comm){
+ if(comm->attributes !=NULL){
+ xbt_dict_cursor_t cursor = NULL;
+ int* key;
+ void * value;
+ int flag;
+ xbt_dict_foreach(comm->attributes, cursor, key, value){
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
+ if(elem && elem->delete_fn)
+ elem->delete_fn(comm, *key, value, &flag);
+ }
+ xbt_dict_free(&comm->attributes);
+ }
+}
+
+void smpi_comm_cleanup_smp(MPI_Comm comm){
if(comm->intra_comm != MPI_COMM_NULL)
smpi_comm_unuse(comm->intra_comm);
if(comm->leaders_comm != MPI_COMM_NULL)
xbt_free(comm->non_uniform_map);
if(comm->leaders_map !=NULL)
xbt_free(comm->leaders_map);
- if(comm->attributes !=NULL){
- xbt_dict_cursor_t cursor = NULL;
- int* key;
- void * value;
- int flag;
- xbt_dict_foreach(comm->attributes, cursor, key, value){
- smpi_comm_key_elem elem =
- static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
- if(elem && elem->delete_fn)
- elem->delete_fn(comm, *key, value, &flag);
- }
- }
+}
+
+void smpi_comm_unuse(MPI_Comm comm){
+ if (comm == MPI_COMM_UNINITIALIZED)
+ comm = smpi_process_comm_world();
+ comm->refcount--;
+ smpi_group_unuse(comm->group);
+
+ if(comm->refcount==0){
+ smpi_comm_cleanup_smp(comm);
+ smpi_comm_cleanup_attributes(comm);
xbt_free(comm);
}
}
}
//identify neighbours in comm
//get the indexes of all processes sharing the same simix host
- xbt_swag_t process_list = simcall_host_get_process_list(SIMIX_host_self());
+ xbt_swag_t process_list = SIMIX_host_self()->processes();
int intra_comm_size = 0;
//only one process/node, disable SMP support and return
// if(intra_comm_size==1){
for (i=0; i< leader_group_size;i++)
smpi_group_set_mapping(leaders_group, leader_list[i], i);
- leader_comm = smpi_comm_new(leaders_group, NULL);
- if(smpi_comm_get_leaders_comm(comm)==MPI_COMM_NULL)
+ if(smpi_comm_get_leaders_comm(comm)==MPI_COMM_NULL){
+ leader_comm = smpi_comm_new(leaders_group, NULL);
smpi_comm_set_leaders_comm(comm, leader_comm);
+ }else{
+ leader_comm=smpi_comm_get_leaders_comm(comm);
+ smpi_group_unuse(leaders_group);
+ }
smpi_process_set_comm_intra(comm_intra);
}