Always send a message even when the send_count is zero. Except for local operations (send + receive),
they can be safely skiped. This commit was SVN r6792.
Этот коммит содержится в:
родитель
e765294bc0
Коммит
a59fa8ac42
@ -39,59 +39,59 @@ int mca_coll_basic_scatterv_intra(void *sbuf, int *scounts,
|
|||||||
struct ompi_datatype_t *rdtype, int root,
|
struct ompi_datatype_t *rdtype, int root,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int rank;
|
int rank;
|
||||||
int size;
|
int size;
|
||||||
int err;
|
int err;
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
long lb;
|
||||||
long extent;
|
long extent;
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
|
||||||
rank = ompi_comm_rank(comm);
|
rank = ompi_comm_rank(comm);
|
||||||
size = ompi_comm_size(comm);
|
size = ompi_comm_size(comm);
|
||||||
|
|
||||||
/* If not root, receive data. Note that we will only get here if
|
/* If not root, receive data. Note that we will only get here if
|
||||||
rcount > 0 or rank == root. */
|
rcount > 0 or rank == root. */
|
||||||
|
|
||||||
if (rank != root) {
|
if (rank != root) {
|
||||||
err = MCA_PML_CALL(recv(rbuf, rcount, rdtype,
|
err = MCA_PML_CALL(recv(rbuf, rcount, rdtype,
|
||||||
root, MCA_COLL_BASE_TAG_SCATTERV,
|
root, MCA_COLL_BASE_TAG_SCATTERV,
|
||||||
comm, MPI_STATUS_IGNORE));
|
comm, MPI_STATUS_IGNORE));
|
||||||
return err;
|
return err;
|
||||||
}
|
|
||||||
|
|
||||||
/* I am the root, loop sending data. */
|
|
||||||
|
|
||||||
err = ompi_ddt_get_extent(rdtype, &lb, &extent);
|
|
||||||
if (OMPI_SUCCESS != err) {
|
|
||||||
return OMPI_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < size; ++i) {
|
|
||||||
if (0 == scounts[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
ptmp = ((char *) sbuf) + (extent * disps[i]);
|
|
||||||
|
|
||||||
/* simple optimization */
|
/* I am the root, loop sending data. */
|
||||||
|
|
||||||
if (i == rank) {
|
err = ompi_ddt_get_extent(rdtype, &lb, &extent);
|
||||||
err = ompi_ddt_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount, rdtype);
|
if (OMPI_SUCCESS != err) {
|
||||||
} else {
|
return OMPI_ERROR;
|
||||||
err = MCA_PML_CALL(send(ptmp, scounts[i], sdtype, i,
|
|
||||||
MCA_COLL_BASE_TAG_SCATTERV,
|
|
||||||
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
||||||
}
|
}
|
||||||
if (MPI_SUCCESS != err) {
|
|
||||||
return err;
|
for (i = 0; i < size; ++i) {
|
||||||
|
ptmp = ((char *) sbuf) + (extent * disps[i]);
|
||||||
|
|
||||||
|
/* simple optimization */
|
||||||
|
|
||||||
|
if (i == rank) {
|
||||||
|
if( 0 == scounts[i] ) { /* simple optimization or a local operation */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
err = ompi_ddt_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount, rdtype);
|
||||||
|
} else {
|
||||||
|
err = MCA_PML_CALL(send(ptmp, scounts[i], sdtype, i,
|
||||||
|
MCA_COLL_BASE_TAG_SCATTERV,
|
||||||
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
||||||
|
}
|
||||||
|
if (MPI_SUCCESS != err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user