1
1

Ensure to handle the cases where an individual send or receive count

is 0

This commit was SVN r2921.
Этот коммит содержится в:
Jeff Squyres 2004-10-04 18:03:52 +00:00
родитель a5a5655d3a
Коммит 0dc4f4bb8d
2 изменённых файлов: 26 добавлений и 16 удалений

Просмотреть файл

@ -52,11 +52,13 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps,
psnd = ((char *) sbuf) + (sdisps[rank] * sndextent);
prcv = ((char *) rbuf) + (rdisps[rank] * rcvextent);
err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtype,
prcv, rcounts[rank], rdtype,
MCA_COLL_BASE_TAG_ALLTOALLV, comm);
if (MPI_SUCCESS != err) {
return err;
if (0 != scounts[rank]) {
err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtype,
prcv, rcounts[rank], rdtype,
MCA_COLL_BASE_TAG_ALLTOALLV, comm);
if (MPI_SUCCESS != err) {
return err;
}
}
/* If only one process, we're done. */
@ -67,18 +69,20 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps,
/* Initiate all send/recv to/from others. */
nreqs = (size - 1) * 2;
nreqs = 0;
preq = comm->c_coll_basic_data->mccb_reqs;
/* Post all receives first -- a simple optimization */
for (i = 0; i < size; ++i) {
if (i == rank)
if (i == rank || 0 == rcounts[i]) {
continue;
}
prcv = ((char *) rbuf) + (rdisps[i] * rcvextent);
err = mca_pml.pml_irecv_init(prcv, rcounts[i], rdtype,
i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, preq++);
++nreqs;
if (MPI_SUCCESS != err) {
mca_coll_basic_free_reqs(comm->c_coll_basic_data->mccb_reqs, nreqs);
return err;
@ -88,13 +92,15 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps,
/* Now post all sends */
for (i = 0; i < size; ++i) {
if (i == rank)
if (i == rank || 0 == scounts[i]) {
continue;
}
psnd = ((char *) sbuf) + (sdisps[i] * sndextent);
err = mca_pml.pml_isend_init(psnd, scounts[i], sdtype,
i, MCA_COLL_BASE_TAG_ALLTOALLV,
MCA_PML_BASE_SEND_STANDARD, comm, preq++);
++nreqs;
if (MPI_SUCCESS != err) {
mca_coll_basic_free_reqs(comm->c_coll_basic_data->mccb_reqs, nreqs);
return err;

Просмотреть файл

@ -45,11 +45,13 @@ int mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps,
psnd = ((char *) sbuf) + sdisps[rank];
prcv = ((char *) rbuf) + rdisps[rank];
err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtypes[rank],
prcv, rcounts[rank], rdtypes[rank],
MCA_COLL_BASE_TAG_ALLTOALLW, comm);
if (MPI_SUCCESS != err) {
return err;
if (0 != scounts[rank]) {
err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtypes[rank],
prcv, rcounts[rank], rdtypes[rank],
MCA_COLL_BASE_TAG_ALLTOALLW, comm);
if (MPI_SUCCESS != err) {
return err;
}
}
/* If only one process, we're done. */
@ -60,18 +62,19 @@ int mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps,
/* Initiate all send/recv to/from others. */
nreqs = (size - 1) * 2;
nreqs = 0;
preq = comm->c_coll_basic_data->mccb_reqs;
/* Post all receives first -- a simple optimization */
for (i = 0; i < size; ++i) {
if (i == rank)
if (i == rank || 0 == rcounts[i])
continue;
prcv = ((char *) rbuf) + rdisps[i];
err = mca_pml.pml_irecv_init(prcv, rcounts[i], rdtypes[i],
i, MCA_COLL_BASE_TAG_ALLTOALLW, comm, preq++);
++nreqs;
if (MPI_SUCCESS != err) {
mca_coll_basic_free_reqs(comm->c_coll_basic_data->mccb_reqs, nreqs);
return err;
@ -81,13 +84,14 @@ int mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps,
/* Now post all sends */
for (i = 0; i < size; ++i) {
if (i == rank)
if (i == rank || 0 = scounts[i])
continue;
psnd = ((char *) sbuf) + sdisps[i];
err = mca_pml.pml_isend_init(psnd, scounts[i], sdtypes[i],
i, MCA_COLL_BASE_TAG_ALLTOALLW,
MCA_PML_BASE_SEND_STANDARD, comm, preq++);
++nreqs;
if (MPI_SUCCESS != err) {
mca_coll_basic_free_reqs(comm->c_coll_basic_data->mccb_reqs, nreqs);
return err;