X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d53d00d608a60a6f05e77ea7b7cd5c4e544d7ab1..004b932fe967a47a2ded3795af9dc069c3de9671:/src/smpi/colls/bcast-SMP-linear.cpp diff --git a/src/smpi/colls/bcast-SMP-linear.cpp b/src/smpi/colls/bcast-SMP-linear.cpp index b3f9b6a630..70390f62d0 100644 --- a/src/smpi/colls/bcast-SMP-linear.cpp +++ b/src/smpi/colls/bcast-SMP-linear.cpp @@ -22,14 +22,14 @@ int smpi_coll_tuned_bcast_SMP_linear(void *buf, int count, MPI_Aint extent; extent = smpi_datatype_get_extent(datatype); - rank = smpi_comm_rank(comm); - size = smpi_comm_size(comm); - if(smpi_comm_get_leaders_comm(comm)==MPI_COMM_NULL){ - smpi_comm_init_smp(comm); + rank = comm->rank(); + size = comm->size(); + if(comm->get_leaders_comm()==MPI_COMM_NULL){ + comm->init_smp(); } int num_core=1; - if (smpi_comm_is_uniform(comm)){ - num_core = smpi_comm_size(smpi_comm_get_intra_comm(comm)); + if (comm->is_uniform()){ + num_core = comm->get_intra_comm()->size(); }else{ //implementation buggy in this case return smpi_coll_tuned_bcast_mpich( buf , count, datatype, @@ -59,40 +59,40 @@ int smpi_coll_tuned_bcast_SMP_linear(void *buf, int count, // if root is not zero send to rank zero first if (root != 0) { if (rank == root) - smpi_mpi_send(buf, count, datatype, 0, tag, comm); + Request::send(buf, count, datatype, 0, tag, comm); else if (rank == 0) - smpi_mpi_recv(buf, count, datatype, root, tag, comm, &status); + Request::recv(buf, count, datatype, root, tag, comm, &status); } // when a message is smaller than a block size => no pipeline if (count <= segment) { // case ROOT if (rank == 0) { - smpi_mpi_send(buf, count, datatype, to_inter, tag, comm); - smpi_mpi_send(buf, count, datatype, to_intra, tag, comm); + Request::send(buf, count, datatype, to_inter, tag, comm); + Request::send(buf, count, datatype, to_intra, tag, comm); } // case last ROOT of each SMP else if (rank == (((size - 1) / num_core) * num_core)) { - request = smpi_mpi_irecv(buf, count, datatype, from_inter, tag, comm); - smpi_mpi_wait(&request, &status); - smpi_mpi_send(buf, count, datatype, to_intra, tag, comm); + request = Request::irecv(buf, count, datatype, from_inter, tag, comm); + Request::wait(&request, &status); + Request::send(buf, count, datatype, to_intra, tag, comm); } // case intermediate ROOT of each SMP else if (rank % num_core == 0) { - request = smpi_mpi_irecv(buf, count, datatype, from_inter, tag, comm); - smpi_mpi_wait(&request, &status); - smpi_mpi_send(buf, count, datatype, to_inter, tag, comm); - smpi_mpi_send(buf, count, datatype, to_intra, tag, comm); + request = Request::irecv(buf, count, datatype, from_inter, tag, comm); + Request::wait(&request, &status); + Request::send(buf, count, datatype, to_inter, tag, comm); + Request::send(buf, count, datatype, to_intra, tag, comm); } // case last non-ROOT of each SMP else if (((rank + 1) % num_core == 0) || (rank == (size - 1))) { - request = smpi_mpi_irecv(buf, count, datatype, from_intra, tag, comm); - smpi_mpi_wait(&request, &status); + request = Request::irecv(buf, count, datatype, from_intra, tag, comm); + Request::wait(&request, &status); } // case intermediate non-ROOT of each SMP else { - request = smpi_mpi_irecv(buf, count, datatype, from_intra, tag, comm); - smpi_mpi_wait(&request, &status); - smpi_mpi_send(buf, count, datatype, to_intra, tag, comm); + request = Request::irecv(buf, count, datatype, from_intra, tag, comm); + Request::wait(&request, &status); + Request::send(buf, count, datatype, to_intra, tag, comm); } return MPI_SUCCESS; } @@ -108,57 +108,57 @@ int smpi_coll_tuned_bcast_SMP_linear(void *buf, int count, // case real root if (rank == 0) { for (i = 0; i < pipe_length; i++) { - smpi_mpi_send((char *) buf + (i * increment), segment, datatype, to_inter, + Request::send((char *) buf + (i * increment), segment, datatype, to_inter, (tag + i), comm); - smpi_mpi_send((char *) buf + (i * increment), segment, datatype, to_intra, + Request::send((char *) buf + (i * increment), segment, datatype, to_intra, (tag + i), comm); } } // case last ROOT of each SMP else if (rank == (((size - 1) / num_core) * num_core)) { for (i = 0; i < pipe_length; i++) { - request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype, + request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype, from_inter, (tag + i), comm); } for (i = 0; i < pipe_length; i++) { - smpi_mpi_wait(&request_array[i], &status); - smpi_mpi_send((char *) buf + (i * increment), segment, datatype, to_intra, + Request::wait(&request_array[i], &status); + Request::send((char *) buf + (i * increment), segment, datatype, to_intra, (tag + i), comm); } } // case intermediate ROOT of each SMP else { for (i = 0; i < pipe_length; i++) { - request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype, + request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype, from_inter, (tag + i), comm); } for (i = 0; i < pipe_length; i++) { - smpi_mpi_wait(&request_array[i], &status); - smpi_mpi_send((char *) buf + (i * increment), segment, datatype, to_inter, + Request::wait(&request_array[i], &status); + Request::send((char *) buf + (i * increment), segment, datatype, to_inter, (tag + i), comm); - smpi_mpi_send((char *) buf + (i * increment), segment, datatype, to_intra, + Request::send((char *) buf + (i * increment), segment, datatype, to_intra, (tag + i), comm); } } } else { // case last non-ROOT of each SMP if (((rank + 1) % num_core == 0) || (rank == (size - 1))) { for (i = 0; i < pipe_length; i++) { - request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype, + request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype, from_intra, (tag + i), comm); } for (i = 0; i < pipe_length; i++) { - smpi_mpi_wait(&request_array[i], &status); + Request::wait(&request_array[i], &status); } } // case intermediate non-ROOT of each SMP else { for (i = 0; i < pipe_length; i++) { - request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype, + request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype, from_intra, (tag + i), comm); } for (i = 0; i < pipe_length; i++) { - smpi_mpi_wait(&request_array[i], &status); - smpi_mpi_send((char *) buf + (i * increment), segment, datatype, to_intra, + Request::wait(&request_array[i], &status); + Request::send((char *) buf + (i * increment), segment, datatype, to_intra, (tag + i), comm); } }