1
1
This commit was SVN r7083.
Этот коммит содержится в:
Jeff Squyres 2005-08-29 19:55:48 +00:00
родитель 0ef7ced8f0
Коммит 10488b717a
2 изменённых файлов: 35 добавлений и 23 удалений

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

@ -50,14 +50,19 @@ mca_coll_basic_gatherv_intra(void *sbuf, int scount,
size = ompi_comm_size(comm); size = ompi_comm_size(comm);
rank = ompi_comm_rank(comm); rank = ompi_comm_rank(comm);
/* Everyone but root sends data and returns. Note that we will only /* Everyone but root sends data and returns. Don't send anything
* get here if scount > 0 or rank == root. */ for sendcounts of 0 (even though MPI_Gatherv has a guard for 0
counts, this routine is used elsewhere, like the implementation
of allgatherv, so it's possible to get here with a scount of
0) */
if (rank != root) { if (rank != root) {
err = MCA_PML_CALL(send(sbuf, scount, sdtype, root, if (scount > 0) {
MCA_COLL_BASE_TAG_GATHERV, return MCA_PML_CALL(send(sbuf, scount, sdtype, root,
MCA_PML_BASE_SEND_STANDARD, comm)); MCA_COLL_BASE_TAG_GATHERV,
return err; MCA_PML_BASE_SEND_STANDARD, comm));
}
return MPI_SUCCESS;
} }
/* I am the root, loop receiving data. */ /* I am the root, loop receiving data. */
@ -71,10 +76,12 @@ mca_coll_basic_gatherv_intra(void *sbuf, int scount,
ptmp = ((char *) rbuf) + (extent * disps[i]); ptmp = ((char *) rbuf) + (extent * disps[i]);
if (i == rank) { if (i == rank) {
if ((0 < scount) && (0 < rcounts[i])) /* simple optimization */ /* simple optimization */
if ((0 < scount) && (0 < rcounts[i]))
err = ompi_ddt_sndrcv(sbuf, scount, sdtype, err = ompi_ddt_sndrcv(sbuf, scount, sdtype,
ptmp, rcounts[i], rdtype); ptmp, rcounts[i], rdtype);
} else { } else {
/* Only receive if there is something to receive */
if (rcounts[i] > 0) { if (rcounts[i] > 0) {
err = MCA_PML_CALL(recv(ptmp, rcounts[i], rdtype, i, err = MCA_PML_CALL(recv(ptmp, rcounts[i], rdtype, i,
MCA_COLL_BASE_TAG_GATHERV, MCA_COLL_BASE_TAG_GATHERV,

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

@ -53,14 +53,16 @@ mca_coll_basic_scatterv_intra(void *sbuf, int *scounts,
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. */
* rcount > 0 or rank == root. */
if (rank != root) { if (rank != root) {
err = MCA_PML_CALL(recv(rbuf, rcount, rdtype, /* Only receive if there is something to receive */
root, MCA_COLL_BASE_TAG_SCATTERV, if (rcount > 0) {
comm, MPI_STATUS_IGNORE)); return MCA_PML_CALL(recv(rbuf, rcount, rdtype,
return err; root, MCA_COLL_BASE_TAG_SCATTERV,
comm, MPI_STATUS_IGNORE));
}
return MPI_SUCCESS;
} }
/* I am the root, loop sending data. */ /* I am the root, loop sending data. */
@ -76,19 +78,22 @@ mca_coll_basic_scatterv_intra(void *sbuf, int *scounts,
/* simple optimization */ /* simple optimization */
if (i == rank) { if (i == rank) {
if (0 == scounts[i]) { /* simple optimization or a local operation */ /* simple optimization or a local operation */
if (0 == scounts[i]) {
continue; continue;
} }
err = err = ompi_ddt_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount,
ompi_ddt_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount, rdtype);
rdtype);
} else { } else {
err = MCA_PML_CALL(send(ptmp, scounts[i], sdtype, i, /* Only send if there is something to send */
MCA_COLL_BASE_TAG_SCATTERV, if (scounts[i] > 0) {
MCA_PML_BASE_SEND_STANDARD, comm)); err = MCA_PML_CALL(send(ptmp, scounts[i], sdtype, i,
} MCA_COLL_BASE_TAG_SCATTERV,
if (MPI_SUCCESS != err) { MCA_PML_BASE_SEND_STANDARD, comm));
return err; if (MPI_SUCCESS != err) {
return err;
}
}
} }
} }