From 64c1228b5591e35901a92d4c76c23306d53a2ef4 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 24 Apr 2014 20:27:03 +0000 Subject: [PATCH] Roll back r31519 and r31521: George convinced us that these approaches weren't right. This commit was SVN r31528. The following SVN revision numbers were found above: r31519 --> open-mpi/ompi@b449c750b72b2183051c92744702353ad57ff3f8 r31521 --> open-mpi/ompi@e243805ed887bd4ae16a58b0c161f93f4970fe04 --- ompi/datatype/ompi_datatype_sndrcv.c | 6 +-- ompi/mca/coll/basic/coll_basic_alltoallv.c | 54 +++++++--------------- ompi/mca/coll/basic/coll_basic_alltoallw.c | 47 ++++++------------- ompi/mca/coll/tuned/coll_tuned_alltoallv.c | 15 ++---- 4 files changed, 37 insertions(+), 85 deletions(-) diff --git a/ompi/datatype/ompi_datatype_sndrcv.c b/ompi/datatype/ompi_datatype_sndrcv.c index 6cc0b1f7b3..8cbbac038c 100644 --- a/ompi/datatype/ompi_datatype_sndrcv.c +++ b/ompi/datatype/ompi_datatype_sndrcv.c @@ -11,8 +11,6 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,8 +50,8 @@ int32_t ompi_datatype_sndrcv( void *sbuf, int32_t scount, const ompi_datatype_t* size_t max_data; /* First check if we really have something to do */ - if (0 == rcount || 0 == rdtype->super.size) { - return ((0 == scount || 0 == sdtype->super.size) ? MPI_SUCCESS : MPI_ERR_TRUNCATE); + if (0 == rcount) { + return ((0 == scount) ? MPI_SUCCESS : MPI_ERR_TRUNCATE); } /* If same datatypes used, just copy. */ diff --git a/ompi/mca/coll/basic/coll_basic_alltoallv.c b/ompi/mca/coll/basic/coll_basic_alltoallv.c index 9d7bd8388f..5e27fc40cb 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallv.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallv.c @@ -13,9 +13,6 @@ * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,10 +38,10 @@ mca_coll_basic_alltoallv_intra_inplace(void *rbuf, const int *rcounts, const int mca_coll_base_module_t *module) { mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t*) module; - int i, j, size, rank, err=MPI_SUCCESS, nreqs; + int i, j, size, rank, err=MPI_SUCCESS; MPI_Request *preq; char *tmp_buffer; - size_t type_size, max_size; + size_t max_size; ptrdiff_t ext; /* Initialize. */ @@ -71,19 +68,13 @@ mca_coll_basic_alltoallv_intra_inplace(void *rbuf, const int *rcounts, const int return OMPI_ERR_OUT_OF_RESOURCE; } - ompi_datatype_type_size(rdtype, &type_size); - /* in-place alltoallv slow algorithm (but works) */ for (i = 0 ; i < size ; ++i) { - size_t msg_size_i = type_size * rcounts[i]; - for (j = i+1 ; j < size ; ++j) { - size_t msg_size_j = type_size * rcounts[j]; /* Initiate all send/recv to/from others. */ - nreqs = 0; preq = basic_module->mccb_reqs; - if (i == rank && msg_size_j > 0) { + if (i == rank && rcounts[j]) { /* Copy the data into the temporary buffer */ err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[j], tmp_buffer, (char *) rbuf + rdisps[j] * ext); @@ -92,15 +83,13 @@ mca_coll_basic_alltoallv_intra_inplace(void *rbuf, const int *rcounts, const int /* Exchange data with the peer */ err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[j] * ext, rcounts[j], rdtype, j, MCA_COLL_BASE_TAG_ALLTOALLV, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } err = MCA_PML_CALL(isend ((void *) tmp_buffer, rcounts[j], rdtype, j, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } - } else if (j == rank && msg_size_i > 0) { + } else if (j == rank && rcounts[i]) { /* Copy the data into the temporary buffer */ err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[i], tmp_buffer, (char *) rbuf + rdisps[i] * ext); @@ -109,24 +98,22 @@ mca_coll_basic_alltoallv_intra_inplace(void *rbuf, const int *rcounts, const int /* Exchange data with the peer */ err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[i] * ext, rcounts[i], rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } err = MCA_PML_CALL(isend ((void *) tmp_buffer, rcounts[i], rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } } else { continue; } /* Wait for the requests to complete */ - err = ompi_request_wait_all (nreqs, basic_module->mccb_reqs, MPI_STATUSES_IGNORE); + err = ompi_request_wait_all (2, basic_module->mccb_reqs, MPI_STATUS_IGNORE); if (MPI_SUCCESS != err) { goto error_hndl; } /* Free the requests. */ - mca_coll_basic_free_reqs(basic_module->mccb_reqs, nreqs); + mca_coll_basic_free_reqs(basic_module->mccb_reqs, 2); } } @@ -160,7 +147,6 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, int err; char *psnd; char *prcv; - size_t type_size; int nreqs; MPI_Aint sndextent; MPI_Aint rcvextent; @@ -185,10 +171,12 @@ 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_datatype_sndrcv(psnd, scounts[rank], sdtype, - prcv, rcounts[rank], rdtype); - if (MPI_SUCCESS != err) { - return err; + if (0 != scounts[rank]) { + err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtype, + prcv, rcounts[rank], rdtype); + if (MPI_SUCCESS != err) { + return err; + } } /* If only one process, we're done. */ @@ -204,10 +192,8 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, /* Post all receives first -- a simple optimization */ - ompi_datatype_type_size(rdtype, &type_size); for (i = 0; i < size; ++i) { - size_t msg_size = type_size * rcounts[i]; - if (i == rank || 0 == msg_size) { + if (i == rank || 0 == rcounts[i]) { continue; } @@ -224,10 +210,8 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, /* Now post all sends */ - ompi_datatype_type_size(sdtype, &type_size); for (i = 0; i < size; ++i) { - size_t msg_size = type_size * scounts[i]; - if (i == rank || 0 == msg_size) { + if (i == rank || 0 == scounts[i]) { continue; } @@ -287,7 +271,7 @@ mca_coll_basic_alltoallv_inter(void *sbuf, int *scounts, int *sdisps, int err; char *psnd; char *prcv; - size_t type_size, nreqs; + size_t nreqs; MPI_Aint sndextent; MPI_Aint rcvextent; @@ -306,11 +290,9 @@ mca_coll_basic_alltoallv_inter(void *sbuf, int *scounts, int *sdisps, /* Post all receives first */ /* A simple optimization: do not send and recv msgs of length zero */ - ompi_datatype_type_size(rdtype, &type_size); for (i = 0; i < rsize; ++i) { - size_t msg_size = type_size * rcounts[i]; prcv = ((char *) rbuf) + (rdisps[i] * rcvextent); - if (msg_size > 0) { + if (rcounts[i] > 0) { err = MCA_PML_CALL(irecv(prcv, rcounts[i], rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &preq[i])); @@ -323,11 +305,9 @@ mca_coll_basic_alltoallv_inter(void *sbuf, int *scounts, int *sdisps, } /* Now post all sends */ - ompi_datatype_type_size(sdtype, &type_size); for (i = 0; i < rsize; ++i) { - size_t msg_size = type_size * scounts[i]; psnd = ((char *) sbuf) + (sdisps[i] * sndextent); - if (msg_size > 0) { + if (scounts[i] > 0) { err = MCA_PML_CALL(isend(psnd, scounts[i], sdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, diff --git a/ompi/mca/coll/basic/coll_basic_alltoallw.c b/ompi/mca/coll/basic/coll_basic_alltoallw.c index cc54fed142..832ab4e1e5 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallw.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallw.c @@ -14,9 +14,6 @@ * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +39,7 @@ mca_coll_basic_alltoallw_intra_inplace(void *rbuf, int *rcounts, const int *rdis mca_coll_base_module_t *module) { mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t*) module; - int i, j, size, rank, err=MPI_SUCCESS, max_size, nreqs; + int i, j, size, rank, err=MPI_SUCCESS, max_size; MPI_Request *preq; char *tmp_buffer; ptrdiff_t ext; @@ -73,19 +70,13 @@ mca_coll_basic_alltoallw_intra_inplace(void *rbuf, int *rcounts, const int *rdis /* in-place alltoallw slow algorithm (but works) */ for (i = 0 ; i < size ; ++i) { - size_t msg_size_i; - ompi_datatype_type_size(rdtypes[i], &msg_size_i); - msg_size_i *= rcounts[i]; for (j = i+1 ; j < size ; ++j) { - size_t msg_size_j; - ompi_datatype_type_size(rdtypes[j], &msg_size_j); - msg_size_j *= rcounts[j]; + ompi_datatype_type_extent (rdtypes[j], &ext); /* Initiate all send/recv to/from others. */ - nreqs = 0; preq = basic_module->mccb_reqs; - if (i == rank && msg_size_j != 0) { + if (i == rank && rcounts[j] != 0) { /* Copy the data into the temporary buffer */ err = ompi_datatype_copy_content_same_ddt (rdtypes[j], rcounts[j], tmp_buffer, (char *) rbuf + rdisps[j]); @@ -94,15 +85,13 @@ mca_coll_basic_alltoallw_intra_inplace(void *rbuf, int *rcounts, const int *rdis /* Exchange data with the peer */ err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[j], rcounts[j], rdtypes[j], j, MCA_COLL_BASE_TAG_ALLTOALLW, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } err = MCA_PML_CALL(isend ((void *) tmp_buffer, rcounts[j], rdtypes[j], j, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } - } else if (j == rank && msg_size_i != 0) { + } else if (j == rank && rcounts[i] != 0) { /* Copy the data into the temporary buffer */ err = ompi_datatype_copy_content_same_ddt (rdtypes[i], rcounts[i], tmp_buffer, (char *) rbuf + rdisps[i]); @@ -111,24 +100,22 @@ mca_coll_basic_alltoallw_intra_inplace(void *rbuf, int *rcounts, const int *rdis /* Exchange data with the peer */ err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[i], rcounts[i], rdtypes[i], i, MCA_COLL_BASE_TAG_ALLTOALLW, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } err = MCA_PML_CALL(isend ((void *) tmp_buffer, rcounts[i], rdtypes[i], i, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } } else { continue; } /* Wait for the requests to complete */ - err = ompi_request_wait_all (nreqs, basic_module->mccb_reqs, MPI_STATUSES_IGNORE); + err = ompi_request_wait_all (2, basic_module->mccb_reqs, MPI_STATUS_IGNORE); if (MPI_SUCCESS != err) { goto error_hndl; } /* Free the requests. */ - mca_coll_basic_free_reqs(basic_module->mccb_reqs, nreqs); + mca_coll_basic_free_reqs(basic_module->mccb_reqs, 2); } } @@ -181,10 +168,12 @@ mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps, psnd = ((char *) sbuf) + sdisps[rank]; prcv = ((char *) rbuf) + rdisps[rank]; - err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtypes[rank], - prcv, rcounts[rank], rdtypes[rank]); - if (MPI_SUCCESS != err) { - return err; + if (0 != scounts[rank]) { + err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtypes[rank], + prcv, rcounts[rank], rdtypes[rank]); + if (MPI_SUCCESS != err) { + return err; + } } /* If only one process, we're done. */ @@ -201,11 +190,7 @@ mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps, /* Post all receives first -- a simple optimization */ for (i = 0; i < size; ++i) { - size_t msg_size; - ompi_datatype_type_size(rdtypes[i], &msg_size); - msg_size *= rcounts[i]; - - if (i == rank || 0 == msg_size) + if (i == rank || 0 == rcounts[i]) continue; prcv = ((char *) rbuf) + rdisps[i]; @@ -223,11 +208,7 @@ mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps, /* Now post all sends */ for (i = 0; i < size; ++i) { - size_t msg_size; - ompi_datatype_type_size(sdtypes[i], &msg_size); - msg_size *= scounts[i]; - - if (i == rank || 0 == msg_size) + if (i == rank || 0 == scounts[i]) continue; psnd = ((char *) sbuf) + sdisps[i]; diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoallv.c b/ompi/mca/coll/tuned/coll_tuned_alltoallv.c index f03d12295f..03dc3a4ed7 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoallv.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoallv.c @@ -14,8 +14,6 @@ * Copyright (c) 2013 Los Alamos National Security, LLC. All Rights * reserved. * Copyright (c) 2013 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -88,11 +86,10 @@ mca_coll_tuned_alltoallv_intra_basic_inplace(void *rbuf, const int *rcounts, con /* in-place alltoallv slow algorithm (but works) */ for (i = 0 ; i < size ; ++i) { for (j = i+1 ; j < size ; ++j) { - int nreqs = 0; /* Initiate all send/recv to/from others. */ preq = tuned_module->tuned_data->mcct_reqs; - if (i == rank && rcounts[j] && ext) { + if (i == rank && rcounts[j]) { /* Copy the data into the temporary buffer */ err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[j], tmp_buffer, (char *) rbuf + rdisps[j] * ext); @@ -101,15 +98,13 @@ mca_coll_tuned_alltoallv_intra_basic_inplace(void *rbuf, const int *rcounts, con /* Exchange data with the peer */ err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[j] * ext, rcounts[j], rdtype, j, MCA_COLL_BASE_TAG_ALLTOALLV, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } err = MCA_PML_CALL(isend ((void *) tmp_buffer, rcounts[j], rdtype, j, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } - } else if (j == rank && rcounts[i] && ext) { + } else if (j == rank && rcounts[i]) { /* Copy the data into the temporary buffer */ err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[i], tmp_buffer, (char *) rbuf + rdisps[i] * ext); @@ -118,24 +113,22 @@ mca_coll_tuned_alltoallv_intra_basic_inplace(void *rbuf, const int *rcounts, con /* Exchange data with the peer */ err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[i] * ext, rcounts[i], rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } err = MCA_PML_CALL(isend ((void *) tmp_buffer, rcounts[i], rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); - ++nreqs; if (MPI_SUCCESS != err) { goto error_hndl; } } else { continue; } /* Wait for the requests to complete */ - err = ompi_request_wait_all (nreqs, tuned_module->tuned_data->mcct_reqs, MPI_STATUSES_IGNORE); + err = ompi_request_wait_all (2, tuned_module->tuned_data->mcct_reqs, MPI_STATUS_IGNORE); if (MPI_SUCCESS != err) { goto error_hndl; } /* Free the requests. */ - mca_coll_tuned_free_reqs(tuned_module->tuned_data->mcct_reqs, nreqs); + mca_coll_tuned_free_reqs(tuned_module->tuned_data->mcct_reqs, 2); } }