X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a2f1b23687f04169144f4ffb4f20dc4fc5c28395..5c57bdf5bab7e95809ca651778a57fb6e5e17fef:/src/smpi/colls/bcast-arrival-nb.c diff --git a/src/smpi/colls/bcast-arrival-nb.c b/src/smpi/colls/bcast-arrival-nb.c index a4246c4656..be088ed973 100644 --- a/src/smpi/colls/bcast-arrival-nb.c +++ b/src/smpi/colls/bcast-arrival-nb.c @@ -1,4 +1,4 @@ -#include "colls.h" +#include "colls_private.h" static int bcast_NTSL_segment_size_in_byte = 8192; @@ -27,20 +27,20 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, int header_index; int flag_array[MAX_NODE]; int already_sent[MAX_NODE]; - + int to_clean[MAX_NODE]; int header_buf[HEADER_SIZE]; char temp_buf[MAX_NODE]; MPI_Aint extent; - MPI_Type_extent(datatype, &extent); + extent = smpi_datatype_get_extent(datatype); /* destination */ int to; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); + rank = smpi_comm_rank(MPI_COMM_WORLD); + size = smpi_comm_size(MPI_COMM_WORLD); /* segment is segment size in number of elements (not bytes) */ @@ -61,15 +61,16 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, */ if (root != 0) { if (rank == root) { - MPI_Send(buf, count, datatype, 0, tag, comm); + smpi_mpi_send(buf, count, datatype, 0, tag, comm); } else if (rank == 0) { - MPI_Recv(buf, count, datatype, root, tag, comm, &status); + smpi_mpi_recv(buf, count, datatype, root, tag, comm, &status); } } /* value == 0 means root has not send data (or header) to the node yet */ for (i = 0; i < MAX_NODE; i++) { already_sent[i] = 0; + to_clean[i]=0; } // printf("YYY\n"); @@ -83,7 +84,7 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, // for (j=0;j<1000;j++) { for (i = 1; i < size; i++) { if (already_sent[i] == 0) - MPI_Iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i], + smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i], MPI_STATUSES_IGNORE); } //} @@ -94,7 +95,7 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, /* message arrive */ if ((flag_array[i] == 1) && (already_sent[i] == 0)) { - MPI_Recv(temp_buf, 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status); + smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status); header_buf[header_index] = i; header_index++; sent_count++; @@ -108,8 +109,8 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, if (header_index != 0) { header_buf[header_index] = -1; to = header_buf[0]; - MPI_Send(header_buf, HEADER_SIZE, MPI_INT, to, tag, comm); - MPI_Send(buf, count, datatype, to, tag, comm); + smpi_mpi_send(header_buf, HEADER_SIZE, MPI_INT, to, tag, comm); + smpi_mpi_send(buf, count, datatype, to, tag, comm); } /* randomly MPI_Send to one */ @@ -119,10 +120,11 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, if (already_sent[i] == 0) { header_buf[0] = i; header_buf[1] = -1; - MPI_Send(header_buf, HEADER_SIZE, MPI_INT, i, tag, comm); - MPI_Send(buf, count, datatype, i, tag, comm); + smpi_mpi_send(header_buf, HEADER_SIZE, MPI_INT, i, tag, comm); + smpi_mpi_send(buf, count, datatype, i, tag, comm); already_sent[i] = 1; sent_count++; + to_clean[i]=0; break; } } @@ -130,18 +132,21 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count, } /* while loop */ + + for(i=0; i segment)) { - MPI_Bcast((char *)buf + (pipe_length * increment), remainder, datatype, root, comm); + XBT_WARN("MPI_bcast_arrival_nb use default MPI_bcast."); + smpi_mpi_bcast((char *)buf + (pipe_length * increment), remainder, datatype, root, comm); } return MPI_SUCCESS;