From 3e9c6227d7de41af16078373280b8f8bdad90c4a Mon Sep 17 00:00:00 2001 From: Jake Tronge Date: Mon, 20 May 2024 08:23:44 -0600 Subject: [PATCH] Update coll framework count/disp arrays for bigcount This updates the coll framework functions using count/displacement arrays to support bigcount. Instead of directly using pointers to bigcount/non-bigcount type arrays, this adds special descriptor types, ompi_count_array and ompi_disp_array, that internally hold a union of either type. Collective components can now access count and displacement values through inline get functions on the descriptors, allowing use of both bigcount/non-bigcount arrays, depending on how the descriptors were initialized. Co-authored-by: Howard Pritchard Signed-off-by: Jake Tronge --- ompi/communicator/comm.c | 6 +- ompi/mca/coll/base/coll_base_allgatherv.c | 153 ++++++++++------- ompi/mca/coll/base/coll_base_alltoallv.c | 65 ++++---- ompi/mca/coll/base/coll_base_functions.h | 20 +-- ompi/mca/coll/base/coll_base_reduce_scatter.c | 154 ++++++++++-------- ompi/mca/coll/basic/coll_basic.h | 66 ++++---- ompi/mca/coll/basic/coll_basic_allgatherv.c | 17 +- ompi/mca/coll/basic/coll_basic_alltoallv.c | 16 +- ompi/mca/coll/basic/coll_basic_alltoallw.c | 61 +++---- ompi/mca/coll/basic/coll_basic_gatherv.c | 26 +-- .../basic/coll_basic_neighbor_allgatherv.c | 27 +-- .../basic/coll_basic_neighbor_alltoallv.c | 48 +++--- .../basic/coll_basic_neighbor_alltoallw.c | 48 +++--- .../coll/basic/coll_basic_reduce_scatter.c | 51 +++--- ompi/mca/coll/basic/coll_basic_scatterv.c | 26 +-- ompi/mca/coll/coll.h | 81 ++++----- ompi/mca/coll/demo/coll_demo.h | 32 ++-- ompi/mca/coll/demo/coll_demo_allgatherv.c | 4 +- ompi/mca/coll/demo/coll_demo_alltoallv.c | 8 +- ompi/mca/coll/demo/coll_demo_alltoallw.c | 8 +- ompi/mca/coll/demo/coll_demo_gatherv.c | 4 +- ompi/mca/coll/demo/coll_demo_reduce_scatter.c | 4 +- ompi/mca/coll/demo/coll_demo_scatterv.c | 8 +- ompi/mca/coll/han/coll_han_algorithms.h | 10 +- ompi/mca/coll/han/coll_han_dynamic.c | 20 +-- ompi/mca/coll/han/coll_han_gatherv.c | 131 +++++++-------- ompi/mca/coll/han/coll_han_scatterv.c | 136 ++++++++-------- ompi/mca/coll/hcoll/coll_hcoll.h | 40 ++--- ompi/mca/coll/hcoll/coll_hcoll_ops.c | 148 ++++++++++++----- ompi/mca/coll/inter/coll_inter.h | 12 +- ompi/mca/coll/inter/coll_inter_allgatherv.c | 44 +++-- ompi/mca/coll/inter/coll_inter_gatherv.c | 43 +++-- ompi/mca/coll/inter/coll_inter_scatterv.c | 47 ++++-- ompi/mca/coll/libnbc/coll_libnbc.h | 112 +++++++------ ompi/mca/coll/libnbc/nbc_iallgatherv.c | 40 +++-- ompi/mca/coll/libnbc/nbc_ialltoallv.c | 139 ++++++++-------- ompi/mca/coll/libnbc/nbc_ialltoallw.c | 133 +++++++-------- ompi/mca/coll/libnbc/nbc_igatherv.c | 32 ++-- .../coll/libnbc/nbc_ineighbor_allgatherv.c | 13 +- .../mca/coll/libnbc/nbc_ineighbor_alltoallv.c | 18 +- .../mca/coll/libnbc/nbc_ineighbor_alltoallw.c | 18 +- ompi/mca/coll/libnbc/nbc_ireduce_scatter.c | 44 ++--- .../coll/libnbc/nbc_ireduce_scatter_block.c | 2 +- ompi/mca/coll/libnbc/nbc_iscatterv.c | 34 ++-- ompi/mca/coll/monitoring/coll_monitoring.h | 106 ++++++------ .../monitoring/coll_monitoring_allgatherv.c | 8 +- .../monitoring/coll_monitoring_alltoallv.c | 16 +- .../monitoring/coll_monitoring_alltoallw.c | 20 +-- .../monitoring/coll_monitoring_component.c | 1 + .../coll/monitoring/coll_monitoring_gatherv.c | 12 +- .../coll_monitoring_neighbor_allgatherv.c | 8 +- .../coll_monitoring_neighbor_alltoallv.c | 22 +-- .../coll_monitoring_neighbor_alltoallw.c | 24 +-- .../coll_monitoring_reduce_scatter.c | 8 +- .../monitoring/coll_monitoring_scatterv.c | 12 +- ompi/mca/coll/portals4/coll_portals4.h | 16 +- ompi/mca/coll/portals4/coll_portals4_gather.c | 16 +- .../mca/coll/portals4/coll_portals4_scatter.c | 12 +- ompi/mca/coll/self/coll_self.h | 22 +-- ompi/mca/coll/self/coll_self_allgatherv.c | 6 +- ompi/mca/coll/self/coll_self_alltoallv.c | 12 +- ompi/mca/coll/self/coll_self_alltoallw.c | 12 +- ompi/mca/coll/self/coll_self_gatherv.c | 8 +- ompi/mca/coll/self/coll_self_reduce_scatter.c | 4 +- ompi/mca/coll/self/coll_self_scatterv.c | 8 +- ompi/mca/coll/sync/coll_sync.h | 10 +- ompi/mca/coll/sync/coll_sync_gatherv.c | 4 +- ompi/mca/coll/sync/coll_sync_reduce_scatter.c | 2 +- ompi/mca/coll/sync/coll_sync_scatterv.c | 6 +- .../tuned/coll_tuned_allgatherv_decision.c | 6 +- .../tuned/coll_tuned_alltoallv_decision.c | 4 +- .../coll/tuned/coll_tuned_decision_dynamic.c | 16 +- .../coll/tuned/coll_tuned_decision_fixed.c | 16 +- .../coll_tuned_reduce_scatter_decision.c | 2 +- ompi/mca/coll/ucc/coll_ucc.h | 40 ++--- ompi/mca/coll/ucc/coll_ucc_allgatherv.c | 22 ++- ompi/mca/coll/ucc/coll_ucc_alltoallv.c | 33 ++-- ompi/mca/coll/ucc/coll_ucc_gatherv.c | 22 ++- ompi/mca/coll/ucc/coll_ucc_reduce_scatter.c | 11 +- ompi/mca/coll/ucc/coll_ucc_scatterv.c | 28 ++-- .../fcoll_dynamic_gen2_file_write_all.c | 26 +-- .../vulcan/fcoll_vulcan_file_write_all.c | 25 +-- .../hook/comm_method/hook_comm_method_fns.c | 6 +- ompi/mca/io/ompio/io_ompio.c | 8 +- ompi/mca/osc/ucx/osc_ucx_component.c | 6 +- .../sharedfp_individual_collaborate_data.c | 13 +- ompi/mpi/c/allgatherv.c | 8 +- ompi/mpi/c/allgatherv_init.c | 6 +- ompi/mpi/c/alltoallv.c | 10 +- ompi/mpi/c/alltoallv_init.c | 10 +- ompi/mpi/c/alltoallw.c | 10 +- ompi/mpi/c/alltoallw_init.c | 12 +- ompi/mpi/c/gatherv.c | 6 +- ompi/mpi/c/gatherv_init.c | 6 +- ompi/mpi/c/iallgatherv.c | 6 +- ompi/mpi/c/ialltoallv.c | 10 +- ompi/mpi/c/ialltoallw.c | 12 +- ompi/mpi/c/igatherv.c | 6 +- ompi/mpi/c/ineighbor_allgatherv.c | 6 +- ompi/mpi/c/ineighbor_alltoallv.c | 10 +- ompi/mpi/c/ineighbor_alltoallw.c | 10 +- ompi/mpi/c/ireduce_scatter.c | 4 +- ompi/mpi/c/iscatterv.c | 6 +- ompi/mpi/c/neighbor_allgatherv.c | 6 +- ompi/mpi/c/neighbor_allgatherv_init.c | 6 +- ompi/mpi/c/neighbor_alltoallv.c | 10 +- ompi/mpi/c/neighbor_alltoallv_init.c | 10 +- ompi/mpi/c/neighbor_alltoallw.c | 10 +- ompi/mpi/c/neighbor_alltoallw_init.c | 10 +- ompi/mpi/c/reduce_scatter.c | 4 +- ompi/mpi/c/reduce_scatter_init.c | 4 +- ompi/mpi/c/scatterv.c | 6 +- ompi/mpi/c/scatterv_init.c | 6 +- ompi/util/Makefile.am | 3 +- ompi/util/count_disp_array.h | 146 +++++++++++++++++ oshmem/mca/scoll/mpi/scoll_mpi_ops.c | 8 +- 116 files changed, 1838 insertions(+), 1337 deletions(-) create mode 100644 ompi/util/count_disp_array.h diff --git a/ompi/communicator/comm.c b/ompi/communicator/comm.c index 545356d958d..30bd0190ad4 100644 --- a/ompi/communicator/comm.c +++ b/ompi/communicator/comm.c @@ -2402,6 +2402,8 @@ int ompi_comm_determine_first ( ompi_communicator_t *intercomm, int high ) int rank, rsize; int *rcounts; int *rdisps; + ompi_count_array rcounts_desc; + ompi_disp_array rdisps_desc; int scount=0; int rc; @@ -2429,8 +2431,10 @@ int ompi_comm_determine_first ( ompi_communicator_t *intercomm, int high ) scount = 1; } + OMPI_COUNT_ARRAY_INIT(&rcounts_desc, rcounts); + OMPI_DISP_ARRAY_INIT(&rdisps_desc, rdisps); rc = intercomm->c_coll->coll_allgatherv(&high, scount, MPI_INT, - &rhigh, rcounts, rdisps, + &rhigh, &rcounts_desc, &rdisps_desc, MPI_INT, intercomm, intercomm->c_coll->coll_allgatherv_module); if ( NULL != rdisps ) { diff --git a/ompi/mca/coll/base/coll_base_allgatherv.c b/ompi/mca/coll/base/coll_base_allgatherv.c index 291d3e6b4f2..dac716a5f62 100644 --- a/ompi/mca/coll/base/coll_base_allgatherv.c +++ b/ompi/mca/coll/base/coll_base_allgatherv.c @@ -92,10 +92,10 @@ * [5] [5] [5] [5] [5] [5] [5] * [6] [6] [6] [6] [6] [6] [6] */ -int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount, +int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdispls, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -119,11 +119,11 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount, - if send buffer is not MPI_IN_PLACE, copy send buffer to block rank of the receive buffer. */ - tmprecv = (char*) rbuf + (ptrdiff_t)rdispls[rank] * rext; + tmprecv = (char*) rbuf + ompi_disp_array_get(rdispls, rank) * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, - tmprecv, rcounts[rank], rdtype); + tmprecv, ompi_count_array_get(rcounts, rank), rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -163,10 +163,10 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount, for (i = 0; i < blockcount; i++) { const int tmp_srank = (rank + i) % size; const int tmp_rrank = (recvfrom + i) % size; - new_scounts[i] = rcounts[tmp_srank]; - new_sdispls[i] = rdispls[tmp_srank]; - new_rcounts[i] = rcounts[tmp_rrank]; - new_rdispls[i] = rdispls[tmp_rrank]; + new_scounts[i] = ompi_count_array_get(rcounts, tmp_srank); + new_sdispls[i] = ompi_disp_array_get(rdispls, tmp_srank); + new_rcounts[i] = ompi_count_array_get(rcounts, tmp_rrank); + new_rdispls[i] = ompi_disp_array_get(rdispls, tmp_rrank); } err = ompi_datatype_create_indexed(blockcount, new_scounts, new_sdispls, rdtype, &new_sdtype); @@ -256,10 +256,10 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount, * [5] [5] [5] [5] [5] [5] */ -int ompi_coll_base_allgatherv_intra_sparbit(const void *sbuf, int scount, +int ompi_coll_base_allgatherv_intra_sparbit(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, - const int *rdispls, + void* rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -298,7 +298,8 @@ int ompi_coll_base_allgatherv_intra_sparbit(const void *sbuf, int scount, tmprecv = (char *) rbuf; if(MPI_IN_PLACE != sbuf){ tmpsend = (char *) sbuf; - err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv + (ptrdiff_t) rdispls[rank] * rext, scount, rdtype); + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv + ompi_disp_array_get(rdispls, rank) * rext, + scount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } tmpsend = tmprecv; @@ -328,10 +329,16 @@ int ompi_coll_base_allgatherv_intra_sparbit(const void *sbuf, int scount, * each block sent (and therefore each send and recv call) needs a different tag. */ /* As base OpenMPI only provides one tag for allgather, we are forced to use a tag space * from other components in the send and recv calls */ - if(rcounts[send_disp] > 0) - MCA_PML_CALL(isend(tmpsend + (ptrdiff_t) rdispls[send_disp] * rext, rcounts[send_disp], rdtype, sendto, MCA_COLL_BASE_TAG_HCOLL_BASE - send_disp, MCA_PML_BASE_SEND_STANDARD, comm, requests + step_requests++)); - if(rcounts[recv_disp] > 0) - MCA_PML_CALL(irecv(tmprecv + (ptrdiff_t) rdispls[recv_disp] * rext, rcounts[recv_disp], rdtype, recvfrom, MCA_COLL_BASE_TAG_HCOLL_BASE - recv_disp, comm, requests + step_requests++)); + if(ompi_count_array_get(rcounts, send_disp) > 0) + MCA_PML_CALL(isend(tmpsend + ompi_disp_array_get(rdispls, send_disp) * rext, + ompi_count_array_get(rcounts, send_disp), rdtype, sendto, + MCA_COLL_BASE_TAG_HCOLL_BASE - send_disp, + MCA_PML_BASE_SEND_STANDARD, comm, requests + step_requests++)); + if(ompi_count_array_get(rcounts, recv_disp) > 0) + MCA_PML_CALL(irecv(tmprecv + ompi_disp_array_get(rdispls, recv_disp) * rext, + ompi_count_array_get(rcounts, recv_disp), rdtype, recvfrom, + MCA_COLL_BASE_TAG_HCOLL_BASE - recv_disp, comm, + requests + step_requests++)); } ompi_request_wait_all(step_requests, requests, MPI_STATUSES_IGNORE); @@ -368,9 +375,9 @@ int ompi_coll_base_allgatherv_intra_sparbit(const void *sbuf, int scount, * No additional memory requirements. * */ -int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount, +int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -392,11 +399,11 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount, - if send buffer is not MPI_IN_PLACE, copy send buffer to the appropriate block of receive buffer */ - tmprecv = (char*) rbuf + (ptrdiff_t)rdisps[rank] * rext; + tmprecv = (char*) rbuf + ompi_disp_array_get(rdisps, rank) * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, - tmprecv, rcounts[rank], rdtype); + tmprecv, ompi_count_array_get(rcounts, rank), rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -415,13 +422,13 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount, recvdatafrom = (rank - i - 1 + size) % size; senddatafrom = (rank - i + size) % size; - tmprecv = (char*)rbuf + rdisps[recvdatafrom] * rext; - tmpsend = (char*)rbuf + rdisps[senddatafrom] * rext; + tmprecv = (char*)rbuf + ompi_disp_array_get(rdisps, recvdatafrom) * rext; + tmpsend = (char*)rbuf + ompi_disp_array_get(rdisps, senddatafrom) * rext; /* Sendreceive */ - err = ompi_coll_base_sendrecv(tmpsend, rcounts[senddatafrom], rdtype, + err = ompi_coll_base_sendrecv(tmpsend, ompi_count_array_get(rcounts, senddatafrom), rdtype, sendto, MCA_COLL_BASE_TAG_ALLGATHERV, - tmprecv, rcounts[recvdatafrom], rdtype, + tmprecv, ompi_count_array_get(rcounts, recvdatafrom), rdtype, recvfrom, MCA_COLL_BASE_TAG_ALLGATHERV, comm, MPI_STATUS_IGNORE, rank); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -495,16 +502,18 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount, * [5] [5] [5] [5] [5] [5] */ int -ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, +ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdispls, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { int line = -1, rank, size, i, even_rank, err = 0; int neighbor[2], offset_at_step[2], recv_data_from[2], send_data_from; - int new_scounts[2], new_sdispls[2], new_rcounts[2], new_rdispls[2]; + size_t new_scounts[2], new_rcounts[2]; + ptrdiff_t new_sdispls[2], new_rdispls[2]; + int tmp_new_scounts[2], tmp_new_rcounts[2], tmp_new_sdispls[2], tmp_new_rdispls[2]; ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; struct ompi_datatype_t *new_rdtype, *new_sdtype; @@ -532,11 +541,11 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, - if send buffer is not MPI_IN_PLACE, copy send buffer to the appropriate block of receive buffer */ - tmprecv = (char*) rbuf + (ptrdiff_t)rdispls[rank] * rext; + tmprecv = (char*) rbuf + ompi_disp_array_get(rdispls, rank) * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, - tmprecv, rcounts[rank], rdtype); + tmprecv, ompi_count_array_get(rcounts, rank), rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -567,11 +576,11 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, Note, we need to create indexed datatype to send and receive these blocks properly. */ - tmprecv = (char*)rbuf + (ptrdiff_t)rdispls[neighbor[0]] * rext; - tmpsend = (char*)rbuf + (ptrdiff_t)rdispls[rank] * rext; - err = ompi_coll_base_sendrecv(tmpsend, rcounts[rank], rdtype, + tmprecv = (char*)rbuf + ompi_disp_array_get(rdispls, neighbor[0]) * rext; + tmpsend = (char*)rbuf + ompi_disp_array_get(rdispls, rank) * rext; + err = ompi_coll_base_sendrecv(tmpsend, ompi_count_array_get(rcounts, rank), rdtype, neighbor[0], MCA_COLL_BASE_TAG_ALLGATHERV, - tmprecv, rcounts[neighbor[0]], rdtype, + tmprecv, ompi_count_array_get(rcounts, neighbor[0]), rdtype, neighbor[0], MCA_COLL_BASE_TAG_ALLGATHERV, comm, MPI_STATUS_IGNORE, rank); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -593,21 +602,31 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, We are receiving data from ranks (recv_data_from[i_parity]) and (recv_data_from[i_parity]+1). */ - new_scounts[0] = rcounts[send_data_from]; - new_scounts[1] = rcounts[(send_data_from + 1)]; - new_sdispls[0] = rdispls[send_data_from]; - new_sdispls[1] = rdispls[(send_data_from + 1)]; - err = ompi_datatype_create_indexed(2, new_scounts, new_sdispls, rdtype, + new_scounts[0] = ompi_count_array_get(rcounts, send_data_from); + new_scounts[1] = ompi_count_array_get(rcounts, send_data_from + 1); + new_sdispls[0] = ompi_disp_array_get(rdispls, send_data_from); + new_sdispls[1] = ompi_disp_array_get(rdispls, send_data_from + 1); + /* TODO:BIGCOUNT: Remove temporaries once ompi_datatype interface is updated */ + tmp_new_scounts[0] = new_scounts[0]; + tmp_new_scounts[1] = new_scounts[1]; + tmp_new_sdispls[0] = new_sdispls[0]; + tmp_new_sdispls[1] = new_sdispls[1]; + err = ompi_datatype_create_indexed(2, tmp_new_scounts, tmp_new_sdispls, rdtype, &new_sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } err = ompi_datatype_commit(&new_sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - new_rcounts[0] = rcounts[recv_data_from[i_parity]]; - new_rcounts[1] = rcounts[(recv_data_from[i_parity] + 1)]; - new_rdispls[0] = rdispls[recv_data_from[i_parity]]; - new_rdispls[1] = rdispls[(recv_data_from[i_parity] + 1)]; - err = ompi_datatype_create_indexed(2, new_rcounts, new_rdispls, rdtype, + new_rcounts[0] = ompi_count_array_get(rcounts, recv_data_from[i_parity]); + new_rcounts[1] = ompi_count_array_get(rcounts, recv_data_from[i_parity] + 1); + new_rdispls[0] = ompi_disp_array_get(rdispls, recv_data_from[i_parity]); + new_rdispls[1] = ompi_disp_array_get(rdispls, recv_data_from[i_parity] + 1); + /* TODO:BIGCOUNT: Remove temporaries once ompi_datatype interface is updated */ + tmp_new_rcounts[0] = new_rcounts[0]; + tmp_new_rcounts[1] = new_rcounts[1]; + tmp_new_rdispls[0] = new_rdispls[0]; + tmp_new_rdispls[1] = new_rdispls[1]; + err = ompi_datatype_create_indexed(2, tmp_new_rcounts, tmp_new_rdispls, rdtype, &new_rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } err = ompi_datatype_commit(&new_rdtype); @@ -640,10 +659,10 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, } -int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount, +int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, - const int *rdispls, + void* rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -672,15 +691,15 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount, tmpsend = (char*)sbuf; if (MPI_IN_PLACE == sbuf) { - tmpsend = (char*)rbuf + (ptrdiff_t)rdispls[rank] * rext; - scount = rcounts[rank]; + tmpsend = (char*)rbuf + ompi_disp_array_get(rdispls, rank) * rext; + scount = ompi_count_array_get(rcounts, rank); sdtype = rdtype; } - tmprecv = (char*)rbuf + (ptrdiff_t)rdispls[remote] * rext; + tmprecv = (char*)rbuf + ompi_disp_array_get(rdispls, remote) * rext; err = ompi_coll_base_sendrecv(tmpsend, scount, sdtype, remote, MCA_COLL_BASE_TAG_ALLGATHERV, - tmprecv, rcounts[remote], rdtype, remote, + tmprecv, ompi_count_array_get(rcounts, remote), rdtype, remote, MCA_COLL_BASE_TAG_ALLGATHERV, comm, MPI_STATUS_IGNORE, rank); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -688,8 +707,8 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount, /* Place your data in correct location if necessary */ if (MPI_IN_PLACE != sbuf) { err = ompi_datatype_sndrcv((char*)sbuf, scount, sdtype, - (char*)rbuf + (ptrdiff_t)rdispls[rank] * rext, - rcounts[rank], rdtype); + (char*)rbuf + ompi_disp_array_get(rdispls, rank) * rext, + ompi_count_array_get(rcounts, rank), rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -726,10 +745,10 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount, * Returns: - MPI_SUCCESS or error code */ int -ompi_coll_base_allgatherv_intra_basic_default(const void *sbuf, int scount, +ompi_coll_base_allgatherv_intra_basic_default(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *disps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -738,6 +757,7 @@ ompi_coll_base_allgatherv_intra_basic_default(const void *sbuf, int scount, MPI_Aint extent, lb; char *send_buf = NULL; struct ompi_datatype_t *newtype, *send_type; + int *tmp_rcounts, *tmp_disps; size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); @@ -754,8 +774,8 @@ ompi_coll_base_allgatherv_intra_basic_default(const void *sbuf, int scount, ompi_datatype_get_extent(rdtype, &lb, &extent); send_type = rdtype; send_buf = (char*)rbuf; - send_buf += ((ptrdiff_t)disps[rank] * extent); - scount = rcounts[rank]; + send_buf += (ompi_disp_array_get(disps, rank) * extent); + scount = ompi_count_array_get(rcounts, rank); } else { send_buf = (char*)sbuf; send_type = sdtype; @@ -781,7 +801,22 @@ ompi_coll_base_allgatherv_intra_basic_default(const void *sbuf, int scount, * datatype. */ - err = ompi_datatype_create_indexed(size,rcounts,disps,rdtype,&newtype); + /* TODO:BIGCOUNT: Remove temporaries once ompi_datatype interface is updated */ + tmp_rcounts = malloc(size * sizeof(int)); + if (NULL == tmp_rcounts) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + tmp_disps = malloc(size * sizeof(int)); + if (NULL == tmp_disps) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + for (int i = 0; i < size; i++) { + tmp_rcounts[i] = ompi_count_array_get(rcounts, i); + tmp_disps[i] = ompi_disp_array_get(disps, i); + } + err = ompi_datatype_create_indexed(size,tmp_rcounts,tmp_disps,rdtype,&newtype); + free(tmp_rcounts); + free(tmp_disps); if (MPI_SUCCESS != err) { return err; } diff --git a/ompi/mca/coll/base/coll_base_alltoallv.c b/ompi/mca/coll/base/coll_base_alltoallv.c index bf12732d3f2..83528834134 100644 --- a/ompi/mca/coll/base/coll_base_alltoallv.c +++ b/ompi/mca/coll/base/coll_base_alltoallv.c @@ -50,7 +50,7 @@ * and count) to send the data to the other. */ int -mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts, const int *rdisps, +mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -72,7 +72,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts if (i == rank) { continue; } - packed_size = rcounts[i] * type_size; + packed_size = ompi_count_array_get(rcounts, i) * type_size; max_size = opal_max(packed_size, max_size); } @@ -111,11 +111,11 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts right = (rank + i) % size; left = (rank + size - i) % size; - if( 0 != rcounts[right] ) { /* nothing to exchange with the peer on the right */ + if( 0 != ompi_count_array_get(rcounts, right) ) { /* nothing to exchange with the peer on the right */ ompi_proc_t *right_proc = ompi_comm_peer_lookup(comm, right); opal_convertor_clone(right_proc->super.proc_convertor, &convertor, 0); - opal_convertor_prepare_for_send(&convertor, &rdtype->super, rcounts[right], - (char *) rbuf + rdisps[right] * extent); + opal_convertor_prepare_for_send(&convertor, &rdtype->super, ompi_count_array_get(rcounts, right), + (char *) rbuf + ompi_disp_array_get(rdisps, right) * extent); packed_size = max_size; err = opal_convertor_pack(&convertor, &iov, &iov_count, &packed_size); if (1 != err) { @@ -124,7 +124,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts } /* Receive data from the right */ - err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[right] * extent, rcounts[right], rdtype, + err = MCA_PML_CALL(irecv ((char *) rbuf + ompi_disp_array_get(rdisps, right) * extent, + ompi_count_array_get(rcounts, right), rdtype, right, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req)); if (MPI_SUCCESS != err) { line = __LINE__; @@ -132,9 +133,10 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts } } - if( (left != right) && (0 != rcounts[left]) ) { + if( (left != right) && (0 != ompi_count_array_get(rcounts, left)) ) { /* Send data to the left */ - err = MCA_PML_CALL(send ((char *) rbuf + rdisps[left] * extent, rcounts[left], rdtype, + err = MCA_PML_CALL(send ((char *) rbuf + ompi_disp_array_get(rdisps, left) * extent, + ompi_count_array_get(rcounts, left), rdtype, left, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { @@ -149,7 +151,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts } /* Receive data from the left */ - err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[left] * extent, rcounts[left], rdtype, + err = MCA_PML_CALL(irecv ((char *) rbuf + ompi_disp_array_get(rdisps, left) * extent, + ompi_count_array_get(rcounts, left), rdtype, left, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req)); if (MPI_SUCCESS != err) { line = __LINE__; @@ -157,7 +160,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts } } - if( 0 != rcounts[right] ) { /* nothing to exchange with the peer on the right */ + if( 0 != ompi_count_array_get(rcounts, right) ) { /* nothing to exchange with the peer on the right */ /* Send data to the right */ err = MCA_PML_CALL(send ((char *) tmp_buffer, packed_size, MPI_PACKED, right, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, @@ -191,9 +194,9 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts } int -ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, const int *scounts, const int *sdisps, +ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -230,12 +233,12 @@ ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, const int *scounts, co recvfrom = (rank + size - step) % size; /* Determine sending and receiving locations */ - psnd = (char*)sbuf + (ptrdiff_t)sdisps[sendto] * sext; - prcv = (char*)rbuf + (ptrdiff_t)rdisps[recvfrom] * rext; + psnd = (char*)sbuf + ompi_disp_array_get(sdisps, sendto) * sext; + prcv = (char*)rbuf + ompi_disp_array_get(rdisps, recvfrom) * rext; /* send and receive */ - if (0 < rcounts[recvfrom] && 0 < rdtype_size) { - err = MCA_PML_CALL(irecv(prcv, rcounts[recvfrom], rdtype, recvfrom, + if (0 < ompi_count_array_get(rcounts, recvfrom) && 0 < rdtype_size) { + err = MCA_PML_CALL(irecv(prcv, ompi_count_array_get(rcounts, recvfrom), rdtype, recvfrom, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req)); if (MPI_SUCCESS != err) { line = __LINE__; @@ -243,8 +246,8 @@ ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, const int *scounts, co } } - if (0 < scounts[sendto] && 0 < sdtype_size) { - err = MCA_PML_CALL(send(psnd, scounts[sendto], sdtype, sendto, + if (0 < ompi_count_array_get(scounts, sendto) && 0 < sdtype_size) { + err = MCA_PML_CALL(send(psnd, ompi_count_array_get(scounts, sendto), sdtype, sendto, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { line = __LINE__; @@ -280,9 +283,9 @@ ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, const int *scounts, co * differently and so will not have to duplicate code. */ int -ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts, const int *sdisps, +ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -313,11 +316,11 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts ompi_datatype_type_extent(rdtype, &rext); /* Simple optimization - handle send to self first */ - psnd = ((char *) sbuf) + (ptrdiff_t)sdisps[rank] * sext; - prcv = ((char *) rbuf) + (ptrdiff_t)rdisps[rank] * rext; - if (0 < scounts[rank] && 0 < sdtype_size) { - err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtype, - prcv, rcounts[rank], rdtype); + psnd = ((char *) sbuf) + ompi_disp_array_get(sdisps, rank) * sext; + prcv = ((char *) rbuf) + ompi_disp_array_get(rdisps, rank) * rext; + if (0 < ompi_count_array_get(scounts, rank) && 0 < sdtype_size) { + err = ompi_datatype_sndrcv(psnd, ompi_count_array_get(scounts, rank), sdtype, + prcv, ompi_count_array_get(rcounts, rank), rdtype); if (MPI_SUCCESS != err) { return err; } @@ -339,10 +342,10 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts continue; } - if (0 < rcounts[i] && 0 < rdtype_size) { + if (0 < ompi_count_array_get(rcounts, i) && 0 < rdtype_size) { ++nreqs; - prcv = ((char *) rbuf) + (ptrdiff_t)rdisps[i] * rext; - err = MCA_PML_CALL(irecv_init(prcv, rcounts[i], rdtype, + prcv = ((char *) rbuf) + ompi_disp_array_get(rdisps, i) * rext; + err = MCA_PML_CALL(irecv_init(prcv, ompi_count_array_get(rcounts, i), rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, preq++)); if (MPI_SUCCESS != err) { goto err_hndl; } @@ -355,10 +358,10 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts continue; } - if (0 < scounts[i] && 0 < sdtype_size) { + if (0 < ompi_count_array_get(scounts, i) && 0 < sdtype_size) { ++nreqs; - psnd = ((char *) sbuf) + (ptrdiff_t)sdisps[i] * sext; - err = MCA_PML_CALL(isend_init(psnd, scounts[i], sdtype, + psnd = ((char *) sbuf) + ompi_disp_array_get(sdisps, i) * sext; + err = MCA_PML_CALL(isend_init(psnd, ompi_count_array_get(scounts, i), sdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); diff --git a/ompi/mca/coll/base/coll_base_functions.h b/ompi/mca/coll/base/coll_base_functions.h index ae924de5d31..aec47d2b22a 100644 --- a/ompi/mca/coll/base/coll_base_functions.h +++ b/ompi/mca/coll/base/coll_base_functions.h @@ -69,27 +69,27 @@ typedef enum COLLTYPE { /* defined arg lists to simply auto inclusion of user overriding decision functions */ #define ALLGATHER_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm -#define ALLGATHERV_BASE_ARGS const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int displs[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm +#define ALLGATHERV_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm #define ALLREDUCE_BASE_ARGS const void *sendbuf, void *recvbuf, size_t count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm #define ALLTOALL_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm -#define ALLTOALLV_BASE_ARGS const void *sendbuf, const int sendcounts[], const int sdispls[], struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int rdispls[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm -#define ALLTOALLW_BASE_ARGS const void *sendbuf, const int sendcounts[], const int sdispls[], struct ompi_datatype_t * const sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], struct ompi_datatype_t * const recvtypes[], struct ompi_communicator_t *comm +#define ALLTOALLV_BASE_ARGS const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t *sendtype, void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm +#define ALLTOALLW_BASE_ARGS const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t * const sendtypes[], void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const recvtypes[], struct ompi_communicator_t *comm #define BARRIER_BASE_ARGS struct ompi_communicator_t *comm #define BCAST_BASE_ARGS void *buffer, size_t count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm #define EXSCAN_BASE_ARGS const void *sendbuf, void *recvbuf, size_t count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm #define GATHER_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm -#define GATHERV_BASE_ARGS const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int displs[], struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm +#define GATHERV_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm #define REDUCE_BASE_ARGS const void *sendbuf, void *recvbuf, size_t count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm -#define REDUCESCATTER_BASE_ARGS const void *sendbuf, void *recvbuf, const int recvcounts[], struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm +#define REDUCESCATTER_BASE_ARGS const void *sendbuf, void *recvbuf, ompi_count_array *recvcounts, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm #define REDUCESCATTERBLOCK_BASE_ARGS const void *sendbuf, void *recvbuf, size_t recvcount, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm #define SCAN_BASE_ARGS const void *sendbuf, void *recvbuf, size_t count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm #define SCATTER_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm -#define SCATTERV_BASE_ARGS const void *sendbuf, const int sendcounts[], const int displs[], struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm +#define SCATTERV_BASE_ARGS const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm #define NEIGHBOR_ALLGATHER_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm -#define NEIGHBOR_ALLGATHERV_BASE_ARGS const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int displs[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm +#define NEIGHBOR_ALLGATHERV_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm #define NEIGHBOR_ALLTOALL_BASE_ARGS const void *sendbuf, size_t sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, size_t recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm -#define NEIGHBOR_ALLTOALLV_BASE_ARGS const void *sendbuf, const int sendcounts[], const int sdispls[], struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int rdispls[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm -#define NEIGHBOR_ALLTOALLW_BASE_ARGS const void *sendbuf, const int sendcounts[], const MPI_Aint sdispls[], struct ompi_datatype_t * const sendtypes[], void *recvbuf, const int recvcounts[], const MPI_Aint rdispls[], struct ompi_datatype_t * const recvtypes[], struct ompi_communicator_t *comm +#define NEIGHBOR_ALLTOALLV_BASE_ARGS const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t *sendtype, void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm +#define NEIGHBOR_ALLTOALLW_BASE_ARGS const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t * const sendtypes[], void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const recvtypes[], struct ompi_communicator_t *comm #define ALLGATHER_ARGS ALLGATHER_BASE_ARGS, mca_coll_base_module_t *module #define ALLGATHERV_ARGS ALLGATHERV_BASE_ARGS, mca_coll_base_module_t *module @@ -227,7 +227,7 @@ int mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, size_t rcount, /* AlltoAllV */ int ompi_coll_base_alltoallv_intra_pairwise(ALLTOALLV_ARGS); int ompi_coll_base_alltoallv_intra_basic_linear(ALLTOALLV_ARGS); -int mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts, const int *rdisps, +int mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); /* special version for INPLACE */ diff --git a/ompi/mca/coll/base/coll_base_reduce_scatter.c b/ompi/mca/coll/base/coll_base_reduce_scatter.c index 4799200d96a..bf0f38dda18 100644 --- a/ompi/mca/coll/base/coll_base_reduce_scatter.c +++ b/ompi/mca/coll/base/coll_base_reduce_scatter.c @@ -45,13 +45,15 @@ * appropriate scatterv call. */ int ompi_coll_base_reduce_scatter_intra_nonoverlapping(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int err, i, rank, size, total_count, *displs = NULL; + int err, i, rank, size, total_count; + ptrdiff_t *displs = NULL; + ompi_disp_array displs_arg; const int root = 0; char *tmprbuf = NULL, *tmprbuf_free = NULL; @@ -60,7 +62,7 @@ int ompi_coll_base_reduce_scatter_intra_nonoverlapping(const void *sbuf, void *r OPAL_OUTPUT((ompi_coll_base_framework.framework_output,"coll:base:reduce_scatter_intra_nonoverlapping, rank %d", rank)); - for (i = 0, total_count = 0; i < size; i++) { total_count += rcounts[i]; } + for (i = 0, total_count = 0; i < size; i++) { total_count += ompi_count_array_get(rcounts, i); } /* Reduce to rank 0 (root) and scatterv */ tmprbuf = (char*) rbuf; @@ -91,18 +93,19 @@ int ompi_coll_base_reduce_scatter_intra_nonoverlapping(const void *sbuf, void *r return err; } - displs = (int*) malloc(size * sizeof(int)); + displs = (ptrdiff_t*) malloc(size * sizeof(ptrdiff_t)); displs[0] = 0; for (i = 1; i < size; i++) { - displs[i] = displs[i-1] + rcounts[i-1]; + displs[i] = displs[i-1] + ompi_count_array_get(rcounts, i-1); } + OMPI_DISP_ARRAY_INIT(&displs_arg, displs); if (MPI_IN_PLACE == sbuf && root == rank) { - err = comm->c_coll->coll_scatterv (tmprbuf, rcounts, displs, dtype, + err = comm->c_coll->coll_scatterv (tmprbuf, rcounts, &displs_arg, dtype, MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, root, comm, comm->c_coll->coll_scatterv_module); } else { - err = comm->c_coll->coll_scatterv (tmprbuf, rcounts, displs, dtype, - rbuf, rcounts[rank], dtype, + err = comm->c_coll->coll_scatterv (tmprbuf, rcounts, &displs_arg, dtype, + rbuf, ompi_count_array_get(rcounts, rank), dtype, root, comm, comm->c_coll->coll_scatterv_module); } free(displs); @@ -131,14 +134,16 @@ int ompi_coll_base_reduce_scatter_intra_nonoverlapping(const void *sbuf, void *r int ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int i, rank, size, count, err = OMPI_SUCCESS; - int tmp_size, remain = 0, tmp_rank, *disps = NULL; + int i, rank, size, err = OMPI_SUCCESS; + int tmp_size, remain = 0, tmp_rank; + size_t count; + ptrdiff_t *disps = NULL; ptrdiff_t extent, buf_size, gap = 0; char *recv_buf = NULL, *recv_buf_free = NULL; char *result_buf = NULL, *result_buf_free = NULL; @@ -150,14 +155,14 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, OPAL_OUTPUT((ompi_coll_base_framework.framework_output,"coll:base:reduce_scatter_intra_basic_recursivehalving, rank %d", rank)); /* Find displacements and the like */ - disps = (int*) malloc(sizeof(int) * size); + disps = (ptrdiff_t*) malloc(sizeof(ptrdiff_t) * size); if (NULL == disps) return OMPI_ERR_OUT_OF_RESOURCE; disps[0] = 0; for (i = 0; i < (size - 1); ++i) { - disps[i + 1] = disps[i] + rcounts[i]; + disps[i + 1] = disps[i] + ompi_count_array_get(rcounts, i); } - count = disps[size - 1] + rcounts[size - 1]; + count = disps[size - 1] + ompi_count_array_get(rcounts, size - 1); /* short cut the trivial case */ if (0 == count) { @@ -230,18 +235,19 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, /* For ranks not kicked out by the above code, perform the recursive halving */ if (tmp_rank >= 0) { - int *tmp_disps = NULL, *tmp_rcounts = NULL; + size_t *tmp_rcounts = NULL; + ptrdiff_t *tmp_disps = NULL; int mask, send_index, recv_index, last_index; /* recalculate disps and rcounts to account for the special "remainder" processes that are no longer doing anything */ - tmp_rcounts = (int*) malloc(tmp_size * sizeof(int)); + tmp_rcounts = (size_t*) malloc(tmp_size * sizeof(size_t)); if (NULL == tmp_rcounts) { err = OMPI_ERR_OUT_OF_RESOURCE; goto cleanup; } - tmp_disps = (int*) malloc(tmp_size * sizeof(int)); + tmp_disps = (ptrdiff_t*) malloc(tmp_size * sizeof(ptrdiff_t)); if (NULL == tmp_disps) { free(tmp_rcounts); err = OMPI_ERR_OUT_OF_RESOURCE; @@ -251,9 +257,9 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, for (i = 0 ; i < tmp_size ; ++i) { if (i < remain) { /* need to include old neighbor as well */ - tmp_rcounts[i] = rcounts[i * 2 + 1] + rcounts[i * 2]; + tmp_rcounts[i] = ompi_count_array_get(rcounts, i * 2 + 1) + ompi_count_array_get(rcounts, i * 2); } else { - tmp_rcounts[i] = rcounts[i + remain]; + tmp_rcounts[i] = ompi_count_array_get(rcounts, i + remain); } } @@ -270,7 +276,8 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, send_index = recv_index = 0; last_index = tmp_size; while (mask > 0) { - int tmp_peer, peer, send_count, recv_count; + int tmp_peer, peer; + size_t send_count, recv_count; struct ompi_request_t *request; tmp_peer = tmp_rank ^ mask; @@ -299,7 +306,7 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, /* actual data transfer. Send from result_buf, receive into recv_buf */ if (recv_count > 0) { - err = MCA_PML_CALL(irecv(recv_buf + (ptrdiff_t)tmp_disps[recv_index] * extent, + err = MCA_PML_CALL(irecv(recv_buf + tmp_disps[recv_index] * extent, recv_count, dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, &request)); @@ -310,7 +317,7 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, } } if (send_count > 0) { - err = MCA_PML_CALL(send(result_buf + (ptrdiff_t)tmp_disps[send_index] * extent, + err = MCA_PML_CALL(send(result_buf + tmp_disps[send_index] * extent, send_count, dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, MCA_PML_BASE_SEND_STANDARD, @@ -333,8 +340,8 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, } ompi_op_reduce(op, - recv_buf + (ptrdiff_t)tmp_disps[recv_index] * extent, - result_buf + (ptrdiff_t)tmp_disps[recv_index] * extent, + recv_buf + tmp_disps[recv_index] * extent, + result_buf + tmp_disps[recv_index] * extent, recv_count, dtype); } @@ -345,10 +352,10 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, } /* copy local results from results buffer into real receive buffer */ - if (0 != rcounts[rank]) { + if (0 != ompi_count_array_get(rcounts, rank)) { err = ompi_datatype_sndrcv(result_buf + disps[rank] * extent, - rcounts[rank], dtype, - rbuf, rcounts[rank], dtype); + ompi_count_array_get(rcounts, rank), dtype, + rbuf, ompi_count_array_get(rcounts, rank), dtype); if (OMPI_SUCCESS != err) { free(tmp_rcounts); free(tmp_disps); @@ -364,16 +371,16 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, procs send the even procs the proper results */ if (rank < (2 * remain)) { if ((rank & 1) == 0) { - if (rcounts[rank]) { - err = MCA_PML_CALL(recv(rbuf, rcounts[rank], dtype, rank + 1, + if (ompi_count_array_get(rcounts, rank)) { + err = MCA_PML_CALL(recv(rbuf, ompi_count_array_get(rcounts, rank), dtype, rank + 1, MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE)); if (OMPI_SUCCESS != err) goto cleanup; } } else { - if (rcounts[rank - 1]) { + if (ompi_count_array_get(rcounts, rank - 1)) { err = MCA_PML_CALL(send(result_buf + disps[rank - 1] * extent, - rcounts[rank - 1], dtype, rank - 1, + ompi_count_array_get(rcounts, rank - 1), dtype, rank - 1, MCA_COLL_BASE_TAG_REDUCE_SCATTER, MCA_PML_BASE_SEND_STANDARD, comm)); @@ -453,14 +460,16 @@ ompi_coll_base_reduce_scatter_intra_basic_recursivehalving( const void *sbuf, * */ int -ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const int *rcounts, +ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int ret, line, rank, size, i, k, recv_from, send_to, total_count, max_block_count; - int inbi, *displs = NULL; + int ret, line, rank, size, i, k, recv_from, send_to; + int inbi; + size_t total_count, max_block_count; + ptrdiff_t *displs = NULL; char *tmpsend = NULL, *tmprecv = NULL, *accumbuf = NULL, *accumbuf_free = NULL; char *inbuf_free[2] = {NULL, NULL}, *inbuf[2] = {NULL, NULL}; ptrdiff_t extent, max_real_segsize, dsize, gap = 0; @@ -476,15 +485,15 @@ ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const in /* Determine the maximum number of elements per node, corresponding block size, and displacements array. */ - displs = (int*) malloc(size * sizeof(int)); + displs = (ptrdiff_t*) malloc(size * sizeof(ptrdiff_t)); if (NULL == displs) { ret = -1; line = __LINE__; goto error_hndl; } displs[0] = 0; - total_count = rcounts[0]; - max_block_count = rcounts[0]; + total_count = ompi_count_array_get(rcounts, 0); + max_block_count = ompi_count_array_get(rcounts, 0); for (i = 1; i < size; i++) { displs[i] = total_count; - total_count += rcounts[i]; - if (max_block_count < rcounts[i]) max_block_count = rcounts[i]; + total_count += ompi_count_array_get(rcounts, i); + if (max_block_count < ompi_count_array_get(rcounts, i)) max_block_count = ompi_count_array_get(rcounts, i); } /* Special case for size == 1 */ @@ -557,8 +566,8 @@ ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const in MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, &reqs[inbi])); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - tmpsend = accumbuf + (ptrdiff_t)displs[recv_from] * extent; - ret = MCA_PML_CALL(send(tmpsend, rcounts[recv_from], dtype, send_to, + tmpsend = accumbuf + displs[recv_from] * extent; + ret = MCA_PML_CALL(send(tmpsend, ompi_count_array_get(rcounts, recv_from), dtype, send_to, MCA_COLL_BASE_TAG_REDUCE_SCATTER, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } @@ -581,11 +590,11 @@ ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const in /* Apply operation on previous block: result goes to rbuf rbuf[prevblock] = inbuf[inbi ^ 0x1] (op) rbuf[prevblock] */ - tmprecv = accumbuf + (ptrdiff_t)displs[prevblock] * extent; - ompi_op_reduce(op, inbuf[inbi ^ 0x1], tmprecv, rcounts[prevblock], dtype); + tmprecv = accumbuf + displs[prevblock] * extent; + ompi_op_reduce(op, inbuf[inbi ^ 0x1], tmprecv, ompi_count_array_get(rcounts, prevblock), dtype); /* send previous block to send_to */ - ret = MCA_PML_CALL(send(tmprecv, rcounts[prevblock], dtype, send_to, + ret = MCA_PML_CALL(send(tmprecv, ompi_count_array_get(rcounts, prevblock), dtype, send_to, MCA_COLL_BASE_TAG_REDUCE_SCATTER, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } @@ -597,11 +606,12 @@ ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const in /* Apply operation on the last block (my block) rbuf[rank] = inbuf[inbi] (op) rbuf[rank] */ - tmprecv = accumbuf + (ptrdiff_t)displs[rank] * extent; - ompi_op_reduce(op, inbuf[inbi], tmprecv, rcounts[rank], dtype); + tmprecv = accumbuf + displs[rank] * extent; + ompi_op_reduce(op, inbuf[inbi], tmprecv, ompi_count_array_get(rcounts, rank), dtype); /* Copy result from tmprecv to rbuf */ - ret = ompi_datatype_copy_content_same_ddt(dtype, rcounts[rank], (char *)rbuf, tmprecv); + ret = ompi_datatype_copy_content_same_ddt(dtype, ompi_count_array_get(rcounts, rank), + (char *)rbuf, tmprecv); if (ret < 0) { line = __LINE__; goto error_hndl; } if (NULL != displs) free(displs); @@ -626,12 +636,12 @@ ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const in * ompi_sum_counts: Returns sum of counts [lo, hi] * lo, hi in {0, 1, ..., nprocs_pof2 - 1} */ -static int ompi_sum_counts(const int *counts, int *displs, int nprocs_rem, int lo, int hi) +static size_t ompi_sum_counts(ompi_count_array *counts, ptrdiff_t *displs, int nprocs_rem, int lo, int hi) { /* Adjust lo and hi for taking into account blocks of excluded processes */ lo = (lo < nprocs_rem) ? lo * 2 : lo + nprocs_rem; hi = (hi < nprocs_rem) ? hi * 2 + 1 : hi + nprocs_rem; - return displs[hi] + counts[hi] - displs[lo]; + return displs[hi] + ompi_count_array_get(counts, hi) - displs[lo]; } /* @@ -689,12 +699,12 @@ static int ompi_sum_counts(const int *counts, int *displs, int nprocs_rem, int l */ int ompi_coll_base_reduce_scatter_intra_butterfly( - const void *sbuf, void *rbuf, const int *rcounts, struct ompi_datatype_t *dtype, + const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { char *tmpbuf[2] = {NULL, NULL}, *psend, *precv; - int *displs = NULL, index; + ptrdiff_t *displs = NULL, index; ptrdiff_t span, gap, totalcount, extent; int err = MPI_SUCCESS; int comm_size = ompi_comm_size(comm); @@ -713,9 +723,9 @@ ompi_coll_base_reduce_scatter_intra_butterfly( } displs[0] = 0; for (int i = 1; i < comm_size; i++) { - displs[i] = displs[i - 1] + rcounts[i - 1]; + displs[i] = displs[i - 1] + ompi_count_array_get(rcounts, i - 1); } - totalcount = displs[comm_size - 1] + rcounts[comm_size - 1]; + totalcount = displs[comm_size - 1] + ompi_count_array_get(rcounts, comm_size - 1); ompi_datatype_type_extent(dtype, &extent); span = opal_datatype_span(&dtype->super, totalcount, &gap); @@ -807,35 +817,35 @@ ompi_coll_base_reduce_scatter_intra_butterfly( } /* Send blocks: [send_index, send_index + nblocks - 1] */ - int send_count = ompi_sum_counts(rcounts, displs, nprocs_rem, - send_index, send_index + nblocks - 1); + size_t send_count = ompi_sum_counts(rcounts, displs, nprocs_rem, + send_index, send_index + nblocks - 1); index = (send_index < nprocs_rem) ? 2 * send_index : nprocs_rem + send_index; ptrdiff_t sdispl = displs[index]; /* Recv blocks: [recv_index, recv_index + nblocks - 1] */ - int recv_count = ompi_sum_counts(rcounts, displs, nprocs_rem, - recv_index, recv_index + nblocks - 1); + size_t recv_count = ompi_sum_counts(rcounts, displs, nprocs_rem, + recv_index, recv_index + nblocks - 1); index = (recv_index < nprocs_rem) ? 2 * recv_index : nprocs_rem + recv_index; ptrdiff_t rdispl = displs[index]; - err = ompi_coll_base_sendrecv(psend + (ptrdiff_t)sdispl * extent, send_count, + err = ompi_coll_base_sendrecv(psend + sdispl * extent, send_count, dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, - precv + (ptrdiff_t)rdispl * extent, recv_count, + precv + rdispl * extent, recv_count, dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE, rank); if (MPI_SUCCESS != err) { goto cleanup_and_return; } if (vrank < vpeer) { /* precv = psend precv */ - ompi_op_reduce(op, psend + (ptrdiff_t)rdispl * extent, - precv + (ptrdiff_t)rdispl * extent, recv_count, dtype); + ompi_op_reduce(op, psend + rdispl * extent, + precv + rdispl * extent, recv_count, dtype); char *p = psend; psend = precv; precv = p; } else { /* psend = precv psend */ - ompi_op_reduce(op, precv + (ptrdiff_t)rdispl * extent, - psend + (ptrdiff_t)rdispl * extent, recv_count, dtype); + ompi_op_reduce(op, precv + rdispl * extent, + psend + rdispl * extent, recv_count, dtype); } send_index = recv_index; } @@ -852,8 +862,8 @@ ompi_coll_base_reduce_scatter_intra_butterfly( * Process has two blocks: for excluded process and own. * Send the first block to excluded process. */ - err = MCA_PML_CALL(send(psend + (ptrdiff_t)displs[index] * extent, - rcounts[index], dtype, peer - 1, + err = MCA_PML_CALL(send(psend + displs[index] * extent, + ompi_count_array_get(rcounts, index), dtype, peer - 1, MCA_COLL_BASE_TAG_REDUCE_SCATTER, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { goto cleanup_and_return; } @@ -863,16 +873,16 @@ ompi_coll_base_reduce_scatter_intra_butterfly( if (vpeer < nprocs_rem) index++; if (vpeer != vrank) { - err = ompi_coll_base_sendrecv(psend + (ptrdiff_t)displs[index] * extent, - rcounts[index], dtype, peer, + err = ompi_coll_base_sendrecv(psend + displs[index] * extent, + ompi_count_array_get(rcounts, index), dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, - rbuf, rcounts[rank], dtype, peer, + rbuf, ompi_count_array_get(rcounts, rank), dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE, rank); if (MPI_SUCCESS != err) { goto cleanup_and_return; } } else { - err = ompi_datatype_copy_content_same_ddt(dtype, rcounts[rank], rbuf, - psend + (ptrdiff_t)displs[rank] * extent); + err = ompi_datatype_copy_content_same_ddt(dtype, ompi_count_array_get(rcounts, rank), rbuf, + psend + displs[rank] * extent); if (MPI_SUCCESS != err) { goto cleanup_and_return; } } @@ -880,11 +890,11 @@ ompi_coll_base_reduce_scatter_intra_butterfly( /* Excluded process: receive result */ int vpeer = ompi_mirror_perm((rank + 1) / 2, log2_size); int peer = (vpeer < nprocs_rem) ? vpeer * 2 + 1 : vpeer + nprocs_rem; - err = MCA_PML_CALL(recv(rbuf, rcounts[rank], dtype, peer, + err = MCA_PML_CALL(recv(rbuf, ompi_count_array_get(rcounts, rank), dtype, peer, MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE)); if (OMPI_SUCCESS != err) { goto cleanup_and_return; } - } + } cleanup_and_return: if (displs) diff --git a/ompi/mca/coll/basic/coll_basic.h b/ompi/mca/coll/basic/coll_basic.h index 5875436ba63..e86b9cb7865 100644 --- a/ompi/mca/coll/basic/coll_basic.h +++ b/ompi/mca/coll/basic/coll_basic.h @@ -60,10 +60,10 @@ BEGIN_C_DECLS struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_allgatherv_inter(const void *sbuf, int scount, + int mca_coll_basic_allgatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *disps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -86,28 +86,28 @@ BEGIN_C_DECLS struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_alltoallv_inter(const void *sbuf, const int *scounts, - const int *sdisps, + int mca_coll_basic_alltoallv_inter(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_alltoallw_intra(const void *sbuf, const int *scounts, - const int *sdisps, + int mca_coll_basic_alltoallw_intra(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_alltoallw_inter(const void *sbuf, const int *scounts, - const int *sdisps, + int mca_coll_basic_alltoallw_inter(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -138,17 +138,17 @@ BEGIN_C_DECLS struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_gatherv_intra(const void *sbuf, int scount, + int mca_coll_basic_gatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_gatherv_inter(const void *sbuf, int scount, + int mca_coll_basic_gatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -183,14 +183,14 @@ BEGIN_C_DECLS mca_coll_base_module_t *module); int mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); int mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -210,16 +210,16 @@ BEGIN_C_DECLS struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts, const int *disps, + int mca_coll_basic_scatterv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_scatterv_inter(const void *sbuf, const int *scounts, const int *disps, + int mca_coll_basic_scatterv_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -231,22 +231,22 @@ BEGIN_C_DECLS struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_neighbor_allgatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int rcounts[], const int disps[], struct ompi_datatype_t *rdtype, + int mca_coll_basic_neighbor_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); int mca_coll_basic_neighbor_alltoall(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_neighbor_alltoallv(const void *sbuf, const int scounts[], const int sdisps[], - struct ompi_datatype_t *sdtype, void *rbuf, const int rcounts[], - const int rdisps[], struct ompi_datatype_t *rdtype, + int mca_coll_basic_neighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t *sdtype, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_basic_neighbor_alltoallw(const void *sbuf, const int scounts[], const MPI_Aint sdisps[], - struct ompi_datatype_t * const *sdtypes, void *rbuf, const int rcounts[], - const MPI_Aint rdisps[], struct ompi_datatype_t * const *rdtypes, + int mca_coll_basic_neighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t * const *sdtypes, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); diff --git a/ompi/mca/coll/basic/coll_basic_allgatherv.c b/ompi/mca/coll/basic/coll_basic_allgatherv.c index 3009bfcae5d..fc34b3ace7d 100644 --- a/ompi/mca/coll/basic/coll_basic_allgatherv.c +++ b/ompi/mca/coll/basic/coll_basic_allgatherv.c @@ -38,20 +38,23 @@ * Returns: - MPI_SUCCESS or error code */ int -mca_coll_basic_allgatherv_inter(const void *sbuf, int scount, +mca_coll_basic_allgatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { int rsize, err, i; - int *scounts, *sdisps; + size_t *scounts; + ptrdiff_t *sdisps; + ompi_count_array scounts_desc; + ompi_disp_array sdisps_desc; rsize = ompi_comm_remote_size(comm); - scounts = (int *) malloc(2 * rsize * sizeof(int)); - sdisps = scounts + rsize; + scounts = (size_t *) malloc(rsize * sizeof(size_t) + rsize * sizeof(ptrdiff_t)); + sdisps = (ptrdiff_t *) (scounts + rsize); if (NULL == scounts) { return OMPI_ERR_OUT_OF_RESOURCE; } @@ -61,7 +64,9 @@ mca_coll_basic_allgatherv_inter(const void *sbuf, int scount, sdisps[i] = 0; } - err = comm->c_coll->coll_alltoallv(sbuf, scounts, sdisps, sdtype, + OMPI_COUNT_ARRAY_INIT(&scounts_desc, scounts); + OMPI_DISP_ARRAY_INIT(&sdisps_desc, sdisps); + err = comm->c_coll->coll_alltoallv(sbuf, &scounts_desc, &sdisps_desc, sdtype, rbuf, rcounts, disps, rdtype, comm, comm->c_coll->coll_alltoallv_module); diff --git a/ompi/mca/coll/basic/coll_basic_alltoallv.c b/ompi/mca/coll/basic/coll_basic_alltoallv.c index 26e585ce2e8..c2b48cc26e1 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallv.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallv.c @@ -42,9 +42,9 @@ * Returns: - MPI_SUCCESS or an MPI error code */ int -mca_coll_basic_alltoallv_inter(const void *sbuf, const int *scounts, const int *sdisps, +mca_coll_basic_alltoallv_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, void *rbuf, - const int *rcounts, const int *rdisps, + ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -75,9 +75,9 @@ mca_coll_basic_alltoallv_inter(const void *sbuf, const int *scounts, const int * /* Post all receives first */ /* A simple optimization: do not send and recv msgs of length zero */ for (i = 0; i < rsize; ++i) { - prcv = ((char *) rbuf) + (rdisps[i] * rcvextent); - if (rcounts[i] > 0) { - err = MCA_PML_CALL(irecv(prcv, rcounts[i], rdtype, + prcv = ((char *) rbuf) + (ompi_disp_array_get(rdisps, i) * rcvextent); + if (ompi_count_array_get(rcounts, i) > 0) { + err = MCA_PML_CALL(irecv(prcv, ompi_count_array_get(rcounts, i), rdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &preq[i])); if (MPI_SUCCESS != err) { @@ -89,9 +89,9 @@ mca_coll_basic_alltoallv_inter(const void *sbuf, const int *scounts, const int * /* Now post all sends */ for (i = 0; i < rsize; ++i) { - psnd = ((char *) sbuf) + (sdisps[i] * sndextent); - if (scounts[i] > 0) { - err = MCA_PML_CALL(isend(psnd, scounts[i], sdtype, + psnd = ((char *) sbuf) + (ompi_disp_array_get(sdisps, i) * sndextent); + if (ompi_count_array_get(scounts, i) > 0) { + err = MCA_PML_CALL(isend(psnd, ompi_count_array_get(scounts, i), sdtype, i, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm, &preq[rsize + i])); diff --git a/ompi/mca/coll/basic/coll_basic_alltoallw.c b/ompi/mca/coll/basic/coll_basic_alltoallw.c index 0f8a2dae144..1e1861b89d2 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallw.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallw.c @@ -45,7 +45,7 @@ * and count) to send the data to the other. */ static int -mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, const int *rdisps, +mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -79,7 +79,7 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con #else opal_datatype_type_size(&rdtypes[right]->super, &packed_size); #endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */ - packed_size *= rcounts[right]; + packed_size *= ompi_count_array_get(rcounts, right); max_size = packed_size > max_size ? packed_size : max_size; } @@ -97,29 +97,31 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con left = (rank + size - i) % size; ompi_datatype_type_size(rdtypes[right], &msg_size_right); - msg_size_right *= rcounts[right]; + msg_size_right *= ompi_count_array_get(rcounts, right); ompi_datatype_type_size(rdtypes[left], &msg_size_left); - msg_size_left *= rcounts[left]; + msg_size_left *= ompi_count_array_get(rcounts, left); if( 0 != msg_size_right ) { /* nothing to exchange with the peer on the right */ ompi_proc_t *right_proc = ompi_comm_peer_lookup(comm, right); opal_convertor_clone(right_proc->super.proc_convertor, &convertor, 0); - opal_convertor_prepare_for_send(&convertor, &rdtypes[right]->super, rcounts[right], - (char *) rbuf + rdisps[right]); + opal_convertor_prepare_for_send(&convertor, &rdtypes[right]->super, ompi_count_array_get(rcounts, right), + (char *) rbuf + ompi_disp_array_get(rdisps, right)); packed_size = max_size; err = opal_convertor_pack(&convertor, &iov, &iov_count, &packed_size); if (1 != err) { goto error_hndl; } /* Receive data from the right */ - err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[right], rcounts[right], rdtypes[right], + err = MCA_PML_CALL(irecv ((char *) rbuf + ompi_disp_array_get(rdisps, right), + ompi_count_array_get(rcounts, right), rdtypes[right], right, MCA_COLL_BASE_TAG_ALLTOALLW, comm, &req)); if (MPI_SUCCESS != err) { goto error_hndl; } } if( (left != right) && (0 != msg_size_left) ) { /* Send data to the left */ - err = MCA_PML_CALL(send ((char *) rbuf + rdisps[left], rcounts[left], rdtypes[left], + err = MCA_PML_CALL(send ((char *) rbuf + ompi_disp_array_get(rdisps, left), + ompi_count_array_get(rcounts, left), rdtypes[left], left, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { goto error_hndl; } @@ -128,7 +130,8 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con if (MPI_SUCCESS != err) { goto error_hndl; } /* Receive data from the left */ - err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[left], rcounts[left], rdtypes[left], + err = MCA_PML_CALL(irecv ((char *) rbuf + ompi_disp_array_get(rdisps, left), + ompi_count_array_get(rcounts, left), rdtypes[left], left, MCA_COLL_BASE_TAG_ALLTOALLW, comm, &req)); if (MPI_SUCCESS != err) { goto error_hndl; } } @@ -163,9 +166,9 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con * Returns: - MPI_SUCCESS or an MPI error code */ int -mca_coll_basic_alltoallw_intra(const void *sbuf, const int *scounts, const int *sdisps, +mca_coll_basic_alltoallw_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -185,11 +188,11 @@ mca_coll_basic_alltoallw_intra(const void *sbuf, const int *scounts, const int * /* simple optimization */ - psnd = ((char *) sbuf) + sdisps[rank]; - prcv = ((char *) rbuf) + rdisps[rank]; + psnd = ((char *) sbuf) + ompi_disp_array_get(sdisps, rank); + prcv = ((char *) rbuf) + ompi_disp_array_get(rdisps, rank); - err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtypes[rank], - prcv, rcounts[rank], rdtypes[rank]); + err = ompi_datatype_sndrcv(psnd, ompi_count_array_get(scounts, rank), sdtypes[rank], + prcv, ompi_count_array_get(rcounts, rank), rdtypes[rank]); if (MPI_SUCCESS != err) { return err; } @@ -211,13 +214,13 @@ mca_coll_basic_alltoallw_intra(const void *sbuf, const int *scounts, const int * for (i = 0; i < size; ++i) { size_t msg_size; ompi_datatype_type_size(rdtypes[i], &msg_size); - msg_size *= rcounts[i]; + msg_size *= ompi_count_array_get(rcounts, i); if (i == rank || 0 == msg_size) continue; - prcv = ((char *) rbuf) + rdisps[i]; - err = MCA_PML_CALL(irecv_init(prcv, rcounts[i], rdtypes[i], + prcv = ((char *) rbuf) + ompi_disp_array_get(rdisps, i); + err = MCA_PML_CALL(irecv_init(prcv, ompi_count_array_get(rcounts, i), rdtypes[i], i, MCA_COLL_BASE_TAG_ALLTOALLW, comm, preq++)); ++nreqs; @@ -232,13 +235,13 @@ mca_coll_basic_alltoallw_intra(const void *sbuf, const int *scounts, const int * for (i = 0; i < size; ++i) { size_t msg_size; ompi_datatype_type_size(sdtypes[i], &msg_size); - msg_size *= scounts[i]; + msg_size *= ompi_count_array_get(scounts, i); if (i == rank || 0 == msg_size) continue; - psnd = ((char *) sbuf) + sdisps[i]; - err = MCA_PML_CALL(isend_init(psnd, scounts[i], sdtypes[i], + psnd = ((char *) sbuf) + ompi_disp_array_get(sdisps, i); + err = MCA_PML_CALL(isend_init(psnd, ompi_count_array_get(scounts, i), sdtypes[i], i, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); @@ -277,9 +280,9 @@ mca_coll_basic_alltoallw_intra(const void *sbuf, const int *scounts, const int * * Returns: - MPI_SUCCESS or an MPI error code */ int -mca_coll_basic_alltoallw_inter(const void *sbuf, const int *scounts, const int *sdisps, +mca_coll_basic_alltoallw_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -300,13 +303,13 @@ mca_coll_basic_alltoallw_inter(const void *sbuf, const int *scounts, const int * for (i = 0; i < size; ++i) { size_t msg_size; ompi_datatype_type_size(rdtypes[i], &msg_size); - msg_size *= rcounts[i]; + msg_size *= ompi_count_array_get(rcounts, i); if (0 == msg_size) continue; - prcv = ((char *) rbuf) + rdisps[i]; - err = MCA_PML_CALL(irecv_init(prcv, rcounts[i], rdtypes[i], + prcv = ((char *) rbuf) + ompi_disp_array_get(rdisps, i); + err = MCA_PML_CALL(irecv_init(prcv, ompi_count_array_get(rcounts, i), rdtypes[i], i, MCA_COLL_BASE_TAG_ALLTOALLW, comm, preq++)); ++nreqs; @@ -320,13 +323,13 @@ mca_coll_basic_alltoallw_inter(const void *sbuf, const int *scounts, const int * for (i = 0; i < size; ++i) { size_t msg_size; ompi_datatype_type_size(sdtypes[i], &msg_size); - msg_size *= scounts[i]; + msg_size *= ompi_count_array_get(scounts, i); if (0 == msg_size) continue; - psnd = ((char *) sbuf) + sdisps[i]; - err = MCA_PML_CALL(isend_init(psnd, scounts[i], sdtypes[i], + psnd = ((char *) sbuf) + ompi_disp_array_get(sdisps, i); + err = MCA_PML_CALL(isend_init(psnd, ompi_count_array_get(scounts, i), sdtypes[i], i, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD, comm, preq++)); diff --git a/ompi/mca/coll/basic/coll_basic_gatherv.c b/ompi/mca/coll/basic/coll_basic_gatherv.c index 3f1fa0e6894..92dba710453 100644 --- a/ompi/mca/coll/basic/coll_basic_gatherv.c +++ b/ompi/mca/coll/basic/coll_basic_gatherv.c @@ -37,9 +37,9 @@ * Returns: - MPI_SUCCESS or error code */ int -mca_coll_basic_gatherv_intra(const void *sbuf, int scount, +mca_coll_basic_gatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -65,11 +65,11 @@ mca_coll_basic_gatherv_intra(const void *sbuf, int scount, return OMPI_ERROR; } - if (MPI_IN_PLACE != sbuf && (0 < scount) && (0 < rcounts[rank])) { + if (MPI_IN_PLACE != sbuf && (0 < scount) && (0 < ompi_count_array_get(rcounts, rank))) { /* Directly copy self sbuf to rbuf */ err = ompi_datatype_sndrcv(sbuf, scount, sdtype, - ((char *) rbuf) + (extent * disps[rank]), rcounts[rank], - rdtype); + ((char *) rbuf) + (extent * ompi_disp_array_get(disps, rank)), + ompi_count_array_get(rcounts, rank), rdtype); if (MPI_SUCCESS != err) { return err; } @@ -80,7 +80,7 @@ mca_coll_basic_gatherv_intra(const void *sbuf, int scount, for (i = 0; i < size; ++i) { /* We directly copied the data from self */ - if (0 < rcounts[i] && rank != i) { + if (0 < ompi_count_array_get(rcounts, i) && rank != i) { ++nrecv; } } @@ -94,10 +94,10 @@ mca_coll_basic_gatherv_intra(const void *sbuf, int scount, for (i = 1; i < size; ++i) { peer = (rank + i) % size; - ptmp = ((char *) rbuf) + (extent * disps[peer]); + ptmp = ((char *) rbuf) + (extent * ompi_disp_array_get(disps, peer)); /* Only receive if there is something to receive */ - if (0 < rcounts[peer]) { - err = MCA_PML_CALL(irecv(ptmp, rcounts[peer], rdtype, peer, + if (0 < ompi_count_array_get(rcounts, peer)) { + err = MCA_PML_CALL(irecv(ptmp, ompi_count_array_get(rcounts, peer), rdtype, peer, MCA_COLL_BASE_TAG_GATHERV, comm, &reqs[recv_iter++])); } } @@ -146,9 +146,9 @@ mca_coll_basic_gatherv_intra(const void *sbuf, int scount, * Returns: - MPI_SUCCESS or error code */ int -mca_coll_basic_gatherv_inter(const void *sbuf, int scount, +mca_coll_basic_gatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -182,8 +182,8 @@ mca_coll_basic_gatherv_inter(const void *sbuf, int scount, if( NULL == reqs ) { return OMPI_ERR_OUT_OF_RESOURCE; } for (i = 0; i < size; ++i) { - ptmp = ((char *) rbuf) + (extent * disps[i]); - err = MCA_PML_CALL(irecv(ptmp, rcounts[i], rdtype, i, + ptmp = ((char *) rbuf) + (extent * ompi_disp_array_get(disps, i)); + err = MCA_PML_CALL(irecv(ptmp, ompi_count_array_get(rcounts, i), rdtype, i, MCA_COLL_BASE_TAG_GATHERV, comm, &reqs[i])); if (OMPI_SUCCESS != err) { diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c b/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c index 37d97970a30..f1d7c48948a 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c @@ -37,8 +37,8 @@ #include "ompi/mca/topo/base/base.h" static int -mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int rcounts[], const int disps[], +mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { @@ -68,7 +68,8 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp if (MPI_PROC_NULL != srank) { nreqs++; - rc = MCA_PML_CALL(irecv((char *) rbuf + disps[i] * extent, rcounts[i], rdtype, srank, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(disps, i) * extent, + ompi_count_array_get(rcounts, i), rdtype, srank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -83,7 +84,8 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp if (MPI_PROC_NULL != drank) { nreqs++; - rc = MCA_PML_CALL(irecv((char *) rbuf + disps[i+1] * extent, rcounts[i+1], rdtype, drank, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(disps, i+1) * extent, + ompi_count_array_get(rcounts, i+1), rdtype, drank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -108,8 +110,8 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp } static int -mca_coll_basic_neighbor_allgatherv_graph(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int rcounts[], const int disps[], +mca_coll_basic_neighbor_allgatherv_graph(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { @@ -133,7 +135,7 @@ mca_coll_basic_neighbor_allgatherv_graph(const void *sbuf, int scount, struct om if( NULL == reqs ) { return OMPI_ERR_OUT_OF_RESOURCE; } for (neighbor = 0; neighbor < degree ; ++neighbor) { - rc = MCA_PML_CALL(irecv((char *) rbuf + disps[neighbor] * extent, rcounts[neighbor], + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(disps, neighbor) * extent, ompi_count_array_get(rcounts, neighbor), rdtype, edges[neighbor], MCA_COLL_BASE_TAG_ALLGATHER, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -158,8 +160,8 @@ mca_coll_basic_neighbor_allgatherv_graph(const void *sbuf, int scount, struct om } static int -mca_coll_basic_neighbor_allgatherv_dist_graph(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int rcounts[], const int disps[], +mca_coll_basic_neighbor_allgatherv_dist_graph(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { @@ -182,7 +184,7 @@ mca_coll_basic_neighbor_allgatherv_dist_graph(const void *sbuf, int scount, stru if( NULL == reqs ) { return OMPI_ERR_OUT_OF_RESOURCE; } for (neighbor = 0; neighbor < indegree ; ++neighbor) { - rc = MCA_PML_CALL(irecv((char *) rbuf + disps[neighbor] * extent, rcounts[neighbor], rdtype, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(disps, neighbor) * extent, ompi_count_array_get(rcounts, neighbor), rdtype, inedges[neighbor], MCA_COLL_BASE_TAG_ALLGATHER, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -213,8 +215,9 @@ mca_coll_basic_neighbor_allgatherv_dist_graph(const void *sbuf, int scount, stru return rc; } -int mca_coll_basic_neighbor_allgatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int rcounts[], const int disps[], struct ompi_datatype_t *rdtype, +int mca_coll_basic_neighbor_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, + struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { if (OMPI_COMM_IS_INTER(comm)) { diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c index e963dc25412..61585fe9e7d 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c @@ -37,9 +37,9 @@ #include "ompi/mca/topo/base/base.h" static int -mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], const int sdisps[], - struct ompi_datatype_t *sdtype, void *rbuf, const int rcounts[], - const int rdisps[], struct ompi_datatype_t *rdtype, +mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t *sdtype, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart; @@ -67,14 +67,16 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co if (MPI_PROC_NULL != srank) { nreqs++; - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i] * rdextent, rcounts[i], rdtype, srank, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, i) * rdextent, + ompi_count_array_get(rcounts, i), rdtype, srank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i+1] * rdextent, rcounts[i+1], rdtype, drank, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, i+1) * rdextent, + ompi_count_array_get(rcounts, i+1), rdtype, drank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -97,14 +99,16 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co if (MPI_PROC_NULL != srank) { nreqs++; /* remove cast from const when the pml layer is updated to take a const for the send buffer */ - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i] * sdextent, scounts[i], sdtype, srank, + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, i) * sdextent, + ompi_count_array_get(scounts, i), sdtype, srank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i+1] * sdextent, scounts[i+1], sdtype, drank, + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, i+1) * sdextent, + ompi_count_array_get(scounts, i+1), sdtype, drank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -123,9 +127,9 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co } static int -mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, const int scounts[], const int sdisps[], - struct ompi_datatype_t *sdtype, void *rbuf, const int rcounts[], - const int rdisps[], struct ompi_datatype_t *rdtype, +mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t *sdtype, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph; @@ -150,7 +154,8 @@ mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, const int scounts[], c /* post all receives first */ for (neighbor = 0; neighbor < degree ; ++neighbor) { - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[neighbor] * rdextent, rcounts[neighbor], rdtype, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, neighbor) * rdextent, + ompi_count_array_get(rcounts, neighbor), rdtype, edges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -162,7 +167,8 @@ mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, const int scounts[], c for (neighbor = 0 ; neighbor < degree ; ++neighbor) { /* remove cast from const when the pml layer is updated to take a const for the send buffer */ - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[neighbor] * sdextent, scounts[neighbor], sdtype, + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, neighbor) * sdextent, + ompi_count_array_get(scounts, neighbor), sdtype, edges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -181,9 +187,9 @@ mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, const int scounts[], c } static int -mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, const int scounts[], const int sdisps[], - struct ompi_datatype_t *sdtype, void *rbuf, const int rcounts[], - const int rdisps[], struct ompi_datatype_t *rdtype, +mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t *sdtype, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph; @@ -207,7 +213,8 @@ mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, const int scounts /* post all receives first */ for (neighbor = 0; neighbor < indegree ; ++neighbor) { - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[neighbor] * rdextent, rcounts[neighbor], rdtype, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, neighbor) * rdextent, + ompi_count_array_get(rcounts, neighbor), rdtype, inedges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -219,7 +226,8 @@ mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, const int scounts for (neighbor = 0 ; neighbor < outdegree ; ++neighbor) { /* remove cast from const when the pml layer is updated to take a const for the send buffer */ - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[neighbor] * sdextent, scounts[neighbor], sdtype, + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, neighbor) * sdextent, + ompi_count_array_get(scounts, neighbor), sdtype, outedges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -237,9 +245,9 @@ mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, const int scounts return rc; } -int mca_coll_basic_neighbor_alltoallv(const void *sbuf, const int scounts[], const int sdisps[], - struct ompi_datatype_t *sdtype, void *rbuf, const int rcounts[], - const int rdisps[], struct ompi_datatype_t *rdtype, +int mca_coll_basic_neighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t *sdtype, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { if (OMPI_COMM_IS_INTER(comm)) { diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c index 29abb456252..96c415f9c50 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c @@ -37,9 +37,9 @@ #include "ompi/mca/topo/base/base.h" static int -mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], const MPI_Aint sdisps[], - struct ompi_datatype_t * const *sdtypes, void *rbuf, const int rcounts[], - const MPI_Aint rdisps[], struct ompi_datatype_t * const *rdtypes, +mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t * const *sdtypes, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart; @@ -64,14 +64,16 @@ mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], co if (MPI_PROC_NULL != srank) { nreqs++; - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i], rcounts[i], rdtypes[i], srank, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, i), + ompi_count_array_get(rcounts, i), rdtypes[i], srank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i+1], rcounts[i+1], rdtypes[i+1], drank, + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, i+1), + ompi_count_array_get(rcounts, i+1), rdtypes[i+1], drank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -94,14 +96,16 @@ mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], co if (MPI_PROC_NULL != srank) { nreqs++; /* remove cast from const when the pml layer is updated to take a const for the send buffer */ - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i], scounts[i], sdtypes[i], srank, + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, i), + ompi_count_array_get(scounts, i), sdtypes[i], srank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i+1], scounts[i+1], sdtypes[i+1], drank, + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, i+1), + ompi_count_array_get(scounts, i+1), sdtypes[i+1], drank, MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -120,9 +124,9 @@ mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], co } static int -mca_coll_basic_neighbor_alltoallw_graph(const void *sbuf, const int scounts[], const MPI_Aint sdisps[], - struct ompi_datatype_t * const sdtypes[], void *rbuf, const int rcounts[], - const MPI_Aint rdisps[], struct ompi_datatype_t * const rdtypes[], +mca_coll_basic_neighbor_alltoallw_graph(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t * const sdtypes[], void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const rdtypes[], struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph; @@ -144,7 +148,8 @@ mca_coll_basic_neighbor_alltoallw_graph(const void *sbuf, const int scounts[], c /* post all receives first */ for (neighbor = 0; neighbor < degree ; ++neighbor) { - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[neighbor], rcounts[neighbor], rdtypes[neighbor], + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, neighbor), + ompi_count_array_get(rcounts, neighbor), rdtypes[neighbor], edges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -156,7 +161,8 @@ mca_coll_basic_neighbor_alltoallw_graph(const void *sbuf, const int scounts[], c for (neighbor = 0 ; neighbor < degree ; ++neighbor) { /* remove cast from const when the pml layer is updated to take a const for the send buffer */ - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[neighbor], scounts[neighbor], sdtypes[neighbor], + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, neighbor), + ompi_count_array_get(scounts, neighbor), sdtypes[neighbor], edges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -175,9 +181,9 @@ mca_coll_basic_neighbor_alltoallw_graph(const void *sbuf, const int scounts[], c } static int -mca_coll_basic_neighbor_alltoallw_dist_graph(const void *sbuf, const int scounts[], const MPI_Aint sdisps[], - struct ompi_datatype_t * const *sdtypes, void *rbuf, const int rcounts[], - const MPI_Aint rdisps[], struct ompi_datatype_t * const *rdtypes, +mca_coll_basic_neighbor_alltoallw_dist_graph(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t * const *sdtypes, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph; @@ -200,7 +206,8 @@ mca_coll_basic_neighbor_alltoallw_dist_graph(const void *sbuf, const int scounts /* post all receives first */ for (neighbor = 0; neighbor < indegree ; ++neighbor) { - rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[neighbor], rcounts[neighbor], rdtypes[neighbor], + rc = MCA_PML_CALL(irecv((char *) rbuf + ompi_disp_array_get(rdisps, neighbor), + ompi_count_array_get(rcounts, neighbor), rdtypes[neighbor], inedges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -212,7 +219,8 @@ mca_coll_basic_neighbor_alltoallw_dist_graph(const void *sbuf, const int scounts for (neighbor = 0 ; neighbor < outdegree ; ++neighbor) { /* remove cast from const when the pml layer is updated to take a const for the send buffer */ - rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[neighbor], scounts[neighbor], sdtypes[neighbor], + rc = MCA_PML_CALL(isend((char *) sbuf + ompi_disp_array_get(sdisps, neighbor), + ompi_count_array_get(scounts, neighbor), sdtypes[neighbor], outedges[neighbor], MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -230,9 +238,9 @@ mca_coll_basic_neighbor_alltoallw_dist_graph(const void *sbuf, const int scounts return rc; } -int mca_coll_basic_neighbor_alltoallw(const void *sbuf, const int scounts[], const MPI_Aint sdisps[], - struct ompi_datatype_t * const *sdtypes, void *rbuf, const int rcounts[], - const MPI_Aint rdisps[], struct ompi_datatype_t * const *rdtypes, +int mca_coll_basic_neighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, + struct ompi_datatype_t * const *sdtypes, void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { if (OMPI_COMM_IS_INTER(comm)) { diff --git a/ompi/mca/coll/basic/coll_basic_reduce_scatter.c b/ompi/mca/coll/basic/coll_basic_reduce_scatter.c index d0743b3a5f5..4a77803563c 100644 --- a/ompi/mca/coll/basic/coll_basic_reduce_scatter.c +++ b/ompi/mca/coll/basic/coll_basic_reduce_scatter.c @@ -64,7 +64,7 @@ * so this should be investigated further. */ int -mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rcounts, +mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -72,7 +72,8 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco { int i, rank, size, count, err = OMPI_SUCCESS; ptrdiff_t extent, buf_size, gap; - int *disps = NULL; + ptrdiff_t *disps = NULL; + ompi_disp_array disps_desc; char *recv_buf = NULL, *recv_buf_free = NULL; char *result_buf = NULL, *result_buf_free = NULL; /* Initialize */ @@ -80,14 +81,14 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco size = ompi_comm_size(comm); /* Find displacements and the like */ - disps = (int*) malloc(sizeof(int) * size); + disps = (ptrdiff_t*) malloc(sizeof(ptrdiff_t) * size); if (NULL == disps) return OMPI_ERR_OUT_OF_RESOURCE; disps[0] = 0; for (i = 0; i < (size - 1); ++i) { - disps[i + 1] = disps[i] + rcounts[i]; + disps[i + 1] = disps[i] + ompi_count_array_get(rcounts, i); } - count = disps[size - 1] + rcounts[size - 1]; + count = disps[size - 1] + ompi_count_array_get(rcounts, size - 1); /* short cut the trivial case */ if (0 == count) { @@ -186,9 +187,10 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco for (i = 0 ; i < tmp_size ; ++i) { if (i < remain) { /* need to include old neighbor as well */ - tmp_rcounts[i] = rcounts[i * 2 + 1] + rcounts[i * 2]; + tmp_rcounts[i] = ompi_count_array_get(rcounts, i * 2 + 1) + + ompi_count_array_get(rcounts, i * 2); } else { - tmp_rcounts[i] = rcounts[i + remain]; + tmp_rcounts[i] = ompi_count_array_get(rcounts, i + remain); } } @@ -280,10 +282,10 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco } /* copy local results from results buffer into real receive buffer */ - if (0 != rcounts[rank]) { + if (0 != ompi_count_array_get(rcounts, rank)) { err = ompi_datatype_sndrcv(result_buf + disps[rank] * extent, - rcounts[rank], dtype, - rbuf, rcounts[rank], dtype); + ompi_count_array_get(rcounts, rank), dtype, + rbuf, ompi_count_array_get(rcounts, rank), dtype); if (OMPI_SUCCESS != err) { free(tmp_rcounts); free(tmp_disps); @@ -299,16 +301,16 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco procs send the even procs the proper results */ if (rank < 2 * remain) { if ((rank & 1) == 0) { - if (rcounts[rank]) { - err = MCA_PML_CALL(recv(rbuf, rcounts[rank], dtype, rank + 1, + if (ompi_count_array_get(rcounts, rank)) { + err = MCA_PML_CALL(recv(rbuf, ompi_count_array_get(rcounts, rank), dtype, rank + 1, MCA_COLL_BASE_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE)); if (OMPI_SUCCESS != err) goto cleanup; } } else { - if (rcounts[rank - 1]) { + if (ompi_count_array_get(rcounts, rank - 1)) { err = MCA_PML_CALL(send(result_buf + disps[rank - 1] * extent, - rcounts[rank - 1], dtype, rank - 1, + ompi_count_array_get(rcounts, rank - 1), dtype, rank - 1, MCA_COLL_BASE_TAG_REDUCE_SCATTER, MCA_PML_BASE_SEND_STANDARD, comm)); @@ -336,8 +338,9 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco /* scatter */ if (MPI_SUCCESS == err) { - err = comm->c_coll->coll_scatterv(recv_buf, rcounts, disps, dtype, - rbuf, rcounts[rank], dtype, 0, + OMPI_DISP_ARRAY_INIT(&disps_desc, disps); + err = comm->c_coll->coll_scatterv(recv_buf, rcounts, &disps_desc, dtype, + rbuf, ompi_count_array_get(rcounts, rank), dtype, 0, comm, comm->c_coll->coll_scatterv_module); } } @@ -359,7 +362,7 @@ mca_coll_basic_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rco * Returns: - MPI_SUCCESS or error code */ int -mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, const int *rcounts, +mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -369,7 +372,8 @@ mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, const int *rco char *tmpbuf = NULL, *tmpbuf2 = NULL, *lbuf = NULL, *buf; ptrdiff_t gap, span; ompi_request_t *req; - int *disps = NULL; + ptrdiff_t *disps = NULL; + ompi_disp_array disps_desc; rank = ompi_comm_rank(comm); rsize = ompi_comm_remote_size(comm); @@ -377,7 +381,7 @@ mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, const int *rco /* Figure out the total amount of data for the reduction. */ for (totalcounts = 0, i = 0; i < lsize; i++) { - totalcounts += rcounts[i]; + totalcounts += ompi_count_array_get(rcounts, i); } /* @@ -401,13 +405,13 @@ mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, const int *rco span = opal_datatype_span(&dtype->super, totalcounts, &gap); /* Generate displacements for the scatterv part */ - disps = (int*) malloc(sizeof(int) * lsize); + disps = (ptrdiff_t*) malloc(sizeof(ptrdiff_t) * lsize); if (NULL == disps) { return OMPI_ERR_OUT_OF_RESOURCE; } disps[0] = 0; for (i = 0; i < (lsize - 1); ++i) { - disps[i + 1] = disps[i] + rcounts[i]; + disps[i + 1] = disps[i] + ompi_count_array_get(rcounts, i); } tmpbuf = (char *) malloc(span); @@ -469,8 +473,9 @@ mca_coll_basic_reduce_scatter_inter(const void *sbuf, void *rbuf, const int *rco } /* Now do a scatterv on the local communicator */ - err = comm->c_local_comm->c_coll->coll_scatterv(lbuf, rcounts, disps, dtype, - rbuf, rcounts[rank], dtype, 0, + OMPI_DISP_ARRAY_INIT(&disps_desc, disps); + err = comm->c_local_comm->c_coll->coll_scatterv(lbuf, rcounts, &disps_desc, dtype, + rbuf, ompi_count_array_get(rcounts, rank), dtype, 0, comm->c_local_comm, comm->c_local_comm->c_coll->coll_scatterv_module); diff --git a/ompi/mca/coll/basic/coll_basic_scatterv.c b/ompi/mca/coll/basic/coll_basic_scatterv.c index 85f729f92f1..72b0530e171 100644 --- a/ompi/mca/coll/basic/coll_basic_scatterv.c +++ b/ompi/mca/coll/basic/coll_basic_scatterv.c @@ -39,9 +39,9 @@ * Returns: - MPI_SUCCESS or error code */ int -mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +mca_coll_basic_scatterv_intra(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -84,14 +84,14 @@ mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts, } for (i = 0; i < size; ++i) { - ptmp = ((char *) sbuf) + (extent * disps[i]); + ptmp = ((char *) sbuf) + (extent * ompi_disp_array_get(disps, i)); /* simple optimization */ if (i == rank) { /* simple optimization or a local operation */ - if (scounts[i] > 0 && MPI_IN_PLACE != rbuf) { - err = ompi_datatype_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount, + if (ompi_count_array_get(scounts, i) > 0 && MPI_IN_PLACE != rbuf) { + err = ompi_datatype_sndrcv(ptmp, ompi_count_array_get(scounts, i), sdtype, rbuf, rcount, rdtype); if (MPI_SUCCESS != err) { return err; @@ -99,8 +99,8 @@ mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts, } } else { /* Only send if there is something to send */ - if (scounts[i] > 0) { - err = MCA_PML_CALL(send(ptmp, scounts[i], sdtype, i, + if (ompi_count_array_get(scounts, i) > 0) { + err = MCA_PML_CALL(send(ptmp, ompi_count_array_get(scounts, i), sdtype, i, MCA_COLL_BASE_TAG_SCATTERV, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { @@ -124,9 +124,9 @@ mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts, * Returns: - MPI_SUCCESS or error code */ int -mca_coll_basic_scatterv_inter(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +mca_coll_basic_scatterv_inter(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -161,8 +161,8 @@ mca_coll_basic_scatterv_inter(const void *sbuf, const int *scounts, if( NULL == reqs ) { return OMPI_ERR_OUT_OF_RESOURCE; } for (i = 0; i < size; ++i) { - ptmp = ((char *) sbuf) + (extent * disps[i]); - err = MCA_PML_CALL(isend(ptmp, scounts[i], sdtype, i, + ptmp = ((char *) sbuf) + (extent * ompi_disp_array_get(disps, i)); + err = MCA_PML_CALL(isend(ptmp, ompi_count_array_get(scounts, i), sdtype, i, MCA_COLL_BASE_TAG_SCATTERV, MCA_PML_BASE_SEND_STANDARD, comm, &(reqs[i]))); diff --git a/ompi/mca/coll/coll.h b/ompi/mca/coll/coll.h index 094fef45009..2cd01e729ed 100644 --- a/ompi/mca/coll/coll.h +++ b/ompi/mca/coll/coll.h @@ -79,9 +79,10 @@ #include "mpi.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" +#include "ompi/mca/coll/base/base.h" #include "ompi/request/request.h" -#include "ompi/mca/coll/base/base.h" +#include "ompi/util/count_disp_array.h" BEGIN_C_DECLS @@ -243,8 +244,8 @@ typedef int (*mca_coll_base_module_allgather_fn_t) void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_allgatherv_fn_t) - (const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, struct ompi_datatype_t *rdtype, + (const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_allreduce_fn_t) (const void *sbuf, void *rbuf, size_t count, struct ompi_datatype_t *dtype, @@ -254,12 +255,12 @@ typedef int (*mca_coll_base_module_alltoall_fn_t) void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_alltoallv_fn_t) - (const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t *rdtype, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_alltoallw_fn_t) - (const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_barrier_fn_t) (struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); @@ -274,14 +275,14 @@ typedef int (*mca_coll_base_module_gather_fn_t) void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_gatherv_fn_t) - (const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, struct ompi_datatype_t *rdtype, + (const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_reduce_fn_t) (const void *sbuf, void* rbuf, size_t count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_reduce_scatter_fn_t) - (const void *sbuf, void *rbuf, const int *rcounts, struct ompi_datatype_t *dtype, + (const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_reduce_scatter_block_fn_t) (const void *sbuf, void *rbuf, size_t rcount, struct ompi_datatype_t *dtype, @@ -294,8 +295,8 @@ typedef int (*mca_coll_base_module_scatter_fn_t) void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_scatterv_fn_t) - (const void *sbuf, const int *scounts, const int *disps, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, struct ompi_datatype_t *rdtype, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); /* nonblocking collectives */ @@ -305,8 +306,8 @@ typedef int (*mca_coll_base_module_iallgather_fn_t) struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_iallgatherv_fn_t) - (const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, struct ompi_datatype_t *rdtype, + (const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_iallreduce_fn_t) @@ -319,13 +320,13 @@ typedef int (*mca_coll_base_module_ialltoall_fn_t) struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ialltoallv_fn_t) - (const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t *rdtype, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ialltoallw_fn_t) - (const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ibarrier_fn_t) @@ -345,8 +346,8 @@ typedef int (*mca_coll_base_module_igather_fn_t) int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_igatherv_fn_t) - (const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, struct ompi_datatype_t *rdtype, + (const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ireduce_fn_t) @@ -354,7 +355,7 @@ typedef int (*mca_coll_base_module_ireduce_fn_t) struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ireduce_scatter_fn_t) - (const void *sbuf, void *rbuf, const int *rcounts, struct ompi_datatype_t *dtype, + (const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ireduce_scatter_block_fn_t) @@ -371,8 +372,8 @@ typedef int (*mca_coll_base_module_iscatter_fn_t) int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_iscatterv_fn_t) - (const void *sbuf, const int *scounts, const int *disps, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, struct ompi_datatype_t *rdtype, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); @@ -383,8 +384,8 @@ typedef int (*mca_coll_base_module_allgather_init_fn_t) struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_allgatherv_init_fn_t) - (const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, struct ompi_datatype_t *rdtype, + (const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_allreduce_init_fn_t) @@ -397,13 +398,13 @@ typedef int (*mca_coll_base_module_alltoall_init_fn_t) struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_alltoallv_init_fn_t) - (const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t *rdtype, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_alltoallw_init_fn_t) - (const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_barrier_init_fn_t) @@ -423,8 +424,8 @@ typedef int (*mca_coll_base_module_gather_init_fn_t) int root, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_gatherv_init_fn_t) - (const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, struct ompi_datatype_t *rdtype, + (const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_reduce_init_fn_t) @@ -432,7 +433,7 @@ typedef int (*mca_coll_base_module_reduce_init_fn_t) struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_reduce_scatter_init_fn_t) - (const void *sbuf, void *rbuf, const int *rcounts, struct ompi_datatype_t *dtype, + (const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_reduce_scatter_block_init_fn_t) @@ -449,8 +450,8 @@ typedef int (*mca_coll_base_module_scatter_init_fn_t) int root, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_scatterv_init_fn_t) - (const void *sbuf, const int *scounts, const int *disps, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, struct ompi_datatype_t *rdtype, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); @@ -458,17 +459,17 @@ typedef int (*mca_coll_base_module_scatterv_init_fn_t) * The signature of the neighborhood alltoallw differs from alltoallw */ typedef int (*mca_coll_base_module_neighbor_alltoallw_fn_t) - (const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rdtypes, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_ineighbor_alltoallw_fn_t) - (const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rdtypes, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); typedef int (*mca_coll_base_module_neighbor_alltoallw_init_fn_t) - (const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rdtypes, + (const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, struct ompi_info_t *info, ompi_request_t ** request, struct mca_coll_base_module_3_0_0_t *module); diff --git a/ompi/mca/coll/demo/coll_demo.h b/ompi/mca/coll/demo/coll_demo.h index 12e3c1a264d..192e6f66fad 100644 --- a/ompi/mca/coll/demo/coll_demo.h +++ b/ompi/mca/coll/demo/coll_demo.h @@ -60,13 +60,13 @@ BEGIN_C_DECLS int mca_coll_demo_allgatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); int mca_coll_demo_allgatherv_inter(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -95,28 +95,28 @@ BEGIN_C_DECLS struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_demo_alltoallv_intra(const void *sbuf, const int *scounts, const int *sdisps, + int mca_coll_demo_alltoallv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_demo_alltoallv_inter(const void *sbuf, const int *scounts, const int *sdisps, + int mca_coll_demo_alltoallv_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_demo_alltoallw_intra(const void *sbuf, const int *scounts, const int *sdisps, + int mca_coll_demo_alltoallw_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t **sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t **rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_demo_alltoallw_inter(void *sbuf, const int *scounts, const int *sdisps, + int mca_coll_demo_alltoallw_inter(void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t **sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t **rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -161,13 +161,13 @@ BEGIN_C_DECLS int mca_coll_demo_gatherv_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, void *rbuf, - const int *rcounts, const int *disps, + ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); int mca_coll_demo_gatherv_inter(void *sbuf, int scount, struct ompi_datatype_t *sdtype, void *rbuf, - const int *rcounts, const int *disps, + ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -186,13 +186,13 @@ BEGIN_C_DECLS mca_coll_base_module_t *module); int mca_coll_demo_reduce_scatter_intra(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); int mca_coll_demo_reduce_scatter_inter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -220,13 +220,13 @@ BEGIN_C_DECLS int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_demo_scatterv_intra(const void *sbuf, const int *scounts, const int *disps, + int mca_coll_demo_scatterv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); - int mca_coll_demo_scatterv_inter(const void *sbuf, const int *scounts, const int *disps, + int mca_coll_demo_scatterv_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, diff --git a/ompi/mca/coll/demo/coll_demo_allgatherv.c b/ompi/mca/coll/demo/coll_demo_allgatherv.c index 1da300c3879..009943f7174 100644 --- a/ompi/mca/coll/demo/coll_demo_allgatherv.c +++ b/ompi/mca/coll/demo/coll_demo_allgatherv.c @@ -36,7 +36,7 @@ */ int mca_coll_demo_allgatherv_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -59,7 +59,7 @@ int mca_coll_demo_allgatherv_intra(const void *sbuf, int scount, */ int mca_coll_demo_allgatherv_inter(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) diff --git a/ompi/mca/coll/demo/coll_demo_alltoallv.c b/ompi/mca/coll/demo/coll_demo_alltoallv.c index 512a3654fd2..43572280293 100644 --- a/ompi/mca/coll/demo/coll_demo_alltoallv.c +++ b/ompi/mca/coll/demo/coll_demo_alltoallv.c @@ -35,9 +35,9 @@ * Returns: - MPI_SUCCESS or an MPI error code */ int -mca_coll_demo_alltoallv_intra(const void *sbuf, const int *scounts, const int *sdisps, +mca_coll_demo_alltoallv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -59,9 +59,9 @@ mca_coll_demo_alltoallv_intra(const void *sbuf, const int *scounts, const int *s * Returns: - MPI_SUCCESS or an MPI error code */ int -mca_coll_demo_alltoallv_inter(const void *sbuf, const int *scounts, const int *sdisps, +mca_coll_demo_alltoallv_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, void *rbuf, - const int *rcounts, const int *rdisps, + ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) diff --git a/ompi/mca/coll/demo/coll_demo_alltoallw.c b/ompi/mca/coll/demo/coll_demo_alltoallw.c index de4bd8433ba..e29771b72a1 100644 --- a/ompi/mca/coll/demo/coll_demo_alltoallw.c +++ b/ompi/mca/coll/demo/coll_demo_alltoallw.c @@ -34,9 +34,9 @@ * Accepts: - same as MPI_Alltoallw() * Returns: - MPI_SUCCESS or an MPI error code */ -int mca_coll_demo_alltoallw_intra(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_demo_alltoallw_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -57,9 +57,9 @@ int mca_coll_demo_alltoallw_intra(const void *sbuf, const int *scounts, const in * Accepts: - same as MPI_Alltoallw() * Returns: - MPI_SUCCESS or an MPI error code */ -int mca_coll_demo_alltoallw_inter(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_demo_alltoallw_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) diff --git a/ompi/mca/coll/demo/coll_demo_gatherv.c b/ompi/mca/coll/demo/coll_demo_gatherv.c index 082e10153f2..aa606965112 100644 --- a/ompi/mca/coll/demo/coll_demo_gatherv.c +++ b/ompi/mca/coll/demo/coll_demo_gatherv.c @@ -36,7 +36,7 @@ */ int mca_coll_demo_gatherv_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -59,7 +59,7 @@ int mca_coll_demo_gatherv_intra(const void *sbuf, int scount, */ int mca_coll_demo_gatherv_inter(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) diff --git a/ompi/mca/coll/demo/coll_demo_reduce_scatter.c b/ompi/mca/coll/demo/coll_demo_reduce_scatter.c index e77babd73c1..74bcab34ed6 100644 --- a/ompi/mca/coll/demo/coll_demo_reduce_scatter.c +++ b/ompi/mca/coll/demo/coll_demo_reduce_scatter.c @@ -34,7 +34,7 @@ * Accepts: - same as MPI_Reduce_scatter() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_demo_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_demo_reduce_scatter_intra(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -55,7 +55,7 @@ int mca_coll_demo_reduce_scatter_intra(const void *sbuf, void *rbuf, const int * * Accepts: - same arguments as MPI_Reduce_scatter() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_demo_reduce_scatter_inter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_demo_reduce_scatter_inter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/demo/coll_demo_scatterv.c b/ompi/mca/coll/demo/coll_demo_scatterv.c index 8e2101a8f36..d5841ffb870 100644 --- a/ompi/mca/coll/demo/coll_demo_scatterv.c +++ b/ompi/mca/coll/demo/coll_demo_scatterv.c @@ -34,8 +34,8 @@ * Accepts: - same arguments as MPI_Scatterv() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_demo_scatterv_intra(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, +int mca_coll_demo_scatterv_intra(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, void *rbuf, int rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -57,8 +57,8 @@ int mca_coll_demo_scatterv_intra(const void *sbuf, const int *scounts, * Accepts: - same arguments as MPI_Scatterv() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_demo_scatterv_inter(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, +int mca_coll_demo_scatterv_inter(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, void *rbuf, int rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/han/coll_han_algorithms.h b/ompi/mca/coll/han/coll_han_algorithms.h index 4eaeed093c2..0ffab044c26 100644 --- a/ompi/mca/coll/han/coll_han_algorithms.h +++ b/ompi/mca/coll/han/coll_han_algorithms.h @@ -161,9 +161,9 @@ mca_coll_han_scatter_intra_simple(const void *sbuf, size_t scount, /* Scatterv */ int -mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, - const int *displs, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +mca_coll_han_scatterv_intra(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *displs, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -188,8 +188,8 @@ mca_coll_han_gather_intra_simple(const void *sbuf, size_t scount, /* Gatherv */ int -mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *displs, +mca_coll_han_gatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); diff --git a/ompi/mca/coll/han/coll_han_dynamic.c b/ompi/mca/coll/han/coll_han_dynamic.c index cf9157fa633..dadee22adf1 100644 --- a/ompi/mca/coll/han/coll_han_dynamic.c +++ b/ompi/mca/coll/han/coll_han_dynamic.c @@ -486,10 +486,10 @@ mca_coll_han_allgather_intra_dynamic(const void *sbuf, size_t scount, * The allgatherv size is the size of the biggest segment */ int -mca_coll_han_allgatherv_intra_dynamic(const void *sbuf, int scount, +mca_coll_han_allgatherv_intra_dynamic(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *displs, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *displs, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -506,8 +506,8 @@ mca_coll_han_allgatherv_intra_dynamic(const void *sbuf, int scount, ompi_datatype_type_size(rdtype, &dtype_size); for(i = 0; i < comm_size; i++) { - if(dtype_size * rcounts[i] > msg_size) { - msg_size = dtype_size * rcounts[i]; + if(dtype_size * ompi_count_array_get(rcounts, i) > msg_size) { + msg_size = dtype_size * ompi_count_array_get(rcounts, i); } } @@ -1055,8 +1055,8 @@ mca_coll_han_gather_intra_dynamic(const void *sbuf, size_t scount, * On the global communicator, calls the han collective implementation, or * calls the correct module if fallback mechanism is activated */ -int mca_coll_han_gatherv_intra_dynamic(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *displs, +int mca_coll_han_gatherv_intra_dynamic(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -1407,9 +1407,9 @@ mca_coll_han_scatter_intra_dynamic(const void *sbuf, size_t scount, * calls the correct module if fallback mechanism is activated */ int -mca_coll_han_scatterv_intra_dynamic(const void *sbuf, const int *scounts, - const int *displs, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +mca_coll_han_scatterv_intra_dynamic(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *displs, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/han/coll_han_gatherv.c b/ompi/mca/coll/han/coll_han_gatherv.c index a80d93d0e92..9c1d44a765f 100644 --- a/ompi/mca/coll/han/coll_han_gatherv.c +++ b/ompi/mca/coll/han/coll_han_gatherv.c @@ -59,8 +59,8 @@ * 2. No **gap** exists between data from the same node, other than the root's node, in the output * buffer - it is ok if data from different nodes has gap. */ -int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *displs, +int mca_coll_han_gatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { @@ -68,7 +68,10 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp int w_rank, w_size; /* information about the global communicator */ int root_low_rank, root_up_rank; /* root ranks for both sub-communicators */ int err, *vranks, low_rank, low_size, up_rank, up_size, *topo; - int *low_rcounts = NULL, *low_displs = NULL; + size_t *low_rcounts = NULL; + ptrdiff_t *low_displs = NULL; + ompi_count_array low_rcounts_desc; + ompi_disp_array low_displs_desc; /* Create the subcommunicators */ err = mca_coll_han_comm_create(comm, han_module); @@ -123,12 +126,16 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp err = OMPI_SUCCESS; /* #################### Root ########################### */ if (root == w_rank) { - int need_bounce_buf = 0, total_up_rcounts = 0, *up_displs = NULL, *up_rcounts = NULL, - *up_peer_lb = NULL, *up_peer_ub = NULL; + int need_bounce_buf = 0; + size_t total_up_rcounts = 0; + ptrdiff_t *up_displs = NULL; + size_t *up_rcounts = NULL, *up_peer_lb = NULL, *up_peer_ub = NULL; + ompi_count_array up_rcounts_desc; + ompi_disp_array up_displs_desc; char *bounce_buf = NULL; - low_rcounts = malloc(low_size * sizeof(int)); - low_displs = malloc(low_size * sizeof(int)); + low_rcounts = malloc(low_size * sizeof(size_t)); + low_displs = malloc(low_size * sizeof(ptrdiff_t)); if (!low_rcounts || !low_displs) { err = OMPI_ERR_OUT_OF_RESOURCE; goto root_out; @@ -141,20 +148,22 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp /* Not a local peer */ continue; } - low_displs[low_peer] = displs[w_peer]; - low_rcounts[low_peer] = rcounts[w_peer]; + low_displs[low_peer] = ompi_disp_array_get(displs, w_peer); + low_rcounts[low_peer] = ompi_count_array_get(rcounts, w_peer); } /* Low Gatherv */ - low_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, rbuf, low_rcounts, low_displs, rdtype, - root_low_rank, low_comm, + OMPI_COUNT_ARRAY_INIT(&low_rcounts_desc, low_rcounts); + OMPI_DISP_ARRAY_INIT(&low_displs_desc, low_displs); + low_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, rbuf, &low_rcounts_desc, + &low_displs_desc, rdtype, root_low_rank, low_comm, low_comm->c_coll->coll_gatherv_module); char *tmp_rbuf = rbuf; - up_rcounts = calloc(up_size, sizeof(int)); - up_displs = malloc(up_size * sizeof(int)); - up_peer_ub = calloc(up_size, sizeof(int)); + up_rcounts = calloc(up_size, sizeof(size_t)); + up_displs = malloc(up_size * sizeof(ptrdiff_t)); + up_peer_ub = calloc(up_size, sizeof(size_t)); if (!up_rcounts || !up_displs || !up_peer_ub) { err = OMPI_ERR_OUT_OF_RESOURCE; goto root_out; @@ -169,8 +178,8 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp for (w_peer = 0; w_peer < w_size; ++w_peer) { mca_coll_han_get_ranks(vranks, w_peer, low_size, NULL, &up_peer); - if (!need_bounce_buf && root_up_rank != up_peer && 0 < rcounts[w_peer] && 0 < w_peer - && displs[w_peer] < displs[w_peer - 1]) { + if (!need_bounce_buf && root_up_rank != up_peer && 0 < ompi_count_array_get(rcounts, w_peer) && 0 < w_peer + && ompi_disp_array_get(displs, w_peer) < ompi_disp_array_get(displs, w_peer - 1)) { /* Data is not placed in the rank order so reordering is needed */ need_bounce_buf = 1; } @@ -180,17 +189,17 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp continue; } - up_peer_ub[up_peer] = 0 < rcounts[w_peer] - && displs[w_peer] + rcounts[w_peer] > up_peer_ub[up_peer] - ? displs[w_peer] + rcounts[w_peer] + up_peer_ub[up_peer] = 0 < ompi_count_array_get(rcounts, w_peer) + && ompi_disp_array_get(displs, w_peer) + ompi_count_array_get(rcounts, w_peer) > up_peer_ub[up_peer] + ? ompi_disp_array_get(displs, w_peer) + ompi_count_array_get(rcounts, w_peer) : up_peer_ub[up_peer]; - up_rcounts[up_peer] += rcounts[w_peer]; - total_up_rcounts += rcounts[w_peer]; + up_rcounts[up_peer] += ompi_count_array_get(rcounts, w_peer); + total_up_rcounts += ompi_count_array_get(rcounts, w_peer); /* Optimize for the happy path */ - up_displs[up_peer] = 0 < rcounts[w_peer] && displs[w_peer] < up_displs[up_peer] - ? displs[w_peer] + up_displs[up_peer] = 0 < ompi_count_array_get(rcounts, w_peer) && ompi_disp_array_get(displs, w_peer) < up_displs[up_peer] + ? ompi_disp_array_get(displs, w_peer) : up_displs[up_peer]; } @@ -226,7 +235,9 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp } /* Up Gatherv */ - up_comm->c_coll->coll_gatherv(sbuf, 0, sdtype, tmp_rbuf, up_rcounts, up_displs, rdtype, + OMPI_COUNT_ARRAY_INIT(&up_rcounts_desc, up_rcounts); + OMPI_DISP_ARRAY_INIT(&up_displs_desc, up_displs); + up_comm->c_coll->coll_gatherv(sbuf, 0, sdtype, tmp_rbuf, &up_rcounts_desc, &up_displs_desc, rdtype, root_up_rank, up_comm, up_comm->c_coll->coll_gatherv_module); /* Use a temp buffer to reorder the output buffer if needed */ @@ -242,10 +253,10 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp w_peer = topo[2 * i + 1]; - ompi_datatype_copy_content_same_ddt(rdtype, (size_t) rcounts[w_peer], - (char *) rbuf + (size_t) displs[w_peer] * rdext, + ompi_datatype_copy_content_same_ddt(rdtype, ompi_count_array_get(rcounts, w_peer), + (char *) rbuf + ompi_disp_array_get(displs, w_peer) * rdext, bounce_buf + offset); - offset += rdext * (size_t) rcounts[w_peer]; + offset += rdext * ompi_count_array_get(rcounts, w_peer); } } @@ -284,16 +295,16 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp } size_t sdsize = 0; - uint64_t send_size = 0; + size_t send_size = 0; ompi_datatype_type_size(sdtype, &sdsize); - send_size = (uint64_t) sdsize * (uint64_t) scount; + send_size = sdsize * scount; /* #################### Other node followers ########################### */ if (root_low_rank != low_rank) { /* Low Gather - Gather each local peer's send data size */ - low_comm->c_coll->coll_gather((const void *) &send_size, 1, MPI_UINT64_T, NULL, 1, - MPI_UINT64_T, root_low_rank, low_comm, + low_comm->c_coll->coll_gather((const void *) &send_size, sizeof(size_t), MPI_BYTE, NULL, + sizeof(size_t), MPI_BYTE, root_low_rank, low_comm, low_comm->c_coll->coll_gather_module); /* Low Gatherv */ low_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, NULL, NULL, NULL, NULL, root_low_rank, @@ -303,65 +314,49 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp /* #################### Node leaders ########################### */ - uint64_t *low_data_size = NULL; char *tmp_buf = NULL; - ompi_datatype_t *temptype = MPI_BYTE; /* Allocate a temporary array to gather the data size, i.e. data type size x count, * in bytes from local peers */ - low_data_size = malloc(low_size * sizeof(uint64_t)); - if (!low_data_size) { + low_rcounts = malloc(low_size * sizeof(size_t)); + if (!low_rcounts) { err = OMPI_ERR_OUT_OF_RESOURCE; goto node_leader_out; } /* Low Gather - Gather local peers' send data sizes */ - low_comm->c_coll->coll_gather((const void *) &send_size, 1, MPI_UINT64_T, - (void *) low_data_size, 1, MPI_UINT64_T, root_low_rank, low_comm, + low_comm->c_coll->coll_gather((const void *) &send_size, sizeof(size_t), MPI_BYTE, + (void *) low_rcounts, sizeof(size_t), MPI_BYTE, root_low_rank, low_comm, low_comm->c_coll->coll_gather_module); - /* Determine if we need to create a custom datatype instead of MPI_BYTE, - * to avoid count(type int) overflow - * TODO: Remove this logic once we adopt large-count, i.e. count will become 64-bit. - */ - int total_up_scount = 0; - size_t rsize = 0, datatype_size = 1, max_data_size = 0; - for (int i = 0; i < low_size; ++i) { - rsize += (size_t) low_data_size[i]; - max_data_size = (size_t) low_data_size[i] > max_data_size ? (size_t) low_data_size[i] - : max_data_size; - } - - if (max_data_size > (size_t) INT_MAX) { - datatype_size = coll_han_utils_gcd(low_data_size, low_size); - } - - low_rcounts = malloc(low_size * sizeof(int)); - low_displs = malloc(low_size * sizeof(int)); - tmp_buf = (char *) malloc(rsize); /* tmp_buf is still valid if rsize is 0 */ - if (!tmp_buf || !low_rcounts || !low_displs) { + low_displs = malloc(low_size * sizeof(ptrdiff_t)); + if (!low_displs) { err = OMPI_ERR_OUT_OF_RESOURCE; goto node_leader_out; } + size_t total_rsize = 0; for (int i = 0; i < low_size; ++i) { - low_rcounts[i] = (int) ((size_t) low_data_size[i] / datatype_size); low_displs[i] = i > 0 ? low_displs[i - 1] + low_rcounts[i - 1] : 0; - total_up_scount += low_rcounts[i]; + total_rsize += low_rcounts[i]; } - if (1 < datatype_size) { - coll_han_utils_create_contiguous_datatype(datatype_size, MPI_BYTE, &temptype); - ompi_datatype_commit(&temptype); + tmp_buf = (char *) malloc(total_rsize); /* tmp_buf is still valid if total_rsize is 0 */ + if (!tmp_buf) { + err = OMPI_ERR_OUT_OF_RESOURCE; + goto node_leader_out; } /* Low Gatherv */ - low_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, (void *) tmp_buf, low_rcounts, low_displs, - temptype, root_low_rank, low_comm, + OMPI_COUNT_ARRAY_INIT(&low_rcounts_desc, low_rcounts); + OMPI_DISP_ARRAY_INIT(&low_displs_desc, low_displs); + low_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, (void *) tmp_buf, + &low_rcounts_desc, &low_displs_desc, + MPI_BYTE, root_low_rank, low_comm, low_comm->c_coll->coll_gatherv_module); /* Up Gatherv */ - up_comm->c_coll->coll_gatherv(tmp_buf, total_up_scount, temptype, NULL, NULL, NULL, NULL, + up_comm->c_coll->coll_gatherv(tmp_buf, total_rsize, MPI_BYTE, NULL, NULL, NULL, NULL, root_up_rank, up_comm, up_comm->c_coll->coll_gatherv_module); node_leader_out: @@ -371,15 +366,9 @@ int mca_coll_han_gatherv_intra(const void *sbuf, int scount, struct ompi_datatyp if (low_displs) { free(low_displs); } - if (low_data_size) { - free(low_data_size); - } if (tmp_buf) { free(tmp_buf); } - if (MPI_BYTE != temptype) { - ompi_datatype_destroy(&temptype); - } return err; } diff --git a/ompi/mca/coll/han/coll_han_scatterv.c b/ompi/mca/coll/han/coll_han_scatterv.c index 16b16754313..faba96826cc 100644 --- a/ompi/mca/coll/han/coll_han_scatterv.c +++ b/ompi/mca/coll/han/coll_han_scatterv.c @@ -63,8 +63,8 @@ * packed form of MPI_BYTE type. This works for Gatherv but NOT for Scatterv provided that the Root * has a different architecture, e.g. endianness, integer representation, etc. */ -int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int *displs, - struct ompi_datatype_t *sdtype, void *rbuf, int rcount, +int mca_coll_han_scatterv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *displs, + struct ompi_datatype_t *sdtype, void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { @@ -72,7 +72,10 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int int w_rank, w_size; /* information about the global communicator */ int root_low_rank, root_up_rank; /* root ranks for both sub-communicators */ int err, *vranks, low_rank, low_size, up_rank, up_size, *topo; - int *low_scounts = NULL, *low_displs = NULL; + size_t *low_scounts = NULL; + ptrdiff_t *low_displs = NULL; + ompi_count_array low_scounts_desc; + ompi_disp_array low_displs_desc; ompi_request_t *iscatterv_req = NULL; /* Create the subcommunicators */ @@ -137,12 +140,16 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int /* #################### Root ########################### */ if (root == w_rank) { int low_peer, up_peer, w_peer; - int need_bounce_buf = 0, total_up_scounts = 0, *up_displs = NULL, *up_scounts = NULL, - *up_peer_lb = NULL, *up_peer_ub = NULL; + int need_bounce_buf = 0; + size_t total_up_scounts = 0; + ptrdiff_t *up_displs = NULL; + size_t *up_scounts = NULL, *up_peer_lb = NULL, *up_peer_ub = NULL; + ompi_count_array up_scounts_desc; + ompi_disp_array up_displs_desc; char *reorder_sbuf = (char *) sbuf, *bounce_buf = NULL; - low_scounts = malloc(low_size * sizeof(int)); - low_displs = malloc(low_size * sizeof(int)); + low_scounts = malloc(low_size * sizeof(size_t)); + low_displs = malloc(low_size * sizeof(ptrdiff_t)); if (!low_scounts || !low_displs) { err = OMPI_ERR_OUT_OF_RESOURCE; goto root_out; @@ -154,28 +161,29 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int /* Not a local peer */ continue; } - low_displs[low_peer] = displs[w_peer]; - low_scounts[low_peer] = scounts[w_peer]; + low_displs[low_peer] = ompi_disp_array_get(displs, w_peer); + low_scounts[low_peer] = ompi_count_array_get(scounts, w_peer); } - up_scounts = calloc(up_size, sizeof(int)); - up_displs = malloc(up_size * sizeof(int)); - up_peer_ub = calloc(up_size, sizeof(int)); + up_scounts = calloc(up_size, sizeof(size_t)); + up_displs = malloc(up_size * sizeof(ptrdiff_t)); + up_peer_ub = calloc(up_size, sizeof(size_t)); if (!up_scounts || !up_displs || !up_peer_ub) { err = OMPI_ERR_OUT_OF_RESOURCE; goto root_out; } for (up_peer = 0; up_peer < up_size; ++up_peer) { - up_displs[up_peer] = INT_MAX; + up_displs[up_peer] = SIZE_MAX; } /* Calculate send counts for the inter-node scatterv */ for (w_peer = 0; w_peer < w_size; ++w_peer) { mca_coll_han_get_ranks(vranks, w_peer, low_size, NULL, &up_peer); - if (!need_bounce_buf && root_up_rank != up_peer && 0 < scounts[w_peer] && 0 < w_peer - && displs[w_peer] < displs[w_peer - 1]) { + if (!need_bounce_buf && root_up_rank != up_peer + && 0 < ompi_count_array_get(scounts, w_peer) && 0 < w_peer + && ompi_disp_array_get(displs, w_peer) < ompi_disp_array_get(displs, w_peer - 1)) { /* Data is not placed in the rank order so reordering is needed */ need_bounce_buf = 1; } @@ -185,17 +193,20 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int continue; } - up_peer_ub[up_peer] = 0 < scounts[w_peer] - && displs[w_peer] + scounts[w_peer] > up_peer_ub[up_peer] - ? displs[w_peer] + scounts[w_peer] + up_peer_ub[up_peer] = 0 < ompi_count_array_get(scounts, w_peer) + && ompi_disp_array_get(displs, w_peer) + + ompi_count_array_get(scounts, w_peer) > up_peer_ub[up_peer] + ? ompi_disp_array_get(displs, w_peer) + + ompi_count_array_get(scounts, w_peer) : up_peer_ub[up_peer]; - up_scounts[up_peer] += scounts[w_peer]; - total_up_scounts += scounts[w_peer]; + up_scounts[up_peer] += ompi_count_array_get(scounts, w_peer); + total_up_scounts += ompi_count_array_get(scounts, w_peer); /* Optimize for the happy path */ - up_displs[up_peer] = 0 < scounts[w_peer] && displs[w_peer] < up_displs[up_peer] - ? displs[w_peer] + up_displs[up_peer] = 0 < ompi_count_array_get(scounts, w_peer) + && ompi_disp_array_get(displs, w_peer) < up_displs[up_peer] + ? ompi_disp_array_get(displs, w_peer) : up_displs[up_peer]; } @@ -240,21 +251,27 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int w_peer = topo[2 * i + 1]; - ompi_datatype_copy_content_same_ddt(sdtype, (size_t) scounts[w_peer], + ompi_datatype_copy_content_same_ddt(sdtype, ompi_count_array_get(scounts, w_peer), reorder_sbuf + offset, (char *) sbuf - + (size_t) displs[w_peer] * sdext); - offset += sdext * (size_t) scounts[w_peer]; + + ompi_disp_array_get(displs, w_peer) * sdext); + offset += sdext * ompi_count_array_get(scounts, w_peer); } } /* Up Iscatterv */ - up_comm->c_coll->coll_iscatterv((const char *) reorder_sbuf, up_scounts, up_displs, sdtype, + OMPI_COUNT_ARRAY_INIT(&up_scounts_desc, up_scounts); + OMPI_DISP_ARRAY_INIT(&up_displs_desc, up_displs); + up_comm->c_coll->coll_iscatterv((const char *) reorder_sbuf, + &up_scounts_desc, &up_displs_desc, sdtype, rbuf, rcount, rdtype, root_up_rank, up_comm, &iscatterv_req, up_comm->c_coll->coll_iscatterv_module); /* Low Scatterv */ - low_comm->c_coll->coll_scatterv(sbuf, low_scounts, low_displs, sdtype, rbuf, rcount, rdtype, + OMPI_COUNT_ARRAY_INIT(&low_scounts_desc, low_scounts); + OMPI_DISP_ARRAY_INIT(&low_displs_desc, low_displs); + low_comm->c_coll->coll_scatterv(sbuf, &low_scounts_desc, &low_displs_desc, + sdtype, rbuf, rcount, rdtype, root_low_rank, low_comm, low_comm->c_coll->coll_scatterv_module); @@ -295,16 +312,16 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int } size_t rdsize = 0; - uint64_t receive_size = 0; + size_t receive_size = 0; ompi_datatype_type_size(rdtype, &rdsize); - receive_size = (uint64_t) rdsize * (uint64_t) rcount; + receive_size = rdsize * rcount; /* #################### Other node followers ########################### */ if (root_low_rank != low_rank) { /* Low Gather - Gather each local peer's receive data size */ - low_comm->c_coll->coll_gather((const void *) &receive_size, 1, MPI_UINT64_T, NULL, 1, - MPI_UINT64_T, root_low_rank, low_comm, + low_comm->c_coll->coll_gather((const void *) &receive_size, sizeof(size_t), MPI_BYTE, NULL, + sizeof(size_t), MPI_BYTE, root_low_rank, low_comm, low_comm->c_coll->coll_gather_module); /* Low Scatterv */ low_comm->c_coll->coll_scatterv(NULL, NULL, NULL, NULL, rbuf, rcount, rdtype, root_low_rank, @@ -314,67 +331,50 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int /* #################### Node leaders ########################### */ - uint64_t *low_data_size = NULL; char *tmp_buf = NULL; - ompi_datatype_t *temptype = MPI_BYTE; /* Allocate a temporary array to gather the data size, i.e. data type size x count, * in bytes from local peers */ - low_data_size = malloc(low_size * sizeof(uint64_t)); - if (!low_data_size) { + low_scounts = malloc(low_size * sizeof(size_t)); + if (!low_scounts) { err = OMPI_ERR_OUT_OF_RESOURCE; goto node_leader_out; } /* Low Gather - Gather local peers' receive data sizes */ - low_comm->c_coll->coll_gather((const void *) &receive_size, 1, MPI_UINT64_T, - (void *) low_data_size, 1, MPI_UINT64_T, root_low_rank, low_comm, + low_comm->c_coll->coll_gather((const void *) &receive_size, sizeof(size_t), MPI_BYTE, + (void *) low_scounts, sizeof(size_t), MPI_BYTE, root_low_rank, low_comm, low_comm->c_coll->coll_gather_module); - /* Determine if we need to create a custom datatype instead of MPI_BYTE, - * to avoid count(type int) overflow - * TODO: Remove this logic once we adopt large-count, i.e. count will become 64-bit. - */ - int total_up_scount = 0; - size_t rsize = 0, datatype_size = 1, max_data_size = 0; - for (int i = 0; i < low_size; ++i) { - rsize += (size_t) low_data_size[i]; - max_data_size = (size_t) low_data_size[i] > max_data_size ? (size_t) low_data_size[i] - : max_data_size; - } - - if (max_data_size > (size_t) INT_MAX) { - datatype_size = coll_han_utils_gcd(low_data_size, low_size); - } - - low_scounts = malloc(low_size * sizeof(int)); - low_displs = malloc(low_size * sizeof(int)); - tmp_buf = (char *) malloc(rsize); /* tmp_buf is still valid if rsize is 0 */ - if (!tmp_buf || !low_scounts || !low_displs) { + low_displs = malloc(low_size * sizeof(ptrdiff_t)); + if (!low_displs) { err = OMPI_ERR_OUT_OF_RESOURCE; goto node_leader_out; } + size_t total_rsize = 0; for (int i = 0; i < low_size; ++i) { - low_scounts[i] = (int) ((size_t) low_data_size[i] / datatype_size); low_displs[i] = i > 0 ? low_displs[i - 1] + low_scounts[i - 1] : 0; - total_up_scount += low_scounts[i]; + total_rsize += low_scounts[i]; } - if (1 < datatype_size) { - coll_han_utils_create_contiguous_datatype(datatype_size, MPI_BYTE, &temptype); - ompi_datatype_commit(&temptype); + tmp_buf = (char *) malloc(total_rsize); /* tmp_buf is still valid if total_rsize is 0 */ + if (!tmp_buf) { + err = OMPI_ERR_OUT_OF_RESOURCE; + goto node_leader_out; } /* Up Iscatterv */ - up_comm->c_coll->coll_iscatterv(NULL, NULL, NULL, NULL, (void *) tmp_buf, total_up_scount, - temptype, root_up_rank, up_comm, &iscatterv_req, + up_comm->c_coll->coll_iscatterv(NULL, NULL, NULL, NULL, (void *) tmp_buf, total_rsize, + MPI_BYTE, root_up_rank, up_comm, &iscatterv_req, up_comm->c_coll->coll_iscatterv_module); ompi_request_wait(&iscatterv_req, MPI_STATUS_IGNORE); /* Low Scatterv */ - low_comm->c_coll->coll_scatterv((void *) tmp_buf, low_scounts, low_displs, temptype, rbuf, + OMPI_COUNT_ARRAY_INIT(&low_scounts_desc, low_scounts); + OMPI_DISP_ARRAY_INIT(&low_displs_desc, low_displs); + low_comm->c_coll->coll_scatterv((void *) tmp_buf, &low_scounts_desc, &low_displs_desc, MPI_BYTE, rbuf, rcount, rdtype, root_low_rank, low_comm, low_comm->c_coll->coll_scatterv_module); @@ -385,15 +385,9 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int if (low_displs) { free(low_displs); } - if (low_data_size) { - free(low_data_size); - } if (tmp_buf) { free(tmp_buf); } - if (MPI_BYTE != temptype) { - ompi_datatype_destroy(&temptype); - } return err; } diff --git a/ompi/mca/coll/hcoll/coll_hcoll.h b/ompi/mca/coll/hcoll/coll_hcoll.h index e5bd8f37de5..64a93c4dc69 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll.h +++ b/ompi/mca/coll/hcoll/coll_hcoll.h @@ -193,8 +193,8 @@ int mca_coll_hcoll_allgather(const void *sbuf, size_t scount, int mca_coll_hcoll_allgatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcount, - const int *displs, + void *rbuf, ompi_count_array *rcount, + ompi_disp_array *displs, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -219,7 +219,7 @@ int mca_coll_hcoll_reduce_scatter_block(const void *sbuf, void *rbuf, size_t rco struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, const int* rcounts, +int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -239,27 +239,27 @@ int mca_coll_hcoll_alltoall(const void *sbuf, size_t scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_hcoll_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +int mca_coll_hcoll_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_hcoll_gatherv(const void* sbuf, int scount, +int mca_coll_hcoll_gatherv(const void* sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *displs, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *displs, +int mca_coll_hcoll_scatterv(const void* sbuf, ompi_count_array *scounts, ompi_disp_array *displs, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -283,10 +283,10 @@ int mca_coll_hcoll_iallgather(const void *sbuf, size_t scount, ompi_request_t** request, mca_coll_base_module_t *module); -int mca_coll_hcoll_iallgatherv(const void *sbuf, int scount, +int mca_coll_hcoll_iallgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcount, - const int *displs, + void *rbuf, ompi_count_array *rcount, + ompi_disp_array *displs, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t** request, @@ -316,20 +316,20 @@ int mca_coll_hcoll_ialltoall(const void *sbuf, size_t scount, mca_coll_base_module_t *module); #if HCOLL_API >= HCOLL_VERSION(3,7) -int mca_coll_hcoll_ialltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +int mca_coll_hcoll_ialltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t **req, mca_coll_base_module_t *module); #endif -int mca_coll_hcoll_igatherv(const void* sbuf, int scount, +int mca_coll_hcoll_igatherv(const void* sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *displs, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/hcoll/coll_hcoll_ops.c b/ompi/mca/coll/hcoll/coll_hcoll_ops.c index fec81adcbc1..dbd75f9390b 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_ops.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_ops.c @@ -108,8 +108,8 @@ int mca_coll_hcoll_allgather(const void *sbuf, size_t scount, int mca_coll_hcoll_allgatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcount, - const int *displs, + void *rbuf, ompi_count_array *rcount, + ompi_disp_array *displs, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -121,7 +121,8 @@ int mca_coll_hcoll_allgatherv(const void *sbuf, int scount, mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(rcount))) { /*If we are here then datatype is not simple predefined datatype */ /*In future we need to add more complex mapping to the dte_data_representation_t */ /* Now use fallback */ @@ -136,8 +137,14 @@ int mca_coll_hcoll_allgatherv(const void *sbuf, int scount, hcoll_module->previous_allgatherv_module); return rc; } - rc = hcoll_collectives.coll_allgatherv((void *)sbuf,scount,stype,rbuf,(int*)rcount, - (int*)displs,rtype,hcoll_module->hcoll_context); + rc = hcoll_collectives.coll_allgatherv((void *)sbuf, + scount, + stype, + rbuf, + (void *)ompi_count_array_ptr(rcount), + (void *)ompi_disp_array_ptr(displs), + rtype, + hcoll_module->hcoll_context); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK ALLGATHERV"); rc = hcoll_module->previous_allgatherv(sbuf,scount,sdtype, @@ -332,9 +339,9 @@ int mca_coll_hcoll_alltoall(const void *sbuf, size_t scount, return rc; } -int mca_coll_hcoll_alltoallv(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_hcoll_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -346,7 +353,8 @@ int mca_coll_hcoll_alltoallv(const void *sbuf, const int *scounts, const int *sd mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(scounts))) { HCOL_VERBOSE(20,"Ompi_datatype is not supported: sdtype = %s, rdtype = %s; calling fallback alltoallv;", sdtype->super.name, rdtype->super.name); @@ -355,8 +363,14 @@ int mca_coll_hcoll_alltoallv(const void *sbuf, const int *scounts, const int *sd comm, hcoll_module->previous_alltoallv_module); return rc; } - rc = hcoll_collectives.coll_alltoallv(sbuf, scounts, sdisps, stype, - rbuf, rcounts, rdisps, rtype, + rc = hcoll_collectives.coll_alltoallv((void *)sbuf, + (void *)ompi_count_array_ptr(scounts), + (void *)ompi_disp_array_ptr(sdisps), + stype, + rbuf, + (void *)ompi_count_array_ptr(rcounts), + (void *)ompi_disp_array_ptr(rdisps), + rtype, hcoll_module->hcoll_context); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK ALLTOALLV"); @@ -367,9 +381,9 @@ int mca_coll_hcoll_alltoallv(const void *sbuf, const int *scounts, const int *sd return rc; } -int mca_coll_hcoll_gatherv(const void* sbuf, int scount, +int mca_coll_hcoll_gatherv(const void* sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *displs, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -388,7 +402,8 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount, stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(rcounts))) { /*If we are here then datatype is not simple predefined datatype */ /*In future we need to add more complex mapping to the dte_data_representation_t */ /* Now use fallback */ @@ -400,9 +415,15 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount, comm, hcoll_module->previous_gatherv_module); return rc; } - rc = hcoll_collectives.coll_gatherv(sbuf, scount, stype, rbuf, - rcounts, displs, rtype, - root, hcoll_module->hcoll_context); + rc = hcoll_collectives.coll_gatherv((void *)sbuf, + scount, + stype, + rbuf, + (void *)ompi_count_array_ptr(rcounts), + (void *)ompi_disp_array_ptr(displs), + rtype, + root, + hcoll_module->hcoll_context); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK GATHERV"); rc = hcoll_module->previous_gatherv(sbuf,scount,sdtype, @@ -413,9 +434,9 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount, } -int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *displs, +int mca_coll_hcoll_scatterv(const void* sbuf, ompi_count_array *scounts, ompi_disp_array *displs, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -439,7 +460,8 @@ int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *dis assert(root == comm->c_my_rank); rtype = stype; } - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(scounts))) { /*If we are here then datatype is not simple predefined datatype */ /*In future we need to add more complex mapping to the dte_data_representation_t */ /* Now use fallback */ @@ -451,12 +473,25 @@ int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *dis comm, hcoll_module->previous_scatterv_module); return rc; } - rc = hcoll_collectives.coll_scatterv(sbuf, scounts, displs, stype, rbuf, rcount, rtype, root, hcoll_module->hcoll_context); + rc = hcoll_collectives.coll_scatterv((void *)sbuf, + (void *)ompi_count_array_ptr(scounts), + (void *)ompi_disp_array_ptr(displs), + stype, + rbuf, + rcount, + rtype, + root, + hcoll_module->hcoll_context); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK SCATTERV"); - rc = hcoll_module->previous_scatterv(sbuf, scounts, displs, sdtype, - rbuf, rcount, rdtype, root, - comm, hcoll_module->previous_scatterv_module); + rc = hcoll_module->previous_scatterv(sbuf, scounts, displs, + sdtype, + rbuf, + rcount, + rdtype, + root, + comm, + hcoll_module->previous_scatterv_module); } return rc; } @@ -552,10 +587,10 @@ int mca_coll_hcoll_iallgather(const void *sbuf, size_t scount, return rc; } #if HCOLL_API >= HCOLL_VERSION(3,5) -int mca_coll_hcoll_iallgatherv(const void *sbuf, int scount, +int mca_coll_hcoll_iallgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcount, - const int *displs, + void *rbuf, ompi_count_array *rcount, + ompi_disp_array *displs, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -569,7 +604,8 @@ int mca_coll_hcoll_iallgatherv(const void *sbuf, int scount, stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); void **rt_handle = (void **) request; - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(rcount))) { /*If we are here then datatype is not simple predefined datatype */ /*In future we need to add more complex mapping to the dte_data_representation_t */ /* Now use fallback */ @@ -585,7 +621,13 @@ int mca_coll_hcoll_iallgatherv(const void *sbuf, int scount, hcoll_module->previous_iallgatherv_module); return rc; } - rc = hcoll_collectives.coll_iallgatherv((void *)sbuf,scount,stype,rbuf,(int*)rcount,(int*)displs,rtype, + rc = hcoll_collectives.coll_iallgatherv((void *)sbuf, + scount, + stype, + rbuf, + (void *)ompi_count_array_ptr(rcount), + (void *)ompi_disp_array_ptr(displs), + rtype, hcoll_module->hcoll_context, rt_handle); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK NON-BLOCKING ALLGATHER"); @@ -706,9 +748,9 @@ int mca_coll_hcoll_ireduce(const void *sbuf, void *rbuf, size_t count, return rc; } #endif -int mca_coll_hcoll_igatherv(const void* sbuf, int scount, +int mca_coll_hcoll_igatherv(const void* sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *displs, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *displs, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -731,7 +773,8 @@ int mca_coll_hcoll_igatherv(const void* sbuf, int scount, stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(rcounts))) { /*If we are here then datatype is not simple predefined datatype */ /*In future we need to add more complex mapping to the dte_data_representation_t */ /* Now use fallback */ @@ -744,7 +787,16 @@ int mca_coll_hcoll_igatherv(const void* sbuf, int scount, hcoll_module->previous_igatherv_module); return rc; } - rc = hcoll_collectives.coll_igatherv((void *)sbuf, scount, stype, rbuf, (int *)rcounts, (int *)displs, rtype, root, hcoll_module->hcoll_context, rt_handle); + rc = hcoll_collectives.coll_igatherv((void *)sbuf, + scount, + stype, + rbuf, + (void *)ompi_count_array_ptr(rcounts), + (void *)ompi_disp_array_ptr(displs), + rtype, + root, + hcoll_module->hcoll_context, + rt_handle); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK IGATHERV"); rc = hcoll_module->previous_igatherv(sbuf,scount,sdtype, @@ -758,9 +810,9 @@ int mca_coll_hcoll_igatherv(const void* sbuf, int scount, #if HCOLL_API >= HCOLL_VERSION(3,7) -int mca_coll_hcoll_ialltoallv(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_hcoll_ialltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -773,7 +825,8 @@ int mca_coll_hcoll_ialltoallv(const void *sbuf, const int *scounts, const int *s mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype) + || ompi_count_array_is_64bit(scounts))) { HCOL_VERBOSE(20,"Ompi_datatype is not supported: sdtype = %s, rdtype = %s; calling fallback ialltoallv;", sdtype->super.name, rdtype->super.name); @@ -782,9 +835,16 @@ int mca_coll_hcoll_ialltoallv(const void *sbuf, const int *scounts, const int *s comm, request, hcoll_module->previous_alltoallv_module); return rc; } - rc = hcoll_collectives.coll_ialltoallv(sbuf, scounts, sdisps, stype, - rbuf, rcounts, rdisps, rtype, - hcoll_module->hcoll_context, (void**)request); + rc = hcoll_collectives.coll_ialltoallv((void *)sbuf, + (void *)ompi_count_array_ptr(scounts), + (void *)ompi_disp_array_ptr(sdisps), + stype, + rbuf, + (void *)ompi_count_array_ptr(rcounts), + (void *)ompi_disp_array_ptr(rdisps), + rtype, + hcoll_module->hcoll_context, + (void**)request); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK IALLTOALLV"); rc = hcoll_module->previous_ialltoallv(sbuf, scounts, sdisps, sdtype, @@ -837,7 +897,7 @@ int mca_coll_hcoll_reduce_scatter_block(const void *sbuf, void *rbuf, size_t rco return rc; } -int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -848,7 +908,7 @@ int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, const int *rcoun HCOL_VERBOSE(20,"RUNNING HCOL REDUCE SCATTER"); mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; Dtype = ompi_dtype_2_hcoll_dtype(dtype, NO_DERIVED); - if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(Dtype))){ + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(Dtype) || ompi_count_array_is_64bit(rcounts))){ /*If we are here then datatype is not simple predefined datatype */ /*In future we need to add more complex mapping to the dte_data_representation_t */ /* Now use fallback */ @@ -867,8 +927,12 @@ int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, const int *rcoun goto fallback; } - rc = hcoll_collectives.coll_reduce_scatter(sbuf, rbuf, rcounts, - Dtype, Op, hcoll_module->hcoll_context); + rc = hcoll_collectives.coll_reduce_scatter((void *)sbuf, + rbuf, + (void *)ompi_count_array_ptr(rcounts), + Dtype, + Op, + hcoll_module->hcoll_context); if (HCOLL_SUCCESS != rc){ fallback: HCOL_VERBOSE(20,"RUNNING FALLBACK ALLREDUCE"); diff --git a/ompi/mca/coll/inter/coll_inter.h b/ompi/mca/coll/inter/coll_inter.h index 4596c792307..3360d3fcd6f 100644 --- a/ompi/mca/coll/inter/coll_inter.h +++ b/ompi/mca/coll/inter/coll_inter.h @@ -57,9 +57,9 @@ int mca_coll_inter_allgather_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_inter_allgatherv_inter(const void *sbuf, int scount, +int mca_coll_inter_allgatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -80,9 +80,9 @@ int mca_coll_inter_gather_inter(const void *sbuf, size_t scount, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_inter_gatherv_inter(const void *sbuf, int scount, +int mca_coll_inter_gatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -98,9 +98,9 @@ int mca_coll_inter_scatter_inter(const void *sbuf, size_t scount, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_inter_scatterv_inter(const void *sbuf, const int *scounts, const int *disps, +int mca_coll_inter_scatterv_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); diff --git a/ompi/mca/coll/inter/coll_inter_allgatherv.c b/ompi/mca/coll/inter/coll_inter_allgatherv.c index 7a35e25a9c6..e639df0d1df 100644 --- a/ompi/mca/coll/inter/coll_inter_allgatherv.c +++ b/ompi/mca/coll/inter/coll_inter_allgatherv.c @@ -41,16 +41,19 @@ * Returns: - MPI_SUCCESS or error code */ int -mca_coll_inter_allgatherv_inter(const void *sbuf, int scount, +mca_coll_inter_allgatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { int i, rank, size, size_local, err; size_t total = 0; - int *count=NULL,*displace=NULL; + size_t *count=NULL; + ptrdiff_t *displace=NULL; + ompi_count_array count_arg; + ompi_disp_array displace_arg; char *ptmp_free=NULL, *ptmp=NULL; ompi_datatype_t *ndtype = NULL; @@ -59,18 +62,18 @@ mca_coll_inter_allgatherv_inter(const void *sbuf, int scount, size = ompi_comm_remote_size(comm); if (0 == rank) { - count = (int *)malloc(sizeof(int) * size_local); - displace = (int *)malloc(sizeof(int) * size_local); + count = (size_t *)malloc(sizeof(size_t) * size_local); + displace = (ptrdiff_t *)malloc(sizeof(ptrdiff_t) * size_local); if ((NULL == count) || (NULL == displace)) { err = OMPI_ERR_OUT_OF_RESOURCE; goto exit; } } /* Local gather to get the scount of each process */ - err = comm->c_local_comm->c_coll->coll_gather(&scount, 1, MPI_INT, - count, 1, MPI_INT, - 0, comm->c_local_comm, - comm->c_local_comm->c_coll->coll_gather_module); + err = comm->c_local_comm->c_coll->coll_gather(&scount, sizeof(size_t), MPI_BYTE, + count, sizeof(size_t), MPI_BYTE, + 0, comm->c_local_comm, + comm->c_local_comm->c_coll->coll_gather_module); if (OMPI_SUCCESS != err) { goto exit; } @@ -94,16 +97,31 @@ mca_coll_inter_allgatherv_inter(const void *sbuf, int scount, ptmp = ptmp_free - gap; } } + OMPI_COUNT_ARRAY_INIT(&count_arg, count); + OMPI_DISP_ARRAY_INIT(&displace_arg, displace); err = comm->c_local_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, - ptmp, count, displace, - sdtype,0, comm->c_local_comm, - comm->c_local_comm->c_coll->coll_gatherv_module); + ptmp, &count_arg, &displace_arg, + sdtype,0, comm->c_local_comm, + comm->c_local_comm->c_coll->coll_gatherv_module); if (OMPI_SUCCESS != err) { goto exit; } - ompi_datatype_create_indexed(size,rcounts,disps,rdtype,&ndtype); + /* TODO:BIGCOUNT: Remove tehese temporaries once ompi_datatype is updated for bigcount */ + int *tmp_rcounts = malloc(sizeof(int) * size); + int *tmp_disps = malloc(sizeof(int) * size); + if (NULL == tmp_rcounts || NULL == tmp_disps) { + err = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; + } + for (i = 0; i < size; ++i) { + tmp_rcounts[i] = (int) ompi_count_array_get(rcounts, i); + tmp_disps[i] = (int) ompi_disp_array_get(disps, i); + } + ompi_datatype_create_indexed(size,tmp_rcounts,tmp_disps,rdtype,&ndtype); ompi_datatype_commit(&ndtype); + free(tmp_rcounts); + free(tmp_disps); if (0 == rank) { /* Exchange data between roots */ diff --git a/ompi/mca/coll/inter/coll_inter_gatherv.c b/ompi/mca/coll/inter/coll_inter_gatherv.c index 3ee00890348..f3937a20aef 100644 --- a/ompi/mca/coll/inter/coll_inter_gatherv.c +++ b/ompi/mca/coll/inter/coll_inter_gatherv.c @@ -38,16 +38,19 @@ * Returns: - MPI_SUCCESS or error code */ int -mca_coll_inter_gatherv_inter(const void *sbuf, int scount, +mca_coll_inter_gatherv_inter(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { int i, rank, size, size_local, err; size_t total = 0; - int *count=NULL, *displace=NULL; + size_t *count=NULL; + ptrdiff_t *displace=NULL; + ompi_count_array count_arg; + ompi_disp_array displace_arg; char *ptmp_free=NULL, *ptmp=NULL; ompi_datatype_t *ndtype; @@ -59,8 +62,20 @@ mca_coll_inter_gatherv_inter(const void *sbuf, int scount, size_local = ompi_comm_size(comm); if (MPI_ROOT == root) { /* I am the root, receiving the data from zero. */ - ompi_datatype_create_indexed(size, rcounts, disps, rdtype, &ndtype); + /* TODO:BIGCOUNT: Remove these temporaries once ompi_datatype is updated for bigcount */ + int *tmp_rcounts = malloc(sizeof(int) * size); + int *tmp_disps = malloc(sizeof(int) * size); + if (NULL == tmp_rcounts || NULL == tmp_disps) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + for (i = 0; i < size; ++i) { + tmp_rcounts[i] = ompi_count_array_get(rcounts, i); + tmp_disps[i] = ompi_disp_array_get(disps, i); + } + ompi_datatype_create_indexed(size, tmp_rcounts, tmp_disps, rdtype, &ndtype); ompi_datatype_commit(&ndtype); + free(tmp_rcounts); + free(tmp_disps); err = MCA_PML_CALL(recv(rbuf, 1, ndtype, 0, MCA_COLL_BASE_TAG_GATHERV, @@ -70,18 +85,18 @@ mca_coll_inter_gatherv_inter(const void *sbuf, int scount, } if (0 == rank) { - count = (int *)malloc(sizeof(int) * size_local); - displace = (int *)malloc(sizeof(int) * size_local); + count = (size_t *)malloc(sizeof(size_t) * size_local); + displace = (ptrdiff_t *)malloc(sizeof(ptrdiff_t) * size_local); if ((NULL == displace) || (NULL == count)) { err = OMPI_ERR_OUT_OF_RESOURCE; goto exit; } } - err = comm->c_local_comm->c_coll->coll_gather(&scount, 1, MPI_INT, - count, 1, MPI_INT, - 0, comm->c_local_comm, - comm->c_local_comm->c_coll->coll_gather_module); + err = comm->c_local_comm->c_coll->coll_gather(&scount, sizeof(size_t), MPI_BYTE, + count, sizeof(size_t), MPI_BYTE, + 0, comm->c_local_comm, + comm->c_local_comm->c_coll->coll_gather_module); if (OMPI_SUCCESS != err) { goto exit; } @@ -105,10 +120,12 @@ mca_coll_inter_gatherv_inter(const void *sbuf, int scount, ptmp = ptmp_free - gap; } } + OMPI_COUNT_ARRAY_INIT(&count_arg, count); + OMPI_DISP_ARRAY_INIT(&displace_arg, displace); err = comm->c_local_comm->c_coll->coll_gatherv(sbuf, scount, sdtype, - ptmp, count, displace, - sdtype,0, comm->c_local_comm, - comm->c_local_comm->c_coll->coll_gatherv_module); + ptmp, &count_arg, &displace_arg, + sdtype,0, comm->c_local_comm, + comm->c_local_comm->c_coll->coll_gatherv_module); if (OMPI_SUCCESS != err) { goto exit; } diff --git a/ompi/mca/coll/inter/coll_inter_scatterv.c b/ompi/mca/coll/inter/coll_inter_scatterv.c index ba40a488f74..88443bf7e97 100644 --- a/ompi/mca/coll/inter/coll_inter_scatterv.c +++ b/ompi/mca/coll/inter/coll_inter_scatterv.c @@ -39,16 +39,19 @@ * Returns: - MPI_SUCCESS or error code */ int -mca_coll_inter_scatterv_inter(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +mca_coll_inter_scatterv_inter(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { int i, rank, size, err, size_local; size_t total = 0; - int *counts=NULL,*displace=NULL; + size_t *counts=NULL; + ptrdiff_t *displace=NULL; + ompi_count_array counts_arg; + ompi_disp_array displace_arg; char *ptmp_free=NULL, *ptmp=NULL; ompi_datatype_t *ndtype; @@ -64,8 +67,8 @@ mca_coll_inter_scatterv_inter(const void *sbuf, const int *scounts, } else if (MPI_ROOT != root) { if(0 == rank) { /* local root receives the counts from the root */ - counts = (int *)malloc(sizeof(int) * size_local); - err = MCA_PML_CALL(recv(counts, size_local, MPI_INT, + counts = (size_t *)malloc(sizeof(size_t) * size_local); + err = MCA_PML_CALL(recv(counts, sizeof(size_t) * size_local, MPI_BYTE, root, MCA_COLL_BASE_TAG_SCATTERV, comm, MPI_STATUS_IGNORE)); if (OMPI_SUCCESS != err) { @@ -91,14 +94,16 @@ mca_coll_inter_scatterv_inter(const void *sbuf, const int *scounts, return err; } /* set the local displacement i.e. no displacements here */ - displace = (int *)malloc(sizeof(int) * size_local); + displace = (ptrdiff_t *)malloc(sizeof(ptrdiff_t) * size_local); displace[0] = 0; for (i = 1; i < size_local; i++) { displace[i] = displace[i-1] + counts[i-1]; } } /* perform the scatterv locally */ - err = comm->c_local_comm->c_coll->coll_scatterv(ptmp, counts, displace, + OMPI_COUNT_ARRAY_INIT(&counts_arg, counts); + OMPI_DISP_ARRAY_INIT(&displace_arg, displace); + err = comm->c_local_comm->c_coll->coll_scatterv(ptmp, &counts_arg, &displace_arg, rdtype, rbuf, rcount, rdtype, 0, comm->c_local_comm, comm->c_local_comm->c_coll->coll_scatterv_module); @@ -117,15 +122,37 @@ mca_coll_inter_scatterv_inter(const void *sbuf, const int *scounts, } } else { - err = MCA_PML_CALL(send(scounts, size, MPI_INT, 0, + /* We must ensure that rank 0 receives a size_t array */ + size_t *tmp_scounts_root = malloc(sizeof(size_t) * size); + if (NULL == tmp_scounts_root) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + for (i = 0; i < size; ++i) { + tmp_scounts_root[i] = ompi_count_array_get(scounts, i); + } + err = MCA_PML_CALL(send(tmp_scounts_root, sizeof(size_t) * size, MPI_BYTE, 0, MCA_COLL_BASE_TAG_SCATTERV, MCA_PML_BASE_SEND_STANDARD, comm)); + free(tmp_scounts_root); + if (OMPI_SUCCESS != err) { return err; } - ompi_datatype_create_indexed(size,scounts,disps,sdtype,&ndtype); + /* TODO:BIGCOUNT: Remove these temporaries once ompi_datatype is updated for bigcount */ + int *tmp_scounts = malloc(sizeof(int) * size); + int *tmp_disps = malloc(sizeof(int) * size); + if (NULL == tmp_scounts || NULL == tmp_disps) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + for (i = 0; i < size; ++i) { + tmp_scounts[i] = (int) ompi_count_array_get(scounts, i); + tmp_disps[i] = (int) ompi_disp_array_get(disps, i); + } + ompi_datatype_create_indexed(size,tmp_scounts,tmp_disps,sdtype,&ndtype); ompi_datatype_commit(&ndtype); + free(tmp_scounts); + free(tmp_disps); err = MCA_PML_CALL(send(sbuf, 1, ndtype, 0, MCA_COLL_BASE_TAG_SCATTERV, diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index b4c94ce760c..c520e7f7669 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -164,7 +164,8 @@ int NBC_Progress(NBC_Handle *handle); int ompi_coll_libnbc_iallgather(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_iallgatherv(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, @@ -173,12 +174,12 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, size_t count int ompi_coll_libnbc_ialltoall(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_ialltoallv(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ialltoallw(const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, +int ompi_coll_libnbc_ialltoallw(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t **request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -192,14 +193,14 @@ int ompi_coll_libnbc_iexscan(const void *sbuf, void *rbuf, size_t count, struct int ompi_coll_libnbc_igather(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_igatherv(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ireduce_scatter(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_ireduce_scatter(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ireduce_scatter_block(const void *sbuf, void *rbuf, size_t rcount, struct ompi_datatype_t *dtype, @@ -213,8 +214,8 @@ int ompi_coll_libnbc_iscatter(const void* sendbuf, size_t sendcount, MPI_Datatyp void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_iscatterv(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); @@ -222,21 +223,22 @@ int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const int ompi_coll_libnbc_iallgather_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t *module); +int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, + MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t *module); int ompi_coll_libnbc_iallreduce_inter(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ialltoall_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ialltoallv_inter(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_ialltoallv_inter(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ialltoallw_inter(const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, +int ompi_coll_libnbc_ialltoallw_inter(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t **request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -247,14 +249,14 @@ int ompi_coll_libnbc_ibcast_inter(void *buffer, size_t count, MPI_Datatype datat int ompi_coll_libnbc_igather_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ireduce_inter(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ireduce_scatter_inter(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_ireduce_scatter_inter(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ireduce_scatter_block_inter(const void *sbuf, void *rbuf, size_t rcount, struct ompi_datatype_t *dtype, @@ -265,8 +267,8 @@ int ompi_coll_libnbc_iscatter_inter(const void* sendbuf, size_t sendcount, MPI_D void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); @@ -274,26 +276,27 @@ int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, const int *sendcounts, int ompi_coll_libnbc_ineighbor_allgather(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, size_t rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, - const int *rcounts, const int *displs, MPI_Datatype rtype, +int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, + ompi_count_array *rcounts, ompi_disp_array *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_ineighbor_alltoall(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, size_t rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, const int *sdispls, MPI_Datatype stype, - void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, +int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdispls, MPI_Datatype stype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *stypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, +int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *stypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_allgather_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_allgatherv_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_allreduce_init(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, @@ -302,12 +305,12 @@ int ompi_coll_libnbc_allreduce_init(const void* sendbuf, void* recvbuf, size_t c int ompi_coll_libnbc_alltoall_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_alltoallv_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_alltoallw_init(const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, +int ompi_coll_libnbc_alltoallw_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t **request, mca_coll_base_module_t *module); int ompi_coll_libnbc_barrier_init(struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, @@ -321,14 +324,14 @@ int ompi_coll_libnbc_exscan_init(const void *sbuf, void *rbuf, size_t count, str int ompi_coll_libnbc_gather_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_gatherv_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_reduce_init(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_reduce_scatter_block_init(const void *sbuf, void *rbuf, size_t rcount, struct ompi_datatype_t *dtype, @@ -341,15 +344,16 @@ int ompi_coll_libnbc_scatter_init(const void* sendbuf, size_t sendcount, MPI_Dat void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_scatterv_init(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_scatterv_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_allgather_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_allgatherv_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_allreduce_inter_init(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, @@ -358,12 +362,12 @@ int ompi_coll_libnbc_allreduce_inter_init(const void* sendbuf, void* recvbuf, si int ompi_coll_libnbc_alltoall_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_alltoallv_inter_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_alltoallv_inter_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_alltoallw_inter_init(const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t * const *rdtypes, +int ompi_coll_libnbc_alltoallw_inter_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t **request, mca_coll_base_module_t *module); int ompi_coll_libnbc_barrier_inter_init(struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, @@ -374,14 +378,14 @@ int ompi_coll_libnbc_bcast_inter_init(void *buffer, size_t count, MPI_Datatype d int ompi_coll_libnbc_gather_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_gatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_gatherv_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_reduce_inter_init(const void* sendbuf, void* recvbuf, size_t count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_reduce_scatter_inter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_reduce_scatter_inter_init(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_reduce_scatter_block_inter_init(const void *sbuf, void *rbuf, size_t rcount, struct ompi_datatype_t *dtype, @@ -392,27 +396,27 @@ int ompi_coll_libnbc_scatter_inter_init(const void* sendbuf, size_t sendcount, M void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_scatterv_inter_init(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_scatterv_inter_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_neighbor_allgather_init(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, size_t rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_neighbor_allgatherv_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, - const int *rcounts, const int *displs, MPI_Datatype rtype, +int ompi_coll_libnbc_neighbor_allgatherv_init(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, + ompi_count_array *rcounts, ompi_disp_array *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); int ompi_coll_libnbc_neighbor_alltoall_init(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, size_t rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, const int *sdispls, MPI_Datatype stype, - void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, +int ompi_coll_libnbc_neighbor_alltoallv_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdispls, MPI_Datatype stype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); -int ompi_coll_libnbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *stypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, +int ompi_coll_libnbc_neighbor_alltoallw_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *stypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module); diff --git a/ompi/mca/coll/libnbc/nbc_iallgatherv.c b/ompi/mca/coll/libnbc/nbc_iallgatherv.c index 31d0d57333c..540c93ee3e0 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_iallgatherv.c @@ -34,7 +34,8 @@ * second round: * each node sends to node (rank+2)%p sendcount elements * each node receives from node (rank-2)%p recvcounts[(rank+2)%p] elements */ -static int nbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +static int nbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { @@ -57,11 +58,11 @@ static int nbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype if (inplace) { sendtype = recvtype; - sendcount = recvcounts[rank]; + sendcount = ompi_count_array_get(recvcounts, rank); } else if (!persistent) { /* for persistent, the copy must be scheduled */ /* copy my data to receive buffer */ - rbuf = (char *) recvbuf + displs[rank] * rcvext; - res = NBC_Copy (sendbuf, sendcount, sendtype, rbuf, recvcounts[rank], recvtype, comm); + rbuf = (char *) recvbuf + ompi_disp_array_get(displs, rank) * rcvext; + res = NBC_Copy (sendbuf, sendcount, sendtype, rbuf, ompi_count_array_get(recvcounts, rank), recvtype, comm); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -72,12 +73,12 @@ static int nbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype return OMPI_ERR_OUT_OF_RESOURCE; } - sbuf = (char *) recvbuf + displs[rank] * rcvext; + sbuf = (char *) recvbuf + ompi_disp_array_get(displs, rank) * rcvext; if (persistent && !inplace) { /* for nonblocking, data has been copied already */ /* copy my data to receive buffer (= send buffer of NBC_Sched_send) */ res = NBC_Sched_copy ((void *)sendbuf, false, sendcount, sendtype, - sbuf, false, recvcounts[rank], recvtype, schedule, true); + sbuf, false, ompi_count_array_get(recvcounts, rank), recvtype, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -88,16 +89,16 @@ static int nbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype for (int r = 1 ; r < p ; ++r) { speer = (rank + r) % p; rpeer = (rank - r + p) % p; - rbuf = (char *)recvbuf + displs[rpeer] * rcvext; + rbuf = (char *)recvbuf + ompi_disp_array_get(displs, rpeer) * rcvext; - res = NBC_Sched_recv (rbuf, false, recvcounts[rpeer], recvtype, rpeer, schedule, false); + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, rpeer), recvtype, rpeer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; } /* send to rank r - not from the sendbuf to optimize MPI_IN_PLACE */ - res = NBC_Sched_send (sbuf, false, recvcounts[rank], recvtype, speer, schedule, false); + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(recvcounts, rank), recvtype, speer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -119,7 +120,8 @@ static int nbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype return OMPI_SUCCESS; } -int ompi_coll_libnbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_iallgatherv(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_allgatherv_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, @@ -138,7 +140,8 @@ int ompi_coll_libnbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatyp return OMPI_SUCCESS; } -static int nbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +static int nbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { @@ -162,10 +165,10 @@ static int nbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Dat /* do rsize rounds */ for (int r = 0 ; r < rsize ; ++r) { - char *rbuf = (char *) recvbuf + displs[r] * rcvext; + char *rbuf = (char *) recvbuf + ompi_disp_array_get(displs, r) * rcvext; - if (recvcounts[r]) { - res = NBC_Sched_recv (rbuf, false, recvcounts[r], recvtype, r, schedule, false); + if (ompi_count_array_get(recvcounts, r)) { + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, r), recvtype, r, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -198,7 +201,8 @@ static int nbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Dat return OMPI_SUCCESS; } -int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_allgatherv_inter_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, @@ -217,7 +221,8 @@ int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_D return OMPI_SUCCESS; } -int ompi_coll_libnbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_allgatherv_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_allgatherv_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, @@ -229,7 +234,8 @@ int ompi_coll_libnbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Dat return OMPI_SUCCESS; } -int ompi_coll_libnbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, +int ompi_coll_libnbc_allgatherv_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_allgatherv_inter_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallv.c b/ompi/mca/coll/libnbc/nbc_ialltoallv.c index 80833a37c2c..9734bad06a8 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallv.c @@ -22,19 +22,19 @@ #include "nbc_internal.h" static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, - const int *sdispls, MPI_Aint sndext, MPI_Datatype sendtype, const size_t sdtype_size, - void *recvbuf, const int *recvcounts, - const int *rdispls, MPI_Aint rcvext, MPI_Datatype recvtype, const size_t rdtype_size); + const void *sendbuf, ompi_count_array *sendcounts, + ompi_disp_array *sdispls, MPI_Aint sndext, MPI_Datatype sendtype, const size_t sdtype_size, + void *recvbuf, ompi_count_array *recvcounts, + ompi_disp_array *rdispls, MPI_Aint rcvext, MPI_Datatype recvtype, const size_t rdtype_size); static inline int a2av_sched_pairwise(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, MPI_Aint sndext, MPI_Datatype sendtype, const size_t sdtype_size, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Aint rcvext, MPI_Datatype recvtype, const size_t rdtype_size); static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule, - void *buf, const int *counts, const int *displs, + void *buf, ompi_count_array *counts, ompi_disp_array *displs, MPI_Aint ext, MPI_Datatype type, const size_t dtype_size, ptrdiff_t gap); /* an alltoallv schedule can not be cached easily because the contents @@ -42,8 +42,8 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule, * would not be sufficient ... we simply do not cache it */ /* simple linear Alltoallv */ -static int nbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +static int nbc_alltoallv_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { @@ -70,10 +70,10 @@ static int nbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const /* copy data to receivbuffer */ if (inplace) { - int count = 0; + size_t count = 0; for (int i = 0; i < p; i++) { - if (recvcounts[i] > count) { - count = recvcounts[i]; + if (ompi_count_array_get(recvcounts, i) > count) { + count = ompi_count_array_get(recvcounts, i); } } span = opal_datatype_span(&recvtype->super, count, &gap); @@ -110,11 +110,11 @@ static int nbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const return OMPI_ERR_OUT_OF_RESOURCE; } - if (!inplace && 0 < sendcounts[rank] && 0 < sdtype_size) { - rbuf = (char *) recvbuf + rdispls[rank] * rcvext; - sbuf = (char *) sendbuf + sdispls[rank] * sndext; - res = NBC_Sched_copy (sbuf, false, sendcounts[rank], sendtype, - rbuf, false, recvcounts[rank], recvtype, schedule, false); + if (!inplace && 0 < ompi_count_array_get(sendcounts, rank) && 0 < sdtype_size) { + rbuf = (char *) recvbuf + ompi_disp_array_get(rdispls, rank) * rcvext; + sbuf = (char *) sendbuf + ompi_disp_array_get(sdispls, rank) * sndext; + res = NBC_Sched_copy (sbuf, false, ompi_count_array_get(sendcounts, rank), sendtype, + rbuf, false, ompi_count_array_get(recvcounts, rank), recvtype, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -152,8 +152,8 @@ static int nbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const return OMPI_SUCCESS; } -int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_ialltoallv(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, @@ -174,8 +174,8 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons } /* simple linear Alltoallv */ -static int nbc_alltoallv_inter_init (const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +static int nbc_alltoallv_inter_init (const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { @@ -209,18 +209,18 @@ static int nbc_alltoallv_inter_init (const void* sendbuf, const int *sendcounts, for (int i = 0; i < rsize; i++) { /* post all sends */ - if (0 < sendcounts[i] && 0 < sdtype_size) { - char *sbuf = (char *) sendbuf + sdispls[i] * sndext; - res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtype, i, schedule, false); + if (0 < ompi_count_array_get(sendcounts, i) && 0 < sdtype_size) { + char *sbuf = (char *) sendbuf + ompi_disp_array_get(sdispls, i) * sndext; + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(sendcounts, i), sendtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; } } /* post all receives */ - if (0 < recvcounts[i] && 0 < rdtype_size) { - char *rbuf = (char *) recvbuf + rdispls[i] * rcvext; - res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtype, i, schedule, false); + if (0 < ompi_count_array_get(recvcounts, i) && 0 < rdtype_size) { + char *rbuf = (char *) recvbuf + ompi_disp_array_get(rdispls, i) * rcvext; + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, i), recvtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -243,8 +243,8 @@ static int nbc_alltoallv_inter_init (const void* sendbuf, const int *sendcounts, return OMPI_SUCCESS; } -int ompi_coll_libnbc_ialltoallv_inter (const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_ialltoallv_inter (const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallv_inter_init(sendbuf, sendcounts, sdispls, sendtype, @@ -266,9 +266,9 @@ int ompi_coll_libnbc_ialltoallv_inter (const void* sendbuf, const int *sendcount __opal_attribute_unused__ static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, MPI_Aint sndext, MPI_Datatype sendtype, const size_t sdtype_size, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Aint rcvext, MPI_Datatype recvtype, const size_t rdtype_size) { int res; @@ -278,18 +278,18 @@ static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule, } /* post send */ - if (0 < sendcounts[i] && 0 < sdtype_size) { - char *sbuf = ((char *) sendbuf) + (sdispls[i] * sndext); - res = NBC_Sched_send(sbuf, false, sendcounts[i], sendtype, i, schedule, false); + if (0 < ompi_count_array_get(sendcounts, i) && 0 < sdtype_size) { + char *sbuf = ((char *) sendbuf) + (ompi_disp_array_get(sdispls, i) * sndext); + res = NBC_Sched_send(sbuf, false, ompi_count_array_get(sendcounts, i), sendtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } /* post receive */ - if (0 < recvcounts[i] && 0 < rdtype_size) { - char *rbuf = ((char *) recvbuf) + (rdispls[i] * rcvext); - res = NBC_Sched_recv(rbuf, false, recvcounts[i], recvtype, i, schedule, false); + if (0 < ompi_count_array_get(recvcounts, i) && 0 < rdtype_size) { + char *rbuf = ((char *) recvbuf) + (ompi_disp_array_get(rdispls, i) * rcvext); + res = NBC_Sched_recv(rbuf, false, ompi_count_array_get(recvcounts, i), recvtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -301,9 +301,9 @@ static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule, __opal_attribute_unused__ static inline int a2av_sched_pairwise(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, MPI_Aint sndext, MPI_Datatype sendtype, const size_t sdtype_size, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Aint rcvext, MPI_Datatype recvtype, const size_t rdtype_size) { int res; @@ -312,18 +312,18 @@ static inline int a2av_sched_pairwise(int rank, int p, NBC_Schedule *schedule, int rcvpeer = (rank + p - i) %p; /* post send */ - if (0 < sendcounts[sndpeer] && 0 < sdtype_size) { - char *sbuf = ((char *) sendbuf) + (sdispls[sndpeer] * sndext); - res = NBC_Sched_send(sbuf, false, sendcounts[sndpeer], sendtype, sndpeer, schedule, false); + if (0 < ompi_count_array_get(sendcounts, sndpeer) && 0 < sdtype_size) { + char *sbuf = ((char *) sendbuf) + (ompi_disp_array_get(sdispls, sndpeer) * sndext); + res = NBC_Sched_send(sbuf, false, ompi_count_array_get(sendcounts, sndpeer), sendtype, sndpeer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } /* post receive */ - if (0 < recvcounts[rcvpeer] && 0 < rdtype_size) { - char *rbuf = ((char *) recvbuf) + (rdispls[rcvpeer] * rcvext); - res = NBC_Sched_recv(rbuf, false, recvcounts[rcvpeer], recvtype, rcvpeer, schedule, true); + if (0 < ompi_count_array_get(recvcounts, rcvpeer) && 0 < rdtype_size) { + char *rbuf = ((char *) recvbuf) + (ompi_disp_array_get(rdispls, rcvpeer) * rcvext); + res = NBC_Sched_recv(rbuf, false, ompi_count_array_get(recvcounts, rcvpeer), recvtype, rcvpeer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -334,50 +334,50 @@ static inline int a2av_sched_pairwise(int rank, int p, NBC_Schedule *schedule, } static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule, - void *buf, const int *counts, const int *displs, + void *buf, ompi_count_array *counts, ompi_disp_array *displs, MPI_Aint ext, MPI_Datatype type, const size_t dtype_size, ptrdiff_t gap) { int res; for (int i = 1; i < (p+1)/2; i++) { int speer = (rank + i) % p; int rpeer = (rank + p - i) % p; - char *sbuf = (char *) buf + displs[speer] * ext; - char *rbuf = (char *) buf + displs[rpeer] * ext; + char *sbuf = (char *) buf + ompi_disp_array_get(displs, speer) * ext; + char *rbuf = (char *) buf + ompi_disp_array_get(displs, rpeer) * ext; if (0 == dtype_size) { /* Nothing to exchange */ return OMPI_SUCCESS; } - if (0 < counts[rpeer]) { - res = NBC_Sched_copy (rbuf, false, counts[rpeer], type, - (void *)(-gap), true, counts[rpeer], type, + if (0 < ompi_count_array_get(counts, rpeer)) { + res = NBC_Sched_copy (rbuf, false, ompi_count_array_get(counts, rpeer), type, + (void *)(-gap), true, ompi_count_array_get(counts, rpeer), type, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 < counts[speer]) { - res = NBC_Sched_send (sbuf, false , counts[speer], type, speer, schedule, false); + if (0 < ompi_count_array_get(counts, speer)) { + res = NBC_Sched_send (sbuf, false , ompi_count_array_get(counts, speer), type, speer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 < counts[rpeer]) { - res = NBC_Sched_recv (rbuf, false , counts[rpeer], type, rpeer, schedule, true); + if (0 < ompi_count_array_get(counts, rpeer)) { + res = NBC_Sched_recv (rbuf, false , ompi_count_array_get(counts, rpeer), type, rpeer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 < counts[rpeer]) { - res = NBC_Sched_send ((void *)(-gap), true, counts[rpeer], type, rpeer, schedule, false); + if (0 < ompi_count_array_get(counts, rpeer)) { + res = NBC_Sched_send ((void *)(-gap), true, ompi_count_array_get(counts, rpeer), type, rpeer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 < counts[speer]) { - res = NBC_Sched_recv (sbuf, false, counts[speer], type, speer, schedule, true); + if (0 < ompi_count_array_get(counts, speer)) { + res = NBC_Sched_recv (sbuf, false, ompi_count_array_get(counts, speer), type, speer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -385,22 +385,23 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule, } if (0 == (p%2)) { int peer = (rank + p/2) % p; - char *tbuf = (char *) buf + displs[peer] * ext; + char *tbuf = (char *) buf + ompi_disp_array_get(displs, peer) * ext; - if (0 < counts[peer]) { - res = NBC_Sched_copy(tbuf, false, counts[peer], type, (void *) (-gap), true, counts[peer], + if (0 < ompi_count_array_get(counts, peer)) { + res = NBC_Sched_copy(tbuf, false, ompi_count_array_get(counts, peer), type, + (void *) (-gap), true, ompi_count_array_get(counts, peer), type, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 < counts[peer]) { - res = NBC_Sched_send ((void *)(-gap), true , counts[peer], type, peer, schedule, false); + if (0 < ompi_count_array_get(counts, peer)) { + res = NBC_Sched_send ((void *)(-gap), true, ompi_count_array_get(counts, peer), type, peer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Sched_recv (tbuf, false , counts[peer], type, peer, schedule, true); + res = NBC_Sched_recv (tbuf, false , ompi_count_array_get(counts, peer), type, peer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -410,8 +411,8 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule, return OMPI_SUCCESS; } -int ompi_coll_libnbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_alltoallv_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, @@ -423,8 +424,8 @@ int ompi_coll_libnbc_alltoallv_init(const void* sendbuf, const int *sendcounts, return OMPI_SUCCESS; } -int ompi_coll_libnbc_alltoallv_inter_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_alltoallv_inter_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + MPI_Datatype sendtype, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallv_inter_init(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallw.c b/ompi/mca/coll/libnbc/nbc_ialltoallw.c index ce1d7c2bd54..890610e7584 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallw.c @@ -21,19 +21,19 @@ #include "nbc_internal.h" static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t * const * sendtypes, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const * recvtypes); static inline int a2aw_sched_pairwise(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t * const * sendtypes, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const * recvtypes); static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, - void *buf, const int *counts, const int *displs, + void *buf, ompi_count_array *counts, ompi_disp_array *displs, struct ompi_datatype_t * const * types); /* an alltoallw schedule can not be cached easily because the contents @@ -41,8 +41,8 @@ static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, * would not be sufficient ... we simply do not cache it */ /* simple linear Alltoallw */ -static int nbc_alltoallw_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, +static int nbc_alltoallw_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + struct ompi_datatype_t * const *sendtypes, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { @@ -62,7 +62,7 @@ static int nbc_alltoallw_init(const void* sendbuf, const int *sendcounts, const if (inplace) { ptrdiff_t lgap, lspan; for (int i = 0; i < p; i++) { - lspan = opal_datatype_span(&recvtypes[i]->super, recvcounts[i], &lgap); + lspan = opal_datatype_span(&recvtypes[i]->super, ompi_count_array_get(recvcounts, i), &lgap); if (lspan > span) { span = lspan; } @@ -91,11 +91,11 @@ static int nbc_alltoallw_init(const void* sendbuf, const int *sendcounts, const return OMPI_ERR_OUT_OF_RESOURCE; } - if (!inplace && sendcounts[rank] != 0) { - rbuf = (char *) recvbuf + rdispls[rank]; - sbuf = (char *) sendbuf + sdispls[rank]; - res = NBC_Sched_copy(sbuf, false, sendcounts[rank], sendtypes[rank], - rbuf, false, recvcounts[rank], recvtypes[rank], schedule, false); + if (!inplace && ompi_count_array_get(sendcounts, rank) != 0) { + rbuf = (char *) recvbuf + ompi_disp_array_get(rdispls, rank); + sbuf = (char *) sendbuf + ompi_disp_array_get(sdispls, rank); + res = NBC_Sched_copy(sbuf, false, ompi_count_array_get(sendcounts, rank), sendtypes[rank], + rbuf, false, ompi_count_array_get(recvcounts, rank), recvtypes[rank], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -132,8 +132,8 @@ static int nbc_alltoallw_init(const void* sendbuf, const int *sendcounts, const return OMPI_SUCCESS; } -int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, const int *sdispls, - struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_ialltoallw(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + struct ompi_datatype_t * const *sendtypes, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, @@ -154,8 +154,8 @@ int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, cons } /* simple linear Alltoallw */ -static int nbc_alltoallw_inter_init (const void* sendbuf, const int *sendcounts, const int *sdispls, - struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, +static int nbc_alltoallw_inter_init (const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + struct ompi_datatype_t * const *sendtypes, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { @@ -173,18 +173,18 @@ static int nbc_alltoallw_inter_init (const void* sendbuf, const int *sendcounts, for (int i = 0 ; i < rsize ; ++i) { /* post all sends */ - if (sendcounts[i] != 0) { - sbuf = (char *) sendbuf + sdispls[i]; - res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtypes[i], i, schedule, false); + if (ompi_count_array_get(sendcounts, i) != 0) { + sbuf = (char *) sendbuf + ompi_disp_array_get(sdispls, i); + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(sendcounts, i), sendtypes[i], i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; } } /* post all receives */ - if (recvcounts[i] != 0) { - rbuf = (char *) recvbuf + rdispls[i]; - res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtypes[i], i, schedule, false); + if (ompi_count_array_get(recvcounts, i) != 0) { + rbuf = (char *) recvbuf + ompi_disp_array_get(rdispls, i); + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, i), recvtypes[i], i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -207,8 +207,8 @@ static int nbc_alltoallw_inter_init (const void* sendbuf, const int *sendcounts, return OMPI_SUCCESS; } -int ompi_coll_libnbc_ialltoallw_inter(const void* sendbuf, const int *sendcounts, const int *sdispls, - struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_ialltoallw_inter(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + struct ompi_datatype_t * const *sendtypes, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallw_inter_init(sendbuf, sendcounts, sdispls, sendtypes, @@ -229,9 +229,9 @@ int ompi_coll_libnbc_ialltoallw_inter(const void* sendbuf, const int *sendcounts } static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t * const * sendtypes, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const * recvtypes) { int res; @@ -242,19 +242,19 @@ static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule, } /* post send */ - span = opal_datatype_span(&sendtypes[i]->super, sendcounts[i], &gap); + span = opal_datatype_span(&sendtypes[i]->super, ompi_count_array_get(sendcounts, i), &gap); if (OPAL_LIKELY(0 < span)) { - char *sbuf = (char *) sendbuf + sdispls[i]; - res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtypes[i], i, schedule, false); + char *sbuf = (char *) sendbuf + ompi_disp_array_get(sdispls, i); + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(sendcounts, i), sendtypes[i], i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } /* post receive */ - span = opal_datatype_span(&recvtypes[i]->super, recvcounts[i], &gap); + span = opal_datatype_span(&recvtypes[i]->super, ompi_count_array_get(recvcounts, i), &gap); if (OPAL_LIKELY(0 < span)) { - char *rbuf = (char *) recvbuf + rdispls[i]; - res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtypes[i], i, schedule, false); + char *rbuf = (char *) recvbuf + ompi_disp_array_get(rdispls, i); + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, i), recvtypes[i], i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -266,9 +266,9 @@ static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule, __opal_attribute_unused__ static inline int a2aw_sched_pairwise(int rank, int p, NBC_Schedule *schedule, - const void *sendbuf, const int *sendcounts, const int *sdispls, + const void *sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, struct ompi_datatype_t * const * sendtypes, - void *recvbuf, const int *recvcounts, const int *rdispls, + void *recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const * recvtypes) { int res; @@ -277,17 +277,17 @@ static inline int a2aw_sched_pairwise(int rank, int p, NBC_Schedule *schedule, int rcvpeer = (rank + p - i) % p; /* post send */ - if (sendcounts[sndpeer] != 0) { - char *sbuf = (char *) sendbuf + sdispls[sndpeer]; - res = NBC_Sched_send (sbuf, false, sendcounts[sndpeer], sendtypes[sndpeer], sndpeer, schedule, false); + if (ompi_count_array_get(sendcounts, sndpeer) != 0) { + char *sbuf = (char *) sendbuf + ompi_disp_array_get(sdispls, sndpeer); + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(sendcounts, sndpeer), sendtypes[sndpeer], sndpeer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } /* post receive */ - if (recvcounts[rcvpeer] != 0) { - char *rbuf = (char *) recvbuf + rdispls[rcvpeer]; - res = NBC_Sched_recv (rbuf, false, recvcounts[rcvpeer], recvtypes[rcvpeer], rcvpeer, schedule, true); + if (ompi_count_array_get(recvcounts, rcvpeer) != 0) { + char *rbuf = (char *) recvbuf + ompi_disp_array_get(rdispls, rcvpeer); + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, rcvpeer), recvtypes[rcvpeer], rcvpeer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -298,7 +298,7 @@ static inline int a2aw_sched_pairwise(int rank, int p, NBC_Schedule *schedule, } static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, - void *buf, const int *counts, const int *displs, + void *buf, ompi_count_array *counts, ompi_disp_array *displs, struct ompi_datatype_t * const * types) { ptrdiff_t gap = 0; int res; @@ -306,39 +306,39 @@ static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, for (int i = 1; i < (p+1)/2; i++) { int speer = (rank + i) % p; int rpeer = (rank + p - i) % p; - char *sbuf = (char *) buf + displs[speer]; - char *rbuf = (char *) buf + displs[rpeer]; + char *sbuf = (char *) buf + ompi_disp_array_get(displs, speer); + char *rbuf = (char *) buf + ompi_disp_array_get(displs, rpeer); - if (0 != counts[rpeer]) { - (void)opal_datatype_span(&types[rpeer]->super, counts[rpeer], &gap); - res = NBC_Sched_copy (rbuf, false, counts[rpeer], types[rpeer], - (void *)(-gap), true, counts[rpeer], types[rpeer], + if (0 != ompi_count_array_get(counts, rpeer)) { + (void)opal_datatype_span(&types[rpeer]->super, ompi_count_array_get(counts, rpeer), &gap); + res = NBC_Sched_copy (rbuf, false, ompi_count_array_get(counts, rpeer), types[rpeer], + (void *)(-gap), true, ompi_count_array_get(counts, rpeer), types[rpeer], schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 != counts[speer]) { - res = NBC_Sched_send (sbuf, false , counts[speer], types[speer], speer, schedule, false); + if (0 != ompi_count_array_get(counts, speer)) { + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(counts, speer), types[speer], speer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 != counts[rpeer]) { - res = NBC_Sched_recv (rbuf, false , counts[rpeer], types[rpeer], rpeer, schedule, true); + if (0 != ompi_count_array_get(counts, rpeer)) { + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(counts, rpeer), types[rpeer], rpeer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 != counts[rpeer]) { - res = NBC_Sched_send ((void *)(-gap), true, counts[rpeer], types[rpeer], rpeer, schedule, false); + if (0 != ompi_count_array_get(counts, rpeer)) { + res = NBC_Sched_send ((void *)(-gap), true, ompi_count_array_get(counts, rpeer), types[rpeer], rpeer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } } - if (0 != counts[speer]) { - res = NBC_Sched_recv (sbuf, false, counts[speer], types[speer], speer, schedule, true); + if (0 != ompi_count_array_get(counts, speer)) { + res = NBC_Sched_recv (sbuf, false, ompi_count_array_get(counts, speer), types[speer], speer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -347,19 +347,19 @@ static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, if (0 == (p%2)) { int peer = (rank + p/2) % p; - char *tbuf = (char *) buf + displs[peer]; - (void)opal_datatype_span(&types[peer]->super, counts[peer], &gap); - res = NBC_Sched_copy (tbuf, false, counts[peer], types[peer], - (void *)(-gap), true, counts[peer], types[peer], + char *tbuf = (char *) buf + ompi_disp_array_get(displs, peer); + (void)opal_datatype_span(&types[peer]->super, ompi_count_array_get(counts, peer), &gap); + res = NBC_Sched_copy (tbuf, false, ompi_count_array_get(counts, peer), types[peer], + (void *)(-gap), true, ompi_count_array_get(counts, peer), types[peer], schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Sched_send ((void *)(-gap), true , counts[peer], types[peer], peer, schedule, false); + res = NBC_Sched_send ((void *)(-gap), true, ompi_count_array_get(counts, peer), types[peer], peer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Sched_recv (tbuf, false , counts[peer], types[peer], peer, schedule, true); + res = NBC_Sched_recv (tbuf, false, ompi_count_array_get(counts, peer), types[peer], peer, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -368,8 +368,8 @@ static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, return OMPI_SUCCESS; } -int ompi_coll_libnbc_alltoallw_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_alltoallw_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + struct ompi_datatype_t * const *sendtypes, void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, @@ -381,8 +381,9 @@ int ompi_coll_libnbc_alltoallw_init(const void* sendbuf, const int *sendcounts, return OMPI_SUCCESS; } -int ompi_coll_libnbc_alltoallw_inter_init(const void* sendbuf, const int *sendcounts, const int *sdispls, - struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, +int ompi_coll_libnbc_alltoallw_inter_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *sdispls, + struct ompi_datatype_t * const *sendtypes, void* recvbuf, + ompi_count_array *recvcounts, ompi_disp_array *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_alltoallw_inter_init(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, diff --git a/ompi/mca/coll/libnbc/nbc_igatherv.c b/ompi/mca/coll/libnbc/nbc_igatherv.c index fc8d6756888..eff77c5ad50 100644 --- a/ompi/mca/coll/libnbc/nbc_igatherv.c +++ b/ompi/mca/coll/libnbc/nbc_igatherv.c @@ -30,7 +30,7 @@ static int nbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int rank, p, res; @@ -68,12 +68,12 @@ static int nbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sen } } else { for (int i = 0 ; i < p ; ++i) { - rbuf = (char *) recvbuf + displs[i] * rcvext; + rbuf = (char *) recvbuf + ompi_disp_array_get(displs, i) * rcvext; if (i == root) { if (!inplace) { /* if I am the root - just copy the message */ res = NBC_Sched_copy ((void *)sendbuf, false, sendcount, sendtype, - rbuf, false, recvcounts[i], recvtype, schedule, false); + rbuf, false, ompi_count_array_get(recvcounts, i), recvtype, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -81,7 +81,7 @@ static int nbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sen } } else { /* root receives message to the right buffer */ - res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtype, i, schedule, false); + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, i), recvtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -105,8 +105,8 @@ static int nbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sen return OMPI_SUCCESS; } -int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_igatherv(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_gatherv_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, @@ -125,8 +125,8 @@ int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype s return OMPI_SUCCESS; } -static int nbc_gatherv_inter_init (const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +static int nbc_gatherv_inter_init (const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int res, rsize; @@ -160,9 +160,9 @@ static int nbc_gatherv_inter_init (const void* sendbuf, int sendcount, MPI_Datat } } else if (MPI_ROOT == root) { for (int i = 0 ; i < rsize ; ++i) { - rbuf = (char *) recvbuf + displs[i] * rcvext; + rbuf = (char *) recvbuf + ompi_disp_array_get(displs, i) * rcvext; /* root receives message to the right buffer */ - res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtype, i, schedule, false); + res = NBC_Sched_recv (rbuf, false, ompi_count_array_get(recvcounts, i), recvtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -185,8 +185,8 @@ static int nbc_gatherv_inter_init (const void* sendbuf, int sendcount, MPI_Datat return OMPI_SUCCESS; } -int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_gatherv_inter_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, @@ -205,8 +205,8 @@ int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, int sendcount, MPI_Data return OMPI_SUCCESS; } -int ompi_coll_libnbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_gatherv_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_gatherv_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, @@ -218,8 +218,8 @@ int ompi_coll_libnbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Dataty return OMPI_SUCCESS; } -int ompi_coll_libnbc_gatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, +int ompi_coll_libnbc_gatherv_inter_init(const void* sendbuf, size_t sendcount, MPI_Datatype sendtype, + void* recvbuf, ompi_count_array *recvcounts, ompi_disp_array *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_gatherv_inter_init(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c index 3994c578657..70da143b7bd 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c @@ -45,7 +45,7 @@ int NBC_Ineighbor_allgatherv_args_compare(NBC_Ineighbor_allgatherv_args *a, NBC_ static int nbc_neighbor_allgatherv_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, - const int *rcounts, const int *displs, MPI_Datatype rtype, + ompi_count_array *rcounts, ompi_disp_array *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; @@ -87,7 +87,8 @@ static int nbc_neighbor_allgatherv_init(const void *sbuf, int scount, MPI_Dataty /* simply loop over neighbors and post send/recv operations */ for (int i = 0 ; i < indegree ; ++i) { if (srcs[i] != MPI_PROC_NULL) { - res = NBC_Sched_recv ((char *) rbuf + displs[i] * rcvext, false, rcounts[i], rtype, srcs[i], schedule, false); + res = NBC_Sched_recv ((char *) rbuf + ompi_disp_array_get(displs, i) * rcvext, + false, ompi_count_array_get(rcounts, i), rtype, srcs[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { break; } @@ -164,8 +165,8 @@ static int nbc_neighbor_allgatherv_init(const void *sbuf, int scount, MPI_Dataty return OMPI_SUCCESS; } -int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, - const int *rcounts, const int *displs, MPI_Datatype rtype, +int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, + ompi_count_array *rcounts, ompi_disp_array *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_neighbor_allgatherv_init(sbuf, scount, stype, rbuf, rcounts, displs, rtype, @@ -183,8 +184,8 @@ int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Data return OMPI_SUCCESS; } -int ompi_coll_libnbc_neighbor_allgatherv_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, - const int *rcounts, const int *displs, MPI_Datatype rtype, +int ompi_coll_libnbc_neighbor_allgatherv_init(const void *sbuf, size_t scount, MPI_Datatype stype, void *rbuf, + ompi_count_array *rcounts, ompi_disp_array *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_neighbor_allgatherv_init(sbuf, scount, stype, rbuf, rcounts, displs, rtype, diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c index 763c017692f..eccdfcb1db3 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c @@ -44,8 +44,8 @@ int NBC_Ineighbor_alltoallv_args_compare(NBC_Ineighbor_alltoallv_args *a, NBC_In #endif -static int nbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, const int *sdispls, MPI_Datatype stype, - void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, +static int nbc_neighbor_alltoallv_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdispls, MPI_Datatype stype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; @@ -93,7 +93,8 @@ static int nbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, con /* simply loop over neighbors and post send/recv operations */ for (int i = 0 ; i < indegree ; ++i) { if (srcs[i] != MPI_PROC_NULL) { - res = NBC_Sched_recv ((char *) rbuf + rdispls[i] * rcvext, false, rcounts[i], rtype, srcs[i], schedule, false); + res = NBC_Sched_recv ((char *) rbuf + ompi_disp_array_get(rdispls, i) * rcvext, false, + ompi_count_array_get(rcounts, i), rtype, srcs[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { break; } @@ -110,7 +111,8 @@ static int nbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, con for (int i = 0 ; i < outdegree ; ++i) { if (dsts[i] != MPI_PROC_NULL) { - res = NBC_Sched_send ((char *) sbuf + sdispls[i] * sndext, false, scounts[i], stype, dsts[i], schedule, false); + res = NBC_Sched_send ((char *) sbuf + ompi_disp_array_get(sdispls, i) * sndext, false, + ompi_count_array_get(scounts, i), stype, dsts[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { break; } @@ -171,8 +173,8 @@ static int nbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, con return OMPI_SUCCESS; } -int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, const int *sdispls, MPI_Datatype stype, - void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, +int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdispls, MPI_Datatype stype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_neighbor_alltoallv_init(sbuf, scounts, sdispls, stype, rbuf, rcounts, rdispls, rtype, @@ -190,8 +192,8 @@ int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, c return OMPI_SUCCESS; } -int ompi_coll_libnbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, const int *sdispls, MPI_Datatype stype, - void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, +int ompi_coll_libnbc_neighbor_alltoallv_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdispls, MPI_Datatype stype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_neighbor_alltoallv_init(sbuf, scounts, sdispls, stype, rbuf, rcounts, rdispls, rtype, diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c index 021f71a5dd7..13cdd709d41 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c @@ -43,8 +43,8 @@ int NBC_Ineighbor_alltoallw_args_compare(NBC_Ineighbor_alltoallw_args *a, NBC_In } #endif -static int nbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *stypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, +static int nbc_neighbor_alltoallw_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *stypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; @@ -79,7 +79,8 @@ static int nbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, con /* simply loop over neighbors and post send/recv operations */ for (int i = 0 ; i < indegree ; ++i) { if (srcs[i] != MPI_PROC_NULL) { - res = NBC_Sched_recv ((char *) rbuf + rdisps[i], false, rcounts[i], rtypes[i], srcs[i], schedule, false); + res = NBC_Sched_recv ((char *) rbuf + ompi_disp_array_get(rdisps, i), false, + ompi_count_array_get(rcounts, i), rtypes[i], srcs[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { break; } @@ -96,7 +97,8 @@ static int nbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, con for (int i = 0 ; i < outdegree ; ++i) { if (dsts[i] != MPI_PROC_NULL) { - res = NBC_Sched_send ((char *) sbuf + sdisps[i], false, scounts[i], stypes[i], dsts[i], schedule, false); + res = NBC_Sched_send ((char *) sbuf + ompi_disp_array_get(sdisps, i), false, + ompi_count_array_get(scounts, i), stypes[i], dsts[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { break; } @@ -156,8 +158,8 @@ static int nbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, con return OMPI_SUCCESS; } -int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *stypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, +int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *stypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_neighbor_alltoallw_init(sbuf, scounts, sdisps, stypes, rbuf, rcounts, rdisps, rtypes, @@ -175,8 +177,8 @@ int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, c return OMPI_SUCCESS; } -int ompi_coll_libnbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *stypes, - void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, +int ompi_coll_libnbc_neighbor_alltoallw_init(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *stypes, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_neighbor_alltoallw_init(sbuf, scounts, sdisps, stypes, rbuf, rcounts, rdisps, rtypes, diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c index e34024800e1..ca1d6965a54 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c @@ -42,7 +42,7 @@ * */ -static int nbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +static int nbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int peer, rank, maxr, p, res; @@ -68,13 +68,13 @@ static int nbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int count = 0; for (int r = 0 ; r < p ; ++r) { - count += recvcounts[r]; + count += ompi_count_array_get(recvcounts, r); } if ((1 == p && (!persistent || inplace)) || 0 == count) { if (!inplace) { /* single node not in_place: copy data to recvbuf */ - res = NBC_Copy(sendbuf, recvcounts[0], datatype, recvbuf, recvcounts[0], datatype, comm); + res = NBC_Copy(sendbuf, ompi_count_array_get(recvcounts, 0), datatype, recvbuf, ompi_count_array_get(recvcounts, 0), datatype, comm); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -164,10 +164,10 @@ static int nbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int if (rank == 0) { size_t offset = 0; for (long int r = 1 ; r < p ; ++r) { - offset += recvcounts[r-1]; + offset += ompi_count_array_get(recvcounts, r-1); sbuf = lbuf + (offset*ext); /* root sends the right buffer to the right receiver */ - res = NBC_Sched_send (sbuf, true, recvcounts[r], datatype, r, schedule, + res = NBC_Sched_send (sbuf, true, ompi_count_array_get(recvcounts, r), datatype, r, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); @@ -178,14 +178,14 @@ static int nbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int if (p == 1) { /* single node not in_place: copy data to recvbuf */ - res = NBC_Sched_copy ((void *)sendbuf, false, recvcounts[0], datatype, - recvbuf, false, recvcounts[0], datatype, schedule, false); + res = NBC_Sched_copy ((void *)sendbuf, false, ompi_count_array_get(recvcounts, 0), datatype, + recvbuf, false, ompi_count_array_get(recvcounts, 0), datatype, schedule, false); } else { - res = NBC_Sched_copy (lbuf, true, recvcounts[0], datatype, recvbuf, false, - recvcounts[0], datatype, schedule, false); + res = NBC_Sched_copy (lbuf, true, ompi_count_array_get(recvcounts, 0), datatype, recvbuf, false, + ompi_count_array_get(recvcounts, 0), datatype, schedule, false); } } else { - res = NBC_Sched_recv (recvbuf, false, recvcounts[rank], datatype, 0, schedule, false); + res = NBC_Sched_recv (recvbuf, false, ompi_count_array_get(recvcounts, rank), datatype, 0, schedule, false); } if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { @@ -211,7 +211,7 @@ static int nbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int return OMPI_SUCCESS; } -int ompi_coll_libnbc_ireduce_scatter (const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_ireduce_scatter (const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_reduce_scatter_init(sendbuf, recvbuf, recvcounts, datatype, op, @@ -228,7 +228,7 @@ int ompi_coll_libnbc_ireduce_scatter (const void* sendbuf, void* recvbuf, const return OMPI_SUCCESS; } -static int nbc_reduce_scatter_inter_init (const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +static int nbc_reduce_scatter_inter_init (const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int rank, res, lsize, rsize; @@ -251,7 +251,7 @@ static int nbc_reduce_scatter_inter_init (const void* sendbuf, void* recvbuf, co count = 0; for (int r = 0 ; r < lsize ; ++r) { - count += recvcounts[r]; + count += ompi_count_array_get(recvcounts, r); } span = opal_datatype_span(&datatype->super, count, &gap); @@ -309,16 +309,16 @@ static int nbc_reduce_scatter_inter_init (const void* sendbuf, void* recvbuf, co } /* do the local scatterv with the local communicator */ - res = NBC_Sched_copy (lbuf, true, recvcounts[0], datatype, recvbuf, false, - recvcounts[0], datatype, schedule, false); + res = NBC_Sched_copy (lbuf, true, ompi_count_array_get(recvcounts, 0), datatype, recvbuf, false, + ompi_count_array_get(recvcounts, 0), datatype, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); return res; } - size_t offset = recvcounts[0] * ext; + size_t offset = ompi_count_array_get(recvcounts, 0) * ext; for (int peer = 1; peer < lsize ; ++peer) { - res = NBC_Sched_local_send (lbuf + offset, true, recvcounts[peer], datatype, peer, schedule, + res = NBC_Sched_local_send (lbuf + offset, true, ompi_count_array_get(recvcounts, peer), datatype, peer, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); @@ -326,11 +326,11 @@ static int nbc_reduce_scatter_inter_init (const void* sendbuf, void* recvbuf, co return res; } - offset += recvcounts[peer] * ext; + offset += ompi_count_array_get(recvcounts, peer) * ext; } } else { /* receive my block */ - res = NBC_Sched_local_recv (recvbuf, false, recvcounts[rank], datatype, 0, schedule, false); + res = NBC_Sched_local_recv (recvbuf, false, ompi_count_array_get(recvcounts, rank), datatype, 0, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -355,7 +355,7 @@ static int nbc_reduce_scatter_inter_init (const void* sendbuf, void* recvbuf, co return OMPI_SUCCESS; } -int ompi_coll_libnbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_reduce_scatter_inter_init(sendbuf, recvbuf, recvcounts, datatype, op, @@ -373,7 +373,7 @@ int ompi_coll_libnbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, return OMPI_SUCCESS; } -int ompi_coll_libnbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_reduce_scatter_init(sendbuf, recvbuf, recvcounts, datatype, op, @@ -385,7 +385,7 @@ int ompi_coll_libnbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, con return OMPI_SUCCESS; } -int ompi_coll_libnbc_reduce_scatter_inter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, +int ompi_coll_libnbc_reduce_scatter_inter_init(const void* sendbuf, void* recvbuf, ompi_count_array *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_reduce_scatter_inter_init(sendbuf, recvbuf, recvcounts, datatype, op, diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c index ab7ee0b4b98..89c9c861b61 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c @@ -40,7 +40,7 @@ * */ -static int nbc_reduce_scatter_block_init(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, +static int nbc_reduce_scatter_block_init(const void* sendbuf, void* recvbuf, size_t recvcount, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int peer, rank, maxr, p, res; diff --git a/ompi/mca/coll/libnbc/nbc_iscatterv.c b/ompi/mca/coll/libnbc/nbc_iscatterv.c index eebe285d240..f9323e22668 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatterv.c +++ b/ompi/mca/coll/libnbc/nbc_iscatterv.c @@ -28,8 +28,8 @@ * would not be sufficient ... we simply do not cache it */ /* simple linear MPI_Iscatterv */ -static int nbc_scatterv_init(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +static int nbc_scatterv_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int rank, p, res; @@ -60,18 +60,18 @@ static int nbc_scatterv_init(const void* sendbuf, const int *sendcounts, const i } for (int i = 0 ; i < p ; ++i) { - sbuf = (char *) sendbuf + displs[i] * sndext; + sbuf = (char *) sendbuf + ompi_disp_array_get(displs, i) * sndext; if (i == root) { if (!inplace) { /* if I am the root - just copy the message */ - res = NBC_Sched_copy (sbuf, false, sendcounts[i], sendtype, + res = NBC_Sched_copy (sbuf, false, ompi_count_array_get(sendcounts, i), sendtype, recvbuf, false, recvcount, recvtype, schedule, false); } else { res = OMPI_SUCCESS; } } else { /* root sends the right buffer to the right receiver */ - res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtype, i, schedule, false); + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(sendcounts, i), sendtype, i, schedule, false); } if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { @@ -103,8 +103,8 @@ static int nbc_scatterv_init(const void* sendbuf, const int *sendcounts, const i return OMPI_SUCCESS; } -int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_iscatterv(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_scatterv_init(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, @@ -122,8 +122,8 @@ int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const return OMPI_SUCCESS; } -static int nbc_scatterv_inter_init (const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +static int nbc_scatterv_inter_init (const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module, bool persistent) { int res, rsize; @@ -156,9 +156,9 @@ static int nbc_scatterv_inter_init (const void* sendbuf, const int *sendcounts, } for (int i = 0 ; i < rsize ; ++i) { - sbuf = (char *)sendbuf + displs[i] * sndext; + sbuf = (char *)sendbuf + ompi_disp_array_get(displs, i) * sndext; /* root sends the right buffer to the right receiver */ - res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtype, i, schedule, false); + res = NBC_Sched_send (sbuf, false, ompi_count_array_get(sendcounts, i), sendtype, i, schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -181,8 +181,8 @@ static int nbc_scatterv_inter_init (const void* sendbuf, const int *sendcounts, return OMPI_SUCCESS; } -int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_scatterv_inter_init(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, @@ -200,8 +200,8 @@ int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, const int *sendcounts, return OMPI_SUCCESS; } -int ompi_coll_libnbc_scatterv_init(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_scatterv_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_scatterv_init(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, @@ -213,8 +213,8 @@ int ompi_coll_libnbc_scatterv_init(const void* sendbuf, const int *sendcounts, c return OMPI_SUCCESS; } -int ompi_coll_libnbc_scatterv_inter_init(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, +int ompi_coll_libnbc_scatterv_inter_init(const void* sendbuf, ompi_count_array *sendcounts, ompi_disp_array *displs, MPI_Datatype sendtype, + void* recvbuf, size_t recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, mca_coll_base_module_t *module) { int res = nbc_scatterv_inter_init(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, diff --git a/ompi/mca/coll/monitoring/coll_monitoring.h b/ompi/mca/coll/monitoring/coll_monitoring.h index 784a2e3c205..f812ae01dd1 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring.h +++ b/ompi/mca/coll/monitoring/coll_monitoring.h @@ -53,10 +53,10 @@ extern int mca_coll_monitoring_allgather(const void *sbuf, size_t scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_allgatherv(const void *sbuf, int scount, +extern int mca_coll_monitoring_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *disps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -74,20 +74,20 @@ extern int mca_coll_monitoring_alltoall(const void *sbuf, size_t scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +extern int mca_coll_monitoring_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_alltoallw(const void *sbuf, const int *scounts, - const int *sdisps, +extern int mca_coll_monitoring_alltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -113,9 +113,9 @@ extern int mca_coll_monitoring_gather(const void *sbuf, size_t scount, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_gatherv(const void *sbuf, int scount, +extern int mca_coll_monitoring_gatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -129,7 +129,7 @@ extern int mca_coll_monitoring_reduce(const void *sbuf, void *rbuf, size_t count mca_coll_base_module_t *module); extern int mca_coll_monitoring_reduce_scatter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -156,9 +156,9 @@ extern int mca_coll_monitoring_scatter(const void *sbuf, size_t scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_scatterv(const void *sbuf, const int *scounts, const int *disps, +extern int mca_coll_monitoring_scatterv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -173,10 +173,10 @@ extern int mca_coll_monitoring_iallgather(const void *sbuf, size_t scount, ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_iallgatherv(const void *sbuf, int scount, +extern int mca_coll_monitoring_iallgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *disps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -197,21 +197,21 @@ extern int mca_coll_monitoring_ialltoall(const void *sbuf, size_t scount, ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_ialltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +extern int mca_coll_monitoring_ialltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_ialltoallw(const void *sbuf, const int *scounts, - const int *sdisps, +extern int mca_coll_monitoring_ialltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -242,9 +242,9 @@ extern int mca_coll_monitoring_igather(const void *sbuf, size_t scount, ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_igatherv(const void *sbuf, int scount, +extern int mca_coll_monitoring_igatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -260,7 +260,7 @@ extern int mca_coll_monitoring_ireduce(const void *sbuf, void *rbuf, size_t coun mca_coll_base_module_t *module); extern int mca_coll_monitoring_ireduce_scatter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -291,9 +291,9 @@ extern int mca_coll_monitoring_iscatter(const void *sbuf, size_t scount, ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_iscatterv(const void *sbuf, const int *scounts, const int *disps, +extern int mca_coll_monitoring_iscatterv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -307,9 +307,9 @@ extern int mca_coll_monitoring_neighbor_allgather(const void *sbuf, size_t scoun struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, int scount, +extern int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, void * rbuf, - const int *rcounts, const int *disps, + ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -321,20 +321,20 @@ extern int mca_coll_monitoring_neighbor_alltoall(const void *sbuf, size_t scount struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +extern int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, - const MPI_Aint *sdisps, +extern int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const MPI_Aint *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -346,10 +346,10 @@ extern int mca_coll_monitoring_ineighbor_allgather(const void *sbuf, size_t scou ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, int scount, +extern int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, - const int *disps, + void * rbuf, ompi_count_array *rcounts, + ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -362,21 +362,21 @@ extern int mca_coll_monitoring_ineighbor_alltoall(const void *sbuf, size_t scoun ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +extern int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module); -extern int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts, - const MPI_Aint *sdisps, +extern int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const MPI_Aint *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, diff --git a/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c b/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c index 1794da4bfc9..32ef7fa6435 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_allgatherv.c @@ -15,9 +15,9 @@ #include "ompi/communicator/communicator.h" #include "coll_monitoring.h" -int mca_coll_monitoring_allgatherv(const void *sbuf, int scount, +int mca_coll_monitoring_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -43,9 +43,9 @@ int mca_coll_monitoring_allgatherv(const void *sbuf, int scount, return monitoring_module->real.coll_allgatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, comm, monitoring_module->real.coll_allgatherv_module); } -int mca_coll_monitoring_iallgatherv(const void *sbuf, int scount, +int mca_coll_monitoring_iallgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, diff --git a/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c b/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c index 5238fe45fc7..db1baeaba4c 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_alltoallv.c @@ -15,9 +15,9 @@ #include "ompi/communicator/communicator.h" #include "coll_monitoring.h" -int mca_coll_monitoring_alltoallv(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_monitoring_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -30,7 +30,7 @@ int mca_coll_monitoring_alltoallv(const void *sbuf, const int *scounts, const in ompi_datatype_type_size(sdtype, &type_size); for( i = 0; i < comm_size; ++i ) { if( my_rank == i ) continue; /* No communication for self */ - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -44,11 +44,11 @@ int mca_coll_monitoring_alltoallv(const void *sbuf, const int *scounts, const in return monitoring_module->real.coll_alltoallv(sbuf, scounts, sdisps, sdtype, rbuf, rcounts, rdisps, rdtype, comm, monitoring_module->real.coll_alltoallv_module); } -int mca_coll_monitoring_ialltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +int mca_coll_monitoring_ialltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -62,7 +62,7 @@ int mca_coll_monitoring_ialltoallv(const void *sbuf, const int *scounts, ompi_datatype_type_size(sdtype, &type_size); for( i = 0; i < comm_size; ++i ) { if( my_rank == i ) continue; /* No communication for self */ - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c b/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c index dbba26dc140..02ef0ce1c11 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_alltoallw.c @@ -15,11 +15,11 @@ #include "ompi/communicator/communicator.h" #include "coll_monitoring.h" -int mca_coll_monitoring_alltoallw(const void *sbuf, const int *scounts, - const int *sdisps, +int mca_coll_monitoring_alltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -32,7 +32,7 @@ int mca_coll_monitoring_alltoallw(const void *sbuf, const int *scounts, for( i = 0; i < comm_size; ++i ) { if( my_rank == i ) continue; /* No communication for self */ ompi_datatype_type_size(sdtypes[i], &type_size); - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -46,11 +46,11 @@ int mca_coll_monitoring_alltoallw(const void *sbuf, const int *scounts, return monitoring_module->real.coll_alltoallw(sbuf, scounts, sdisps, sdtypes, rbuf, rcounts, rdisps, rdtypes, comm, monitoring_module->real.coll_alltoallw_module); } -int mca_coll_monitoring_ialltoallw(const void *sbuf, const int *scounts, - const int *sdisps, +int mca_coll_monitoring_ialltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -64,7 +64,7 @@ int mca_coll_monitoring_ialltoallw(const void *sbuf, const int *scounts, for( i = 0; i < comm_size; ++i ) { if( my_rank == i ) continue; /* No communication for self */ ompi_datatype_type_size(sdtypes[i], &type_size); - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/monitoring/coll_monitoring_component.c b/ompi/mca/coll/monitoring/coll_monitoring_component.c index ac0402f69b1..670081fb70c 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_component.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_component.c @@ -20,6 +20,7 @@ #include "ompi/constants.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" +#include "ompi/mca/coll/base/base.h" #include "opal/mca/base/mca_base_component_repository.h" #define MONITORING_INSTALL_COLL_API(__module, __comm, __api) \ diff --git a/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c b/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c index 2e792d5aea4..11c1e678864 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_gatherv.c @@ -15,9 +15,9 @@ #include "ompi/communicator/communicator.h" #include "coll_monitoring.h" -int mca_coll_monitoring_gatherv(const void *sbuf, int scount, +int mca_coll_monitoring_gatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -31,7 +31,7 @@ int mca_coll_monitoring_gatherv(const void *sbuf, int scount, ompi_datatype_type_size(rdtype, &type_size); for( i = 0; i < comm_size; ++i ) { if( root == i ) continue; /* No communication for self */ - data_size = rcounts[i] * type_size; + data_size = ompi_count_array_get(rcounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -46,9 +46,9 @@ int mca_coll_monitoring_gatherv(const void *sbuf, int scount, return monitoring_module->real.coll_gatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, root, comm, monitoring_module->real.coll_gatherv_module); } -int mca_coll_monitoring_igatherv(const void *sbuf, int scount, +int mca_coll_monitoring_igatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -63,7 +63,7 @@ int mca_coll_monitoring_igatherv(const void *sbuf, int scount, ompi_datatype_type_size(rdtype, &type_size); for( i = 0; i < comm_size; ++i ) { if( root == i ) continue; /* No communication for self */ - data_size = rcounts[i] * type_size; + data_size = ompi_count_array_get(rcounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c index 8ffe11a1c0f..dcd5e859e5e 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_allgatherv.c @@ -16,9 +16,9 @@ #include "ompi/mca/topo/base/base.h" #include "coll_monitoring.h" -int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, int scount, +int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -69,9 +69,9 @@ int mca_coll_monitoring_neighbor_allgatherv(const void *sbuf, int scount, return monitoring_module->real.coll_neighbor_allgatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, comm, monitoring_module->real.coll_neighbor_allgatherv_module); } -int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, int scount, +int mca_coll_monitoring_ineighbor_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c index 598ebf8e51e..504b3d163ec 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallv.c @@ -16,9 +16,9 @@ #include "ompi/mca/topo/base/base.h" #include "coll_monitoring.h" -int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, +int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -41,7 +41,7 @@ int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, } if (MPI_PROC_NULL != srank) { - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -54,7 +54,7 @@ int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, } if (MPI_PROC_NULL != drank) { - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -72,11 +72,11 @@ int mca_coll_monitoring_neighbor_alltoallv(const void *sbuf, const int *scounts, return monitoring_module->real.coll_neighbor_alltoallv(sbuf, scounts, sdisps, sdtype, rbuf, rcounts, rdisps, rdtype, comm, monitoring_module->real.coll_neighbor_alltoallv_module); } -int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, +int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -100,7 +100,7 @@ int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts } if (MPI_PROC_NULL != srank) { - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -113,7 +113,7 @@ int mca_coll_monitoring_ineighbor_alltoallv(const void *sbuf, const int *scounts } if (MPI_PROC_NULL != drank) { - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c index 819076daab8..a4d7dac7859 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_neighbor_alltoallw.c @@ -16,11 +16,11 @@ #include "ompi/mca/topo/base/base.h" #include "coll_monitoring.h" -int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, - const MPI_Aint *sdisps, +int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const MPI_Aint *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -42,7 +42,7 @@ int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, if (MPI_PROC_NULL != srank) { ompi_datatype_type_size(sdtypes[i], &type_size); - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -56,7 +56,7 @@ int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, if (MPI_PROC_NULL != drank) { ompi_datatype_type_size(sdtypes[i], &type_size); - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -74,11 +74,11 @@ int mca_coll_monitoring_neighbor_alltoallw(const void *sbuf, const int *scounts, return monitoring_module->real.coll_neighbor_alltoallw(sbuf, scounts, sdisps, sdtypes, rbuf, rcounts, rdisps, rdtypes, comm, monitoring_module->real.coll_neighbor_alltoallw_module); } -int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts, - const MPI_Aint *sdisps, +int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, - const MPI_Aint *rdisps, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -101,7 +101,7 @@ int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts if (MPI_PROC_NULL != srank) { ompi_datatype_type_size(sdtypes[i], &type_size); - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -115,7 +115,7 @@ int mca_coll_monitoring_ineighbor_alltoallw(const void *sbuf, const int *scounts if (MPI_PROC_NULL != drank) { ompi_datatype_type_size(sdtypes[i], &type_size); - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c b/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c index fb31f72f271..563c4216970 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_reduce_scatter.c @@ -17,7 +17,7 @@ #include "coll_monitoring.h" int mca_coll_monitoring_reduce_scatter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -31,7 +31,7 @@ int mca_coll_monitoring_reduce_scatter(const void *sbuf, void *rbuf, ompi_datatype_type_size(dtype, &type_size); for( i = 0; i < comm_size; ++i ) { if( my_rank == i ) continue; /* No communication for self */ - data_size = rcounts[i] * type_size; + data_size = ompi_count_array_get(rcounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -46,7 +46,7 @@ int mca_coll_monitoring_reduce_scatter(const void *sbuf, void *rbuf, } int mca_coll_monitoring_ireduce_scatter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -61,7 +61,7 @@ int mca_coll_monitoring_ireduce_scatter(const void *sbuf, void *rbuf, ompi_datatype_type_size(dtype, &type_size); for( i = 0; i < comm_size; ++i ) { if( my_rank == i ) continue; /* No communication for self */ - data_size = rcounts[i] * type_size; + data_size = ompi_count_array_get(rcounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c b/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c index fb7c72d904e..bc095d37dc7 100644 --- a/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c +++ b/ompi/mca/coll/monitoring/coll_monitoring_scatterv.c @@ -15,9 +15,9 @@ #include "ompi/communicator/communicator.h" #include "coll_monitoring.h" -int mca_coll_monitoring_scatterv(const void *sbuf, const int *scounts, const int *disps, +int mca_coll_monitoring_scatterv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, struct ompi_datatype_t *rdtype, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { @@ -29,7 +29,7 @@ int mca_coll_monitoring_scatterv(const void *sbuf, const int *scounts, const int int i, rank; ompi_datatype_type_size(sdtype, &type_size); for( i = 0; i < comm_size; ++i ) { - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank @@ -44,9 +44,9 @@ int mca_coll_monitoring_scatterv(const void *sbuf, const int *scounts, const int return monitoring_module->real.coll_scatterv(sbuf, scounts, disps, sdtype, rbuf, rcount, rdtype, root, comm, monitoring_module->real.coll_scatterv_module); } -int mca_coll_monitoring_iscatterv(const void *sbuf, const int *scounts, const int *disps, +int mca_coll_monitoring_iscatterv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) @@ -59,7 +59,7 @@ int mca_coll_monitoring_iscatterv(const void *sbuf, const int *scounts, const in int i, rank; ompi_datatype_type_size(sdtype, &type_size); for( i = 0; i < comm_size; ++i ) { - data_size = scounts[i] * type_size; + data_size = ompi_count_array_get(scounts, i) * type_size; /** * If this fails the destination is not part of my MPI_COM_WORLD * Lookup its name in the rank hashtable to get its MPI_COMM_WORLD rank diff --git a/ompi/mca/coll/portals4/coll_portals4.h b/ompi/mca/coll/portals4/coll_portals4.h index 3dc7826d491..dcb6f254413 100644 --- a/ompi/mca/coll/portals4/coll_portals4.h +++ b/ompi/mca/coll/portals4/coll_portals4.h @@ -222,26 +222,26 @@ int ompi_coll_portals4_iallreduce_intra(const void* sendbuf, void* recvbuf, int int ompi_coll_portals4_iallreduce_intra_fini(struct ompi_coll_portals4_request_t *request); -int ompi_coll_portals4_gather_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +int ompi_coll_portals4_gather_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int ompi_coll_portals4_igather_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +int ompi_coll_portals4_igather_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t **request, mca_coll_base_module_t *module); int ompi_coll_portals4_igather_intra_fini(struct ompi_coll_portals4_request_t *request); -int ompi_coll_portals4_scatter_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +int ompi_coll_portals4_scatter_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int ompi_coll_portals4_iscatter_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +int ompi_coll_portals4_iscatter_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t **request, diff --git a/ompi/mca/coll/portals4/coll_portals4_gather.c b/ompi/mca/coll/portals4/coll_portals4_gather.c index b5a2df973eb..aa5b1ba6d1a 100644 --- a/ompi/mca/coll/portals4/coll_portals4_gather.c +++ b/ompi/mca/coll/portals4/coll_portals4_gather.c @@ -505,8 +505,8 @@ cleanup_sync_handles(ompi_coll_portals4_request_t *request) } static int -ompi_coll_portals4_gather_intra_binomial_top(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_gather_intra_binomial_top(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_coll_portals4_request_t *request, @@ -801,8 +801,8 @@ ompi_coll_portals4_gather_intra_binomial_top(const void *sbuf, int scount, struc } static int -ompi_coll_portals4_gather_intra_linear_top(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_gather_intra_linear_top(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_coll_portals4_request_t *request, @@ -1212,8 +1212,8 @@ ompi_coll_portals4_gather_intra_linear_bottom(struct ompi_communicator_t *comm, } int -ompi_coll_portals4_gather_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_gather_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -1284,8 +1284,8 @@ ompi_coll_portals4_gather_intra(const void *sbuf, int scount, struct ompi_dataty int -ompi_coll_portals4_igather_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_igather_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t **ompi_request, diff --git a/ompi/mca/coll/portals4/coll_portals4_scatter.c b/ompi/mca/coll/portals4/coll_portals4_scatter.c index 2640273b54b..706042e049c 100644 --- a/ompi/mca/coll/portals4/coll_portals4_scatter.c +++ b/ompi/mca/coll/portals4/coll_portals4_scatter.c @@ -306,8 +306,8 @@ cleanup_sync_handles(ompi_coll_portals4_request_t *request) } static int -ompi_coll_portals4_scatter_intra_linear_top(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_scatter_intra_linear_top(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_coll_portals4_request_t *request, @@ -646,8 +646,8 @@ ompi_coll_portals4_scatter_intra_linear_bottom(struct ompi_communicator_t *comm, } int -ompi_coll_portals4_scatter_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_scatter_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -705,8 +705,8 @@ ompi_coll_portals4_scatter_intra(const void *sbuf, int scount, struct ompi_datat int -ompi_coll_portals4_iscatter_intra(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, struct ompi_datatype_t *rdtype, +ompi_coll_portals4_iscatter_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t **ompi_request, diff --git a/ompi/mca/coll/self/coll_self.h b/ompi/mca/coll/self/coll_self.h index bd7dc142dca..1c3027d9b90 100644 --- a/ompi/mca/coll/self/coll_self.h +++ b/ompi/mca/coll/self/coll_self.h @@ -57,9 +57,9 @@ int mca_coll_self_allgather_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_self_allgatherv_intra(const void *sbuf, int scount, +int mca_coll_self_allgatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -74,15 +74,15 @@ int mca_coll_self_alltoall_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_self_alltoallv_intra(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_self_alltoallv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_self_alltoallw_intra(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_self_alltoallw_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -103,9 +103,9 @@ int mca_coll_self_gather_intra(const void *sbuf, size_t scount, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_self_gatherv_intra(const void *sbuf, int scount, +int mca_coll_self_gatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, void *rbuf, - const int *rcounts, const int *disps, + ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); @@ -116,7 +116,7 @@ int mca_coll_self_reduce_intra(const void *sbuf, void* rbuf, size_t count, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); int mca_coll_self_reduce_scatter_intra(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -131,9 +131,9 @@ int mca_coll_self_scatter_intra(const void *sbuf, size_t scount, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_self_scatterv_intra(const void *sbuf, const int *scounts, const int *disps, +int mca_coll_self_scatterv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void* rbuf, int rcount, + void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); diff --git a/ompi/mca/coll/self/coll_self_allgatherv.c b/ompi/mca/coll/self/coll_self_allgatherv.c index 89c5403bdec..f34bd83690b 100644 --- a/ompi/mca/coll/self/coll_self_allgatherv.c +++ b/ompi/mca/coll/self/coll_self_allgatherv.c @@ -32,9 +32,9 @@ * Accepts: - same as MPI_Allgatherv() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_self_allgatherv_intra(const void *sbuf, int scount, +int mca_coll_self_allgatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void * rbuf, const int *rcounts, const int *disps, + void * rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -49,6 +49,6 @@ int mca_coll_self_allgatherv_intra(const void *sbuf, int scount, return OMPI_ERROR; } return ompi_datatype_sndrcv(sbuf, scount, sdtype, - ((char *) rbuf) + disps[0] * extent, rcounts[0], rdtype); + ((char *) rbuf) + ompi_disp_array_get(disps, 0) * extent, ompi_count_array_get(rcounts, 0), rdtype); } } diff --git a/ompi/mca/coll/self/coll_self_alltoallv.c b/ompi/mca/coll/self/coll_self_alltoallv.c index 7d34daa1645..59a231ca114 100644 --- a/ompi/mca/coll/self/coll_self_alltoallv.c +++ b/ompi/mca/coll/self/coll_self_alltoallv.c @@ -34,9 +34,9 @@ * Returns: - MPI_SUCCESS or an MPI error code */ int -mca_coll_self_alltoallv_intra(const void *sbuf, const int *scounts, const int *sdisps, +mca_coll_self_alltoallv_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -56,8 +56,8 @@ mca_coll_self_alltoallv_intra(const void *sbuf, const int *scounts, const int *s if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_datatype_sndrcv(((char *) sbuf) + sdisps[0] * sextent, - scounts[0], sdtype, - ((char *) rbuf) + rdisps[0] * rextent, - rcounts[0], rdtype); + return ompi_datatype_sndrcv(((char *) sbuf) + ompi_disp_array_get(sdisps, 0) * sextent, + ompi_count_array_get(scounts, 0), sdtype, + ((char *) rbuf) + ompi_disp_array_get(rdisps, 0) * rextent, + ompi_count_array_get(rcounts, 0), rdtype); } diff --git a/ompi/mca/coll/self/coll_self_alltoallw.c b/ompi/mca/coll/self/coll_self_alltoallw.c index 1cf6dc1217e..720f8450b4f 100644 --- a/ompi/mca/coll/self/coll_self_alltoallw.c +++ b/ompi/mca/coll/self/coll_self_alltoallw.c @@ -33,9 +33,9 @@ * Accepts: - same as MPI_Alltoallw() * Returns: - MPI_SUCCESS or an MPI error code */ -int mca_coll_self_alltoallw_intra(const void *sbuf, const int *scounts, const int *sdisps, +int mca_coll_self_alltoallw_intra(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t * const *sdtypes, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t * const *rdtypes, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -56,8 +56,8 @@ int mca_coll_self_alltoallw_intra(const void *sbuf, const int *scounts, const in return OMPI_ERROR; } - return ompi_datatype_sndrcv(((char *) sbuf) + sdisps[0] * sextent, - scounts[0], sdtypes[0], - ((char *) rbuf) + rdisps[0] * rextent, - rcounts[0], rdtypes[0]); + return ompi_datatype_sndrcv(((char *) sbuf) + ompi_disp_array_get(sdisps, 0) * sextent, + ompi_count_array_get(scounts, 0), sdtypes[0], + ((char *) rbuf) + ompi_disp_array_get(rdisps, 0) * rextent, + ompi_count_array_get(rcounts, 0), rdtypes[0]); } diff --git a/ompi/mca/coll/self/coll_self_gatherv.c b/ompi/mca/coll/self/coll_self_gatherv.c index 136b4652ae3..2f910cf222d 100644 --- a/ompi/mca/coll/self/coll_self_gatherv.c +++ b/ompi/mca/coll/self/coll_self_gatherv.c @@ -32,9 +32,9 @@ * Accepts: - same arguments as MPI_Gatherv() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_self_gatherv_intra(const void *sbuf, int scount, +int mca_coll_self_gatherv_intra(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -49,7 +49,7 @@ int mca_coll_self_gatherv_intra(const void *sbuf, int scount, return OMPI_ERROR; } return ompi_datatype_sndrcv(sbuf, scount, sdtype, - ((char *) rbuf) + disps[0]*extent, - rcounts[0], rdtype); + ((char *) rbuf) + ompi_disp_array_get(disps, 0)*extent, + ompi_count_array_get(rcounts, 0), rdtype); } } diff --git a/ompi/mca/coll/self/coll_self_reduce_scatter.c b/ompi/mca/coll/self/coll_self_reduce_scatter.c index 92006cbf463..64d6d36c40d 100644 --- a/ompi/mca/coll/self/coll_self_reduce_scatter.c +++ b/ompi/mca/coll/self/coll_self_reduce_scatter.c @@ -32,7 +32,7 @@ * Accepts: - same as MPI_Reduce_scatter() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_self_reduce_scatter_intra(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_self_reduce_scatter_intra(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -41,6 +41,6 @@ int mca_coll_self_reduce_scatter_intra(const void *sbuf, void *rbuf, const int * if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_datatype_copy_content_same_ddt(dtype, rcounts[0], (char*)rbuf, (char*)sbuf); + return ompi_datatype_copy_content_same_ddt(dtype, ompi_count_array_get(rcounts, 0), (char*)rbuf, (char*)sbuf); } } diff --git a/ompi/mca/coll/self/coll_self_scatterv.c b/ompi/mca/coll/self/coll_self_scatterv.c index e7b0b5badea..3b81ee8656d 100644 --- a/ompi/mca/coll/self/coll_self_scatterv.c +++ b/ompi/mca/coll/self/coll_self_scatterv.c @@ -32,9 +32,9 @@ * Accepts: - same arguments as MPI_Scatter() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_self_scatterv_intra(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +int mca_coll_self_scatterv_intra(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -48,7 +48,7 @@ int mca_coll_self_scatterv_intra(const void *sbuf, const int *scounts, if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_datatype_sndrcv(((char *) sbuf) + disps[0]*extent, scounts[0], + return ompi_datatype_sndrcv(((char *) sbuf) + ompi_disp_array_get(disps, 0)*extent, ompi_count_array_get(scounts, 0), sdtype, rbuf, rcount, rdtype); } } diff --git a/ompi/mca/coll/sync/coll_sync.h b/ompi/mca/coll/sync/coll_sync.h index e2dcbb827d1..8199fbccf6c 100644 --- a/ompi/mca/coll/sync/coll_sync.h +++ b/ompi/mca/coll/sync/coll_sync.h @@ -67,9 +67,9 @@ int mca_coll_sync_gather(const void *sbuf, size_t scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_sync_gatherv(const void *sbuf, int scount, +int mca_coll_sync_gatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, @@ -83,7 +83,7 @@ int mca_coll_sync_reduce(const void *sbuf, void *rbuf, size_t count, mca_coll_base_module_t *module); int mca_coll_sync_reduce_scatter(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -103,9 +103,9 @@ int mca_coll_sync_scatter(const void *sbuf, size_t scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_sync_scatterv(const void *sbuf, const int *scounts, const int *disps, +int mca_coll_sync_scatterv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/sync/coll_sync_gatherv.c b/ompi/mca/coll/sync/coll_sync_gatherv.c index 8271c92fb0d..5087bed0c88 100644 --- a/ompi/mca/coll/sync/coll_sync_gatherv.c +++ b/ompi/mca/coll/sync/coll_sync_gatherv.c @@ -29,9 +29,9 @@ * Accepts: - same arguments as MPI_Gatherv() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_sync_gatherv(const void *sbuf, int scount, +int mca_coll_sync_gatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) diff --git a/ompi/mca/coll/sync/coll_sync_reduce_scatter.c b/ompi/mca/coll/sync/coll_sync_reduce_scatter.c index 459daac74a8..10e6ab84b61 100644 --- a/ompi/mca/coll/sync/coll_sync_reduce_scatter.c +++ b/ompi/mca/coll/sync/coll_sync_reduce_scatter.c @@ -30,7 +30,7 @@ * Accepts: - same as MPI_Reduce_scatter() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_sync_reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_sync_reduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/sync/coll_sync_scatterv.c b/ompi/mca/coll/sync/coll_sync_scatterv.c index 5aba9831766..9b5d72b7521 100644 --- a/ompi/mca/coll/sync/coll_sync_scatterv.c +++ b/ompi/mca/coll/sync/coll_sync_scatterv.c @@ -29,9 +29,9 @@ * Accepts: - same arguments as MPI_Scatterv() * Returns: - MPI_SUCCESS or error code */ -int mca_coll_sync_scatterv(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +int mca_coll_sync_scatterv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) diff --git a/ompi/mca/coll/tuned/coll_tuned_allgatherv_decision.c b/ompi/mca/coll/tuned/coll_tuned_allgatherv_decision.c index 4c53b6b5ee0..b47b3f5412f 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allgatherv_decision.c +++ b/ompi/mca/coll/tuned/coll_tuned_allgatherv_decision.c @@ -122,10 +122,10 @@ ompi_coll_tuned_allgatherv_intra_check_forced_init(coll_tuned_force_algorithm_mc return (MPI_SUCCESS); } -int ompi_coll_tuned_allgatherv_intra_do_this(const void *sbuf, int scount, +int ompi_coll_tuned_allgatherv_intra_do_this(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, - const int *rdispls, + void *rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module, diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoallv_decision.c b/ompi/mca/coll/tuned/coll_tuned_alltoallv_decision.c index c5d72095c91..96b16fd5c18 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoallv_decision.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoallv_decision.c @@ -88,9 +88,9 @@ int ompi_coll_tuned_alltoallv_intra_check_forced_init(coll_tuned_force_algorithm /* If the user selects dynamic rules and specifies the algorithm to * use, then this function is called. */ -int ompi_coll_tuned_alltoallv_intra_do_this(const void *sbuf, const int *scounts, const int *sdisps, +int ompi_coll_tuned_alltoallv_intra_do_this(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module, diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c b/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c index 47371251721..b8a6aa32205 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c @@ -158,9 +158,9 @@ int ompi_coll_tuned_alltoall_intra_dec_dynamic(const void *sbuf, size_t scount, * Returns: - MPI_SUCCESS or error code */ -int ompi_coll_tuned_alltoallv_intra_dec_dynamic(const void *sbuf, const int *scounts, const int *sdisps, +int ompi_coll_tuned_alltoallv_intra_dec_dynamic(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -357,7 +357,7 @@ int ompi_coll_tuned_reduce_intra_dec_dynamic( const void *sbuf, void *rbuf, * */ int ompi_coll_tuned_reduce_scatter_intra_dec_dynamic(const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -383,7 +383,7 @@ int ompi_coll_tuned_reduce_scatter_intra_dec_dynamic(const void *sbuf, void *rbu int alg, faninout, segsize, ignoreme, i, count, size; size_t dsize; size = ompi_comm_size(comm); - for (i = 0, count = 0; i < size; i++) { count += rcounts[i];} + for (i = 0, count = 0; i < size; i++) { count += ompi_count_array_get(rcounts, i);} ompi_datatype_type_size (dtype, &dsize); dsize *= count; @@ -526,10 +526,10 @@ int ompi_coll_tuned_allgather_intra_dec_dynamic(const void *sbuf, size_t scount, * allgatherv function). */ -int ompi_coll_tuned_allgatherv_intra_dec_dynamic(const void *sbuf, int scount, +int ompi_coll_tuned_allgatherv_intra_dec_dynamic(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, - const int *rdispls, + void* rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -560,7 +560,7 @@ int ompi_coll_tuned_allgatherv_intra_dec_dynamic(const void *sbuf, int scount, comsize = ompi_comm_size(comm); ompi_datatype_type_size (sdtype, &dsize); total_size = 0; - for (i = 0; i < comsize; i++) { total_size += dsize * rcounts[i]; } + for (i = 0; i < comsize; i++) { total_size += dsize * ompi_count_array_get(rcounts, i); } per_rank_size = total_size / comsize; diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index a3a2afacdf7..45cc9452059 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -415,9 +415,9 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(const void *sbuf, size_t scount, * Accepts: - same arguments as MPI_Alltoallv() * Returns: - MPI_SUCCESS or error code */ -int ompi_coll_tuned_alltoallv_intra_dec_fixed(const void *sbuf, const int *scounts, const int *sdisps, +int ompi_coll_tuned_alltoallv_intra_dec_fixed(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *rdisps, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -823,7 +823,7 @@ int ompi_coll_tuned_reduce_intra_dec_fixed( const void *sendbuf, void *recvbuf, * the reduce scatter implementation) */ int ompi_coll_tuned_reduce_scatter_intra_dec_fixed( const void *sbuf, void *rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -838,7 +838,7 @@ int ompi_coll_tuned_reduce_scatter_intra_dec_fixed( const void *sbuf, void *rbuf ompi_datatype_type_size(dtype, &dsize); total_dsize = 0; for (i = 0; i < communicator_size; i++) { - total_dsize += rcounts[i]; + total_dsize += ompi_count_array_get(rcounts, i); } total_dsize *= dsize; @@ -1238,10 +1238,10 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(const void *sbuf, size_t scount, * internal allgatherv function. */ -int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, int scount, +int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, - const int *rdispls, + void* rbuf, ompi_count_array *rcounts, + ompi_disp_array *rdispls, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -1258,7 +1258,7 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, int scount, } total_dsize = 0; - for (i = 0; i < communicator_size; i++) { total_dsize += dsize * rcounts[i]; } + for (i = 0; i < communicator_size; i++) { total_dsize += dsize * ompi_count_array_get(rcounts, i); } /* use the per-rank data size as basis, similar to allgather */ per_rank_dsize = total_dsize / communicator_size; diff --git a/ompi/mca/coll/tuned/coll_tuned_reduce_scatter_decision.c b/ompi/mca/coll/tuned/coll_tuned_reduce_scatter_decision.c index b4c1b434863..f7e00128966 100644 --- a/ompi/mca/coll/tuned/coll_tuned_reduce_scatter_decision.c +++ b/ompi/mca/coll/tuned/coll_tuned_reduce_scatter_decision.c @@ -122,7 +122,7 @@ int ompi_coll_tuned_reduce_scatter_intra_check_forced_init (coll_tuned_force_alg } int ompi_coll_tuned_reduce_scatter_intra_do_this(const void *sbuf, void* rbuf, - const int *rcounts, + ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/ucc/coll_ucc.h b/ompi/mca/coll/ucc/coll_ucc.h index 4020c3c6ce6..5767b3e5374 100644 --- a/ompi/mca/coll/ucc/coll_ucc.h +++ b/ompi/mca/coll/ucc/coll_ucc.h @@ -188,16 +188,16 @@ int mca_coll_ucc_ialltoall(const void *sbuf, size_t scount, struct ompi_datatype ompi_request_t** request, mca_coll_base_module_t *module); -int mca_coll_ucc_alltoallv(const void *sbuf, const int *scounts, const int *sdips, +int mca_coll_ucc_alltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdips, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_ucc_ialltoallv(const void *sbuf, const int *scounts, const int *sdips, +int mca_coll_ucc_ialltoallv(const void *sbuf, ompi_count_array *scounts, ompi_disp_array *sdips, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t** request, @@ -214,14 +214,14 @@ int mca_coll_ucc_iallgather(const void *sbuf, size_t scount, struct ompi_datatyp ompi_request_t** request, mca_coll_base_module_t *module); -int mca_coll_ucc_allgatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, +int mca_coll_ucc_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_ucc_iallgatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, +int mca_coll_ucc_iallgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t** request, @@ -238,14 +238,14 @@ int mca_coll_ucc_igather(const void *sbuf, size_t scount, struct ompi_datatype_t ompi_request_t** request, mca_coll_base_module_t *module); -int mca_coll_ucc_gatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, +int mca_coll_ucc_gatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_ucc_igatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, +int mca_coll_ucc_igatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t** request, @@ -264,29 +264,29 @@ int mca_coll_ucc_ireduce_scatter_block(const void *sbuf, void *rbuf, size_t rcou ompi_request_t** request, mca_coll_base_module_t *module); -int mca_coll_ucc_reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_ucc_reduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_ucc_ireduce_scatter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_ucc_ireduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, ompi_request_t** request, mca_coll_base_module_t *module); -int mca_coll_ucc_scatterv(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +int mca_coll_ucc_scatterv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); -int mca_coll_ucc_iscatterv(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +int mca_coll_ucc_iscatterv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t** request, diff --git a/ompi/mca/coll/ucc/coll_ucc_allgatherv.c b/ompi/mca/coll/ucc/coll_ucc_allgatherv.c index 6cf33a5dd80..5a81318e2a1 100644 --- a/ompi/mca/coll/ucc/coll_ucc_allgatherv.c +++ b/ompi/mca/coll/ucc/coll_ucc_allgatherv.c @@ -11,7 +11,7 @@ static inline ucc_status_t mca_coll_ucc_allgatherv_init(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req, @@ -29,7 +29,11 @@ static inline ucc_status_t mca_coll_ucc_allgatherv_init(const void *sbuf, int sc goto fallback; } + uint64_t flags = ompi_count_array_is_64bit(rcounts) ? UCC_COLL_ARGS_FLAG_COUNT_64BIT : 0; + flags |= ompi_disp_array_is_64bit(rdisps) ? UCC_COLL_ARGS_FLAG_DISPLACEMENTS_64BIT : 0; + ucc_coll_args_t coll = { + .flags = flags, .mask = 0, .coll_type = UCC_COLL_TYPE_ALLGATHERV, .src.info = { @@ -40,16 +44,16 @@ static inline ucc_status_t mca_coll_ucc_allgatherv_init(const void *sbuf, int sc }, .dst.info_v = { .buffer = (void*)rbuf, - .counts = (ucc_count_t*)rcounts, - .displacements = (ucc_aint_t*)rdisps, + .counts = (ucc_count_t*)ompi_count_array_ptr(rcounts), + .displacements = (ucc_aint_t*)ompi_disp_array_ptr(rdisps), .datatype = ucc_rdt, .mem_type = UCC_MEMORY_TYPE_UNKNOWN } }; if (MPI_IN_PLACE == sbuf) { - coll.mask = UCC_COLL_ARGS_FIELD_FLAGS; - coll.flags = UCC_COLL_ARGS_FLAG_IN_PLACE; + coll.mask |= UCC_COLL_ARGS_FIELD_FLAGS; + coll.flags |= UCC_COLL_ARGS_FLAG_IN_PLACE; } COLL_UCC_REQ_INIT(coll_req, req, coll, ucc_module); return UCC_OK; @@ -57,9 +61,9 @@ static inline ucc_status_t mca_coll_ucc_allgatherv_init(const void *sbuf, int sc return UCC_ERR_NOT_SUPPORTED; } -int mca_coll_ucc_allgatherv(const void *sbuf, int scount, +int mca_coll_ucc_allgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -82,9 +86,9 @@ int mca_coll_ucc_allgatherv(const void *sbuf, int scount, comm, ucc_module->previous_allgatherv_module); } -int mca_coll_ucc_iallgatherv(const void *sbuf, int scount, +int mca_coll_ucc_iallgatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t** request, diff --git a/ompi/mca/coll/ucc/coll_ucc_alltoallv.c b/ompi/mca/coll/ucc/coll_ucc_alltoallv.c index 75b0dd6b6b7..dc69e51f294 100644 --- a/ompi/mca/coll/ucc/coll_ucc_alltoallv.c +++ b/ompi/mca/coll/ucc/coll_ucc_alltoallv.c @@ -9,9 +9,9 @@ #include "coll_ucc_common.h" -static inline ucc_status_t mca_coll_ucc_alltoallv_init(const void *sbuf, const int *scounts, - const int *sdisps, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, +static inline ucc_status_t mca_coll_ucc_alltoallv_init(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req, @@ -29,20 +29,25 @@ static inline ucc_status_t mca_coll_ucc_alltoallv_init(const void *sbuf, const i goto fallback; } + /* Assumes that send counts/displs and recv counts/displs are both 32-bit or both 64-bit */ + uint64_t flags = ompi_count_array_is_64bit(scounts) ? UCC_COLL_ARGS_FLAG_COUNT_64BIT : 0; + flags |= ompi_disp_array_is_64bit(sdisps) ? UCC_COLL_ARGS_FLAG_DISPLACEMENTS_64BIT : 0; + ucc_coll_args_t coll = { + .flags = flags, .mask = 0, .coll_type = UCC_COLL_TYPE_ALLTOALLV, .src.info_v = { .buffer = (void*)sbuf, - .counts = (ucc_count_t*)scounts, - .displacements = (ucc_aint_t*)sdisps, + .counts = (ucc_count_t*)ompi_count_array_ptr(scounts), + .displacements = (ucc_aint_t*)ompi_disp_array_ptr(sdisps), .datatype = ucc_sdt, .mem_type = UCC_MEMORY_TYPE_UNKNOWN }, .dst.info_v = { .buffer = (void*)rbuf, - .counts = (ucc_count_t*)rcounts, - .displacements = (ucc_aint_t*)rdisps, + .counts = (ucc_count_t*)ompi_count_array_ptr(rcounts), + .displacements = (ucc_aint_t*)ompi_disp_array_ptr(rdisps), .datatype = ucc_rdt, .mem_type = UCC_MEMORY_TYPE_UNKNOWN } @@ -50,7 +55,7 @@ static inline ucc_status_t mca_coll_ucc_alltoallv_init(const void *sbuf, const i if (MPI_IN_PLACE == sbuf) { coll.mask = UCC_COLL_ARGS_FIELD_FLAGS; - coll.flags = UCC_COLL_ARGS_FLAG_IN_PLACE; + coll.flags |= UCC_COLL_ARGS_FLAG_IN_PLACE; } COLL_UCC_REQ_INIT(coll_req, req, coll, ucc_module); return UCC_OK; @@ -58,9 +63,9 @@ static inline ucc_status_t mca_coll_ucc_alltoallv_init(const void *sbuf, const i return UCC_ERR_NOT_SUPPORTED; } -int mca_coll_ucc_alltoallv(const void *sbuf, const int *scounts, - const int *sdisps, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, +int mca_coll_ucc_alltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -83,9 +88,9 @@ int mca_coll_ucc_alltoallv(const void *sbuf, const int *scounts, comm, ucc_module->previous_alltoallv_module); } -int mca_coll_ucc_ialltoallv(const void *sbuf, const int *scounts, - const int *sdisps, struct ompi_datatype_t *sdtype, - void* rbuf, const int *rcounts, const int *rdisps, +int mca_coll_ucc_ialltoallv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *sdisps, struct ompi_datatype_t *sdtype, + void* rbuf, ompi_count_array *rcounts, ompi_disp_array *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t** request, diff --git a/ompi/mca/coll/ucc/coll_ucc_gatherv.c b/ompi/mca/coll/ucc/coll_ucc_gatherv.c index 81474d0c38a..4f47f864baa 100644 --- a/ompi/mca/coll/ucc/coll_ucc_gatherv.c +++ b/ompi/mca/coll/ucc/coll_ucc_gatherv.c @@ -10,8 +10,8 @@ #include "coll_ucc_common.h" -static inline ucc_status_t mca_coll_ucc_gatherv_init(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, +static inline ucc_status_t mca_coll_ucc_gatherv_init(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req, @@ -39,7 +39,11 @@ static inline ucc_status_t mca_coll_ucc_gatherv_init(const void *sbuf, int scoun } } + uint64_t flags = ompi_count_array_is_64bit(rcounts) ? UCC_COLL_ARGS_FLAG_COUNT_64BIT : 0; + flags |= ompi_disp_array_is_64bit(disps) ? UCC_COLL_ARGS_FLAG_DISPLACEMENTS_64BIT : 0; + ucc_coll_args_t coll = { + .flags = flags, .mask = 0, .coll_type = UCC_COLL_TYPE_GATHERV, .root = root, @@ -51,8 +55,8 @@ static inline ucc_status_t mca_coll_ucc_gatherv_init(const void *sbuf, int scoun }, .dst.info_v = { .buffer = (void*)rbuf, - .counts = (ucc_count_t*)rcounts, - .displacements = (ucc_aint_t*)disps, + .counts = (ucc_count_t*)ompi_count_array_ptr(rcounts), + .displacements = (ucc_aint_t*)ompi_disp_array_ptr(disps), .datatype = ucc_rdt, .mem_type = UCC_MEMORY_TYPE_UNKNOWN }, @@ -60,7 +64,7 @@ static inline ucc_status_t mca_coll_ucc_gatherv_init(const void *sbuf, int scoun if (MPI_IN_PLACE == sbuf) { coll.mask |= UCC_COLL_ARGS_FIELD_FLAGS; - coll.flags = UCC_COLL_ARGS_FLAG_IN_PLACE; + coll.flags |= UCC_COLL_ARGS_FLAG_IN_PLACE; } COLL_UCC_REQ_INIT(coll_req, req, coll, ucc_module); return UCC_OK; @@ -68,8 +72,8 @@ static inline ucc_status_t mca_coll_ucc_gatherv_init(const void *sbuf, int scoun return UCC_ERR_NOT_SUPPORTED; } -int mca_coll_ucc_gatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, +int mca_coll_ucc_gatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -91,8 +95,8 @@ int mca_coll_ucc_gatherv(const void *sbuf, int scount, struct ompi_datatype_t *s ucc_module->previous_gatherv_module); } -int mca_coll_ucc_igatherv(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, - void *rbuf, const int *rcounts, const int *disps, +int mca_coll_ucc_igatherv(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype, + void *rbuf, ompi_count_array *rcounts, ompi_disp_array *disps, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t** request, diff --git a/ompi/mca/coll/ucc/coll_ucc_reduce_scatter.c b/ompi/mca/coll/ucc/coll_ucc_reduce_scatter.c index 5cc6fa6fc61..1b16d0be99f 100644 --- a/ompi/mca/coll/ucc/coll_ucc_reduce_scatter.c +++ b/ompi/mca/coll/ucc/coll_ucc_reduce_scatter.c @@ -10,7 +10,7 @@ #include "coll_ucc_common.h" static inline -ucc_status_t mca_coll_ucc_reduce_scatter_init(const void *sbuf, void *rbuf, const int *rcounts, +ucc_status_t mca_coll_ucc_reduce_scatter_init(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req, @@ -43,10 +43,11 @@ ucc_status_t mca_coll_ucc_reduce_scatter_init(const void *sbuf, void *rbuf, cons } total_count = 0; for (i = 0; i < comm_size; i++) { - total_count += rcounts[i]; + total_count += ompi_count_array_get(rcounts, i); } ucc_coll_args_t coll = { + .flags = ompi_count_array_is_64bit(rcounts) ? UCC_COLL_ARGS_FLAG_COUNT_64BIT : 0, .mask = 0, .coll_type = UCC_COLL_TYPE_REDUCE_SCATTERV, .src.info = { @@ -57,7 +58,7 @@ ucc_status_t mca_coll_ucc_reduce_scatter_init(const void *sbuf, void *rbuf, cons }, .dst.info_v = { .buffer = rbuf, - .counts = (ucc_count_t*)rcounts, + .counts = (ucc_count_t*)ompi_count_array_ptr(rcounts), .datatype = ucc_dt, .mem_type = UCC_MEMORY_TYPE_UNKNOWN }, @@ -69,7 +70,7 @@ ucc_status_t mca_coll_ucc_reduce_scatter_init(const void *sbuf, void *rbuf, cons return UCC_ERR_NOT_SUPPORTED; } -int mca_coll_ucc_reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_ucc_reduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, @@ -91,7 +92,7 @@ int mca_coll_ucc_reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts ucc_module->previous_reduce_scatter_module); } -int mca_coll_ucc_ireduce_scatter(const void *sbuf, void *rbuf, const int *rcounts, +int mca_coll_ucc_ireduce_scatter(const void *sbuf, void *rbuf, ompi_count_array *rcounts, struct ompi_datatype_t *dtype, struct ompi_op_t *op, struct ompi_communicator_t *comm, diff --git a/ompi/mca/coll/ucc/coll_ucc_scatterv.c b/ompi/mca/coll/ucc/coll_ucc_scatterv.c index b731850fabe..3627d7e5d8b 100644 --- a/ompi/mca/coll/ucc/coll_ucc_scatterv.c +++ b/ompi/mca/coll/ucc/coll_ucc_scatterv.c @@ -10,9 +10,9 @@ #include "coll_ucc_common.h" static inline -ucc_status_t mca_coll_ucc_scatterv_init(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +ucc_status_t mca_coll_ucc_scatterv_init(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req, @@ -41,14 +41,18 @@ ucc_status_t mca_coll_ucc_scatterv_init(const void *sbuf, const int *scounts, } } + uint64_t flags = ompi_count_array_is_64bit(scounts) ? UCC_COLL_ARGS_FLAG_COUNT_64BIT : 0; + flags |= ompi_disp_array_is_64bit(disps) ? UCC_COLL_ARGS_FLAG_DISPLACEMENTS_64BIT : 0; + ucc_coll_args_t coll = { + .flags = flags, .mask = 0, .coll_type = UCC_COLL_TYPE_SCATTERV, .root = root, .src.info_v = { .buffer = (void*)sbuf, - .counts = (ucc_count_t*)scounts, - .displacements = (ucc_aint_t*)disps, + .counts = (ucc_count_t*)ompi_count_array_ptr(scounts), + .displacements = (ucc_aint_t*)ompi_disp_array_ptr(disps), .datatype = ucc_sdt, .mem_type = UCC_MEMORY_TYPE_UNKNOWN }, @@ -62,7 +66,7 @@ ucc_status_t mca_coll_ucc_scatterv_init(const void *sbuf, const int *scounts, if (MPI_IN_PLACE == rbuf) { coll.mask |= UCC_COLL_ARGS_FIELD_FLAGS; - coll.flags = UCC_COLL_ARGS_FLAG_IN_PLACE; + coll.flags |= UCC_COLL_ARGS_FLAG_IN_PLACE; } COLL_UCC_REQ_INIT(coll_req, req, coll, ucc_module); return UCC_OK; @@ -70,9 +74,9 @@ ucc_status_t mca_coll_ucc_scatterv_init(const void *sbuf, const int *scounts, return UCC_ERR_NOT_SUPPORTED; } -int mca_coll_ucc_scatterv(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +int mca_coll_ucc_scatterv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) @@ -94,9 +98,9 @@ int mca_coll_ucc_scatterv(const void *sbuf, const int *scounts, ucc_module->previous_scatterv_module); } -int mca_coll_ucc_iscatterv(const void *sbuf, const int *scounts, - const int *disps, struct ompi_datatype_t *sdtype, - void *rbuf, int rcount, +int mca_coll_ucc_iscatterv(const void *sbuf, ompi_count_array *scounts, + ompi_disp_array *disps, struct ompi_datatype_t *sdtype, + void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype, int root, struct ompi_communicator_t *comm, ompi_request_t** request, diff --git a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c index 8b88ac7a2a1..41870ccb8f0 100644 --- a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c +++ b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c @@ -148,9 +148,9 @@ int mca_fcoll_dynamic_gen2_file_write_all (struct ompio_file_t *fh, int *aggregators=NULL; int *result_counts=NULL; - int *temp_displs = NULL, *temp_counts = NULL; - - + ompi_count_array fview_count_desc; + ompi_disp_array displs_desc; + #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN double write_time = 0.0, start_write_time = 0.0, end_write_time = 0.0; double comm_time = 0.0, start_comm_time = 0.0, end_comm_time = 0.0; @@ -413,29 +413,17 @@ int mca_fcoll_dynamic_gen2_file_write_all (struct ompio_file_t *fh, start_comm_time = MPI_Wtime(); #endif if ( 1 == mca_fcoll_dynamic_gen2_num_groups ) { - /* TODO:BIGCOUNT: Remove temporary values here once the coll - * framework is using size_t/ptrdiff_t */ - temp_counts = (int *)malloc(2 * fh->f_procs_per_group * sizeof(int)); - if (NULL == temp_counts) { - opal_output(1, "OUT OF MEMORY\n"); - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - } - temp_displs = temp_counts + total_fview_count; - for (j = 0; j < fh->f_procs_per_group; j++) { - temp_counts[j] = aggr_data[i]->fview_count[j]; - temp_displs[j] = displs[j]; - } + OMPI_COUNT_ARRAY_INIT(&fview_count_desc, aggr_data[i]->fview_count); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); ret = fh->f_comm->c_coll->coll_allgatherv (broken_iov_arrays[i], broken_counts[i], fh->f_iov_type, aggr_data[i]->global_iov_array, - temp_counts, - temp_displs, + &fview_count_desc, + &displs_desc, fh->f_iov_type, fh->f_comm, fh->f_comm->c_coll->coll_allgatherv_module ); - free(temp_counts); } else { ret = ompi_fcoll_base_coll_allgatherv_array (broken_iov_arrays[i], diff --git a/ompi/mca/fcoll/vulcan/fcoll_vulcan_file_write_all.c b/ompi/mca/fcoll/vulcan/fcoll_vulcan_file_write_all.c index 492f78d571b..61e3ec744ff 100644 --- a/ompi/mca/fcoll/vulcan/fcoll_vulcan_file_write_all.c +++ b/ompi/mca/fcoll/vulcan/fcoll_vulcan_file_write_all.c @@ -153,8 +153,9 @@ int mca_fcoll_vulcan_file_write_all (struct ompio_file_t *fh, int write_synch_type = 2; int write_chunksize, *result_counts=NULL; - int *temp_displs = NULL, *temp_counts = NULL; - + ompi_count_array fview_count_desc; + ompi_disp_array displs_desc; + #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN double write_time = 0.0, start_write_time = 0.0, end_write_time = 0.0; double comm_time = 0.0, start_comm_time = 0.0, end_comm_time = 0.0; @@ -419,29 +420,17 @@ int mca_fcoll_vulcan_file_write_all (struct ompio_file_t *fh, start_comm_time = MPI_Wtime(); #endif if ( 1 == mca_fcoll_vulcan_num_groups ) { - /* TODO:BIGCOUNT: Remove temporary variables when coll framework is - * udpated to use size_t/ptrdiff_t */ - temp_counts = (int *)malloc (2 * fh->f_procs_per_group * sizeof(int)); - if (NULL == temp_counts) { - opal_output (1, "OUT OF MEMORY\n"); - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - } - temp_displs = temp_counts + fh->f_procs_per_group; - for (j = 0; j < fh->f_procs_per_group; j++) { - temp_counts[j] = (int) aggr_data[i]->fview_count[j]; - temp_displs[j] = (int) displs[j]; - } + OMPI_COUNT_ARRAY_INIT(&fview_count_desc, aggr_data[i]->fview_count); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); ret = fh->f_comm->c_coll->coll_allgatherv (broken_iov_arrays[i], broken_counts[i], fh->f_iov_type, aggr_data[i]->global_iov_array, - temp_counts, - temp_displs, + &fview_count_desc, + &displs_desc, fh->f_iov_type, fh->f_comm, fh->f_comm->c_coll->coll_allgatherv_module ); - free(temp_counts); } else { ret = ompi_fcoll_base_coll_allgatherv_array (broken_iov_arrays[i], diff --git a/ompi/mca/hook/comm_method/hook_comm_method_fns.c b/ompi/mca/hook/comm_method/hook_comm_method_fns.c index f0bf8e13d0f..0bf1c713494 100644 --- a/ompi/mca/hook/comm_method/hook_comm_method_fns.c +++ b/ompi/mca/hook/comm_method/hook_comm_method_fns.c @@ -543,6 +543,8 @@ ompi_report_comm_methods(int called_from_location) // the sizes first and allocate the receiving string. { int len, *lens, *disps; + ompi_count_array lens_desc; + ompi_disp_array disps_desc; // First get the array of host strings (host names and task lists) // for all nodes. @@ -570,9 +572,11 @@ ompi_report_comm_methods(int called_from_location) allhoststrings[i] = p; p += lens[i]; } + OMPI_COUNT_ARRAY_INIT(&lens_desc, lens); + OMPI_DISP_ARRAY_INIT(&disps_desc, disps); leader_comm->c_coll->coll_gatherv( hoststring, strlen(hoststring) + 1, MPI_CHAR, - &allhoststrings[0][0], lens, disps, MPI_CHAR, + &allhoststrings[0][0], &lens_desc, &disps_desc, MPI_CHAR, 0, leader_comm, leader_comm->c_coll->coll_gatherv_module); } else { // matching above call from rank 0, just &allhoststrings[0][0] diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index ac28ec60229..7a8e07f4ee6 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -120,6 +120,8 @@ int ompi_io_ompio_generate_current_file_view (struct ompio_file_t *fh, if (mca_io_ompio_record_offset_info){ int tot_entries=0, *recvcounts=NULL, *displs=NULL; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; mca_io_ompio_offlen_array_t *per_process=NULL; mca_io_ompio_offlen_array_t *all_process=NULL; int *sorted=NULL, *column_list=NULL, *values=NULL; @@ -249,12 +251,14 @@ int ompi_io_ompio_generate_current_file_view (struct ompio_file_t *fh, } } } + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); fh->f_comm->c_coll->coll_gatherv (per_process, k, io_array_type, all_process, - recvcounts, - displs, + &recvcounts_desc, + &displs_desc, io_array_type, OMPIO_ROOT, fh->f_comm, diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 2b9142e4a36..0e6aae168f7 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -381,6 +381,8 @@ static int exchange_len_info(void *my_info, size_t my_info_len, char **recv_info int comm_size = ompi_comm_size(comm); int *lens = calloc(comm_size, sizeof(int)); int total_len, i; + ompi_count_array lens_desc; + ompi_disp_array disps_desc; ret = comm->c_coll->coll_allgather(&my_info_len, 1, MPI_INT, lens, 1, MPI_INT, comm, @@ -398,8 +400,10 @@ static int exchange_len_info(void *my_info, size_t my_info_len, char **recv_info } (*recv_info_ptr) = (char *)calloc(total_len, sizeof(char)); + OMPI_COUNT_ARRAY_INIT(&lens_desc, lens); + OMPI_DISP_ARRAY_INIT(&disps_desc, *disps_ptr); ret = comm->c_coll->coll_allgatherv(my_info, my_info_len, MPI_BYTE, - (void *)(*recv_info_ptr), lens, (*disps_ptr), MPI_BYTE, + (void *)(*recv_info_ptr), &lens_desc, &disps_desc, MPI_BYTE, comm, comm->c_coll->coll_allgatherv_module); if (OMPI_SUCCESS != ret) { free(lens); diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c b/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c index 52d8ad4bad3..f8ab195c4a8 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c @@ -44,6 +44,8 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh OMPI_MPI_OFFSET_TYPE *offsetbuff = NULL; int *countbuff = NULL; int *displ = NULL; + ompi_count_array countbuff_desc; + ompi_disp_array displ_desc; double *ind_ts = NULL; long *ind_recordlength = NULL; OMPI_MPI_OFFSET_TYPE *local_off = NULL; @@ -142,12 +144,15 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh goto exit; } + OMPI_COUNT_ARRAY_INIT(&countbuff_desc, countbuff); + OMPI_DISP_ARRAY_INIT(&displ_desc, displ); + ret = ompio_fh->f_comm->c_coll->coll_allgatherv ( ind_ts, countbuff[ompio_fh->f_rank], MPI_DOUBLE, timestampbuff, - countbuff, - displ, + &countbuff_desc, + &displ_desc, MPI_DOUBLE, ompio_fh->f_comm, ompio_fh->f_comm->c_coll->coll_allgatherv_module ); @@ -159,8 +164,8 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh countbuff[ompio_fh->f_rank], OMPI_OFFSET_DATATYPE, offsetbuff, - countbuff, - displ, + &countbuff_desc, + &displ_desc, OMPI_OFFSET_DATATYPE, ompio_fh->f_comm, ompio_fh->f_comm->c_coll->coll_allgatherv_module ); diff --git a/ompi/mpi/c/allgatherv.c b/ompi/mpi/c/allgatherv.c index 8d3ab33113c..d1a2b0310c1 100644 --- a/ompi/mpi/c/allgatherv.c +++ b/ompi/mpi/c/allgatherv.c @@ -50,6 +50,8 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, const int displs[], MPI_Datatype recvtype, MPI_Comm comm) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_ALLGATHERV, 1); @@ -152,9 +154,11 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, something */ /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_allgatherv(sendbuf, sendcount, sendtype, - recvbuf, (int *) recvcounts, - (int *) displs, recvtype, comm, + recvbuf, &recvcounts_desc, + &displs_desc, recvtype, comm, comm->c_coll->coll_allgatherv_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/allgatherv_init.c b/ompi/mpi/c/allgatherv_init.c index 5c1ae969d4e..311bbbe6846 100644 --- a/ompi/mpi/c/allgatherv_init.c +++ b/ompi/mpi/c/allgatherv_init.c @@ -51,6 +51,8 @@ int MPI_Allgatherv_init(const void *sendbuf, int sendcount, MPI_Datatype sendtyp MPI_Info info, MPI_Request *request) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_ALLGATHERV_INIT, 1); @@ -122,8 +124,10 @@ int MPI_Allgatherv_init(const void *sendbuf, int sendcount, MPI_Datatype sendtyp } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_allgatherv_init(sendbuf, sendcount, sendtype, - recvbuf, recvcounts, displs, + recvbuf, &recvcounts_desc, &displs_desc, recvtype, comm, info, request, comm->c_coll->coll_allgatherv_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/alltoallv.c b/ompi/mpi/c/alltoallv.c index 4106d96d249..d859556def9 100644 --- a/ompi/mpi/c/alltoallv.c +++ b/ompi/mpi/c/alltoallv.c @@ -50,6 +50,8 @@ int MPI_Alltoallv(const void *sendbuf, const int sendcounts[], MPI_Datatype recvtype, MPI_Comm comm) { int i, size, err; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_ALLTOALLV, 1); @@ -136,8 +138,12 @@ int MPI_Alltoallv(const void *sendbuf, const int sendcounts[], #endif /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_alltoallv(sendbuf, sendcounts, sdispls, sendtype, - recvbuf, recvcounts, rdispls, recvtype, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_alltoallv(sendbuf, &sendcounts_desc, &sdispls_desc, sendtype, + recvbuf, &recvcounts_desc, &rdispls_desc, recvtype, comm, comm->c_coll->coll_alltoallv_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/alltoallv_init.c b/ompi/mpi/c/alltoallv_init.c index a0e5cb94aad..faa93faa69a 100644 --- a/ompi/mpi/c/alltoallv_init.c +++ b/ompi/mpi/c/alltoallv_init.c @@ -50,6 +50,8 @@ int MPI_Alltoallv_init(const void *sendbuf, const int sendcounts[], const int sd MPI_Info info, MPI_Request *request) { int i, size, err; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_ALLTOALLV_INIT, 1); @@ -126,8 +128,12 @@ int MPI_Alltoallv_init(const void *sendbuf, const int sendcounts[], const int sd } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_alltoallv_init(sendbuf, sendcounts, sdispls, - sendtype, recvbuf, recvcounts, rdispls, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_alltoallv_init(sendbuf, &sendcounts_desc, &sdispls_desc, + sendtype, recvbuf, &recvcounts_desc, &rdispls_desc, recvtype, comm, info, request, comm->c_coll->coll_alltoallv_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); diff --git a/ompi/mpi/c/alltoallw.c b/ompi/mpi/c/alltoallw.c index e8850326df4..94673866720 100644 --- a/ompi/mpi/c/alltoallw.c +++ b/ompi/mpi/c/alltoallw.c @@ -50,6 +50,8 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[], const MPI_Datatype recvtypes[], MPI_Comm comm) { int i, size, err; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_ALLTOALLW, 1); @@ -126,8 +128,12 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[], #endif /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_alltoallw(sendbuf, sendcounts, sdispls, (ompi_datatype_t **) sendtypes, - recvbuf, recvcounts, rdispls, (ompi_datatype_t **) recvtypes, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_alltoallw(sendbuf, &sendcounts_desc, &sdispls_desc, (ompi_datatype_t **) sendtypes, + recvbuf, &recvcounts_desc, &rdispls_desc, (ompi_datatype_t **) recvtypes, comm, comm->c_coll->coll_alltoallw_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/alltoallw_init.c b/ompi/mpi/c/alltoallw_init.c index fb031c7683c..0c9fba5af84 100644 --- a/ompi/mpi/c/alltoallw_init.c +++ b/ompi/mpi/c/alltoallw_init.c @@ -50,6 +50,8 @@ int MPI_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int sd MPI_Info info, MPI_Request *request) { int i, size, err; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_ALLTOALLW_INIT, 1); @@ -122,9 +124,13 @@ int MPI_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int sd } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_alltoallw_init(sendbuf, sendcounts, sdispls, - sendtypes, recvbuf, recvcounts, - rdispls, recvtypes, comm, info, request, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_alltoallw_init(sendbuf, &sendcounts_desc, &sdispls_desc, + sendtypes, recvbuf, &recvcounts_desc, + &rdispls_desc, recvtypes, comm, info, request, comm->c_coll->coll_alltoallw_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { ompi_coll_base_retain_datatypes_w(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtypes, recvtypes, false); diff --git a/ompi/mpi/c/gatherv.c b/ompi/mpi/c/gatherv.c index 046d4cc47cd..17e632cc389 100644 --- a/ompi/mpi/c/gatherv.c +++ b/ompi/mpi/c/gatherv.c @@ -48,6 +48,8 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, MPI_Datatype recvtype, int root, MPI_Comm comm) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_GATHERV, 1); @@ -210,8 +212,10 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_gatherv(sendbuf, sendcount, sendtype, updated_recvbuf, - recvcounts, displs, + &recvcounts_desc, &displs_desc, recvtype, root, comm, comm->c_coll->coll_gatherv_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/gatherv_init.c b/ompi/mpi/c/gatherv_init.c index a714eb632eb..a7a8c89dc1f 100644 --- a/ompi/mpi/c/gatherv_init.c +++ b/ompi/mpi/c/gatherv_init.c @@ -49,6 +49,8 @@ int MPI_Gatherv_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype, MPI_Info info, MPI_Request *request) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_GATHERV_INIT, 1); @@ -200,8 +202,10 @@ int MPI_Gatherv_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype, } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_gatherv_init(sendbuf, sendcount, sendtype, updated_recvbuf, - recvcounts, displs, recvtype, + &recvcounts_desc, &displs_desc, recvtype, root, comm, info, request, comm->c_coll->coll_gatherv_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/iallgatherv.c b/ompi/mpi/c/iallgatherv.c index 67427b916ac..1b9224074ea 100644 --- a/ompi/mpi/c/iallgatherv.c +++ b/ompi/mpi/c/iallgatherv.c @@ -50,6 +50,8 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_IALLGATHERV, 1); @@ -121,8 +123,10 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_iallgatherv(sendbuf, sendcount, sendtype, - recvbuf, recvcounts, displs, + recvbuf, &recvcounts_desc, &displs_desc, recvtype, comm, request, comm->c_coll->coll_iallgatherv_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/ialltoallv.c b/ompi/mpi/c/ialltoallv.c index 0bf6a51d394..4f6cbdb025f 100644 --- a/ompi/mpi/c/ialltoallv.c +++ b/ompi/mpi/c/ialltoallv.c @@ -50,6 +50,8 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl MPI_Request *request) { int i, size, err; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_IALLTOALLV, 1); @@ -126,8 +128,12 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_ialltoallv(sendbuf, sendcounts, sdispls, - sendtype, recvbuf, recvcounts, rdispls, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_ialltoallv(sendbuf, &sendcounts_desc, &sdispls_desc, + sendtype, recvbuf, &recvcounts_desc, &rdispls_desc, recvtype, comm, request, comm->c_coll->coll_ialltoallv_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); diff --git a/ompi/mpi/c/ialltoallw.c b/ompi/mpi/c/ialltoallw.c index 9db9fe6da6e..9a19838a2c3 100644 --- a/ompi/mpi/c/ialltoallw.c +++ b/ompi/mpi/c/ialltoallw.c @@ -50,6 +50,8 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl MPI_Request *request) { int i, size, err; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_IALLTOALLW, 1); @@ -116,9 +118,13 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_ialltoallw(sendbuf, sendcounts, sdispls, - sendtypes, recvbuf, recvcounts, - rdispls, recvtypes, comm, request, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_ialltoallw(sendbuf, &sendcounts_desc, &sdispls_desc, + sendtypes, recvbuf, &recvcounts_desc, + &rdispls_desc, recvtypes, comm, request, comm->c_coll->coll_ialltoallw_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { ompi_coll_base_retain_datatypes_w(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtypes, recvtypes, false); diff --git a/ompi/mpi/c/igatherv.c b/ompi/mpi/c/igatherv.c index e386a48e7c5..4081d85a633 100644 --- a/ompi/mpi/c/igatherv.c +++ b/ompi/mpi/c/igatherv.c @@ -48,6 +48,8 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_IGATHERV, 1); @@ -199,8 +201,10 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_igatherv(sendbuf, sendcount, sendtype, updated_recvbuf, - recvcounts, displs, recvtype, + &recvcounts_desc, &displs_desc, recvtype, root, comm, request, comm->c_coll->coll_igatherv_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { if (OMPI_COMM_IS_INTRA(comm)) { diff --git a/ompi/mpi/c/ineighbor_allgatherv.c b/ompi/mpi/c/ineighbor_allgatherv.c index 33f9ff74a56..461a6218983 100644 --- a/ompi/mpi/c/ineighbor_allgatherv.c +++ b/ompi/mpi/c/ineighbor_allgatherv.c @@ -53,6 +53,8 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_INEIGHBOR_ALLGATHERV, 1); @@ -140,8 +142,10 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_ineighbor_allgatherv(sendbuf, sendcount, sendtype, - recvbuf, (int *) recvcounts, (int *) displs, + recvbuf, &recvcounts_desc, &displs_desc, recvtype, comm, request, comm->c_coll->coll_ineighbor_allgatherv_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/ineighbor_alltoallv.c b/ompi/mpi/c/ineighbor_alltoallv.c index 91cecde7d2c..67be8fc9fb8 100644 --- a/ompi/mpi/c/ineighbor_alltoallv.c +++ b/ompi/mpi/c/ineighbor_alltoallv.c @@ -54,6 +54,8 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i { int i, err; int indegree, outdegree; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_INEIGHBOR_ALLTOALLV, 1); @@ -144,8 +146,12 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_ineighbor_alltoallv(sendbuf, sendcounts, sdispls, - sendtype, recvbuf, recvcounts, rdispls, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_ineighbor_alltoallv(sendbuf, &sendcounts_desc, &sdispls_desc, + sendtype, recvbuf, &recvcounts_desc, &rdispls_desc, recvtype, comm, request, comm->c_coll->coll_ineighbor_alltoallv_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); diff --git a/ompi/mpi/c/ineighbor_alltoallw.c b/ompi/mpi/c/ineighbor_alltoallw.c index eeced0a1f80..051a10b64c8 100644 --- a/ompi/mpi/c/ineighbor_alltoallw.c +++ b/ompi/mpi/c/ineighbor_alltoallw.c @@ -54,6 +54,8 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M { int i, err; int indegree, outdegree; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_INEIGHBOR_ALLTOALLW, 1); @@ -142,8 +144,12 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_ineighbor_alltoallw(sendbuf, sendcounts, sdispls, sendtypes, - recvbuf, recvcounts, rdispls, recvtypes, comm, request, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_ineighbor_alltoallw(sendbuf, &sendcounts_desc, &sdispls_desc, sendtypes, + recvbuf, &recvcounts_desc, &rdispls_desc, recvtypes, comm, request, comm->c_coll->coll_ineighbor_alltoallw_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { ompi_coll_base_retain_datatypes_w(*request, sendtypes, recvtypes, true); diff --git a/ompi/mpi/c/ireduce_scatter.c b/ompi/mpi/c/ireduce_scatter.c index f098816c15a..310af1aeac5 100644 --- a/ompi/mpi/c/ireduce_scatter.c +++ b/ompi/mpi/c/ireduce_scatter.c @@ -49,6 +49,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request) { int i, err, size, count; + ompi_count_array recvcounts_desc; SPC_RECORD(OMPI_SPC_IREDUCE_SCATTER, 1); @@ -132,7 +133,8 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_ireduce_scatter(sendbuf, recvbuf, recvcounts, + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + err = comm->c_coll->coll_ireduce_scatter(sendbuf, recvbuf, &recvcounts_desc, datatype, op, comm, request, comm->c_coll->coll_ireduce_scatter_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/iscatterv.c b/ompi/mpi/c/iscatterv.c index 2781fbba84b..1b8b909a0e9 100644 --- a/ompi/mpi/c/iscatterv.c +++ b/ompi/mpi/c/iscatterv.c @@ -48,6 +48,8 @@ int MPI_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs[ MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request) { int i, size, err; + ompi_count_array sendcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_ISCATTERV, 1); @@ -202,7 +204,9 @@ int MPI_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs[ } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_iscatterv(updated_sendbuf, sendcounts, displs, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); + err = comm->c_coll->coll_iscatterv(updated_sendbuf, &sendcounts_desc, &displs_desc, sendtype, updated_recvbuf, recvcount, recvtype, root, comm, request, comm->c_coll->coll_iscatterv_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/neighbor_allgatherv.c b/ompi/mpi/c/neighbor_allgatherv.c index 4e618fd7dec..56d1aee574c 100644 --- a/ompi/mpi/c/neighbor_allgatherv.c +++ b/ompi/mpi/c/neighbor_allgatherv.c @@ -53,6 +53,8 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen MPI_Datatype recvtype, MPI_Comm comm) { int in_size, out_size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLGATHERV, 1); @@ -151,8 +153,10 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen #endif /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_neighbor_allgatherv(sendbuf, sendcount, sendtype, - recvbuf, recvcounts, displs, + recvbuf, &recvcounts_desc, &displs_desc, recvtype, comm, comm->c_coll->coll_neighbor_allgatherv_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/neighbor_allgatherv_init.c b/ompi/mpi/c/neighbor_allgatherv_init.c index 8c3448bcfc2..5fb0833a9e3 100644 --- a/ompi/mpi/c/neighbor_allgatherv_init.c +++ b/ompi/mpi/c/neighbor_allgatherv_init.c @@ -54,6 +54,8 @@ int MPI_Neighbor_allgatherv_init(const void *sendbuf, int sendcount, MPI_Datatyp MPI_Info info, MPI_Request *request) { int i, size, err; + ompi_count_array recvcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLGATHERV_INIT, 1); @@ -141,8 +143,10 @@ int MPI_Neighbor_allgatherv_init(const void *sendbuf, int sendcount, MPI_Datatyp } /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); err = comm->c_coll->coll_neighbor_allgatherv_init(sendbuf, sendcount, sendtype, - recvbuf, (int *) recvcounts, (int *) displs, + recvbuf, &recvcounts_desc, &displs_desc, recvtype, comm, info, request, comm->c_coll->coll_neighbor_allgatherv_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/neighbor_alltoallv.c b/ompi/mpi/c/neighbor_alltoallv.c index 8b17498cd05..6b5c1192d7d 100644 --- a/ompi/mpi/c/neighbor_alltoallv.c +++ b/ompi/mpi/c/neighbor_alltoallv.c @@ -53,6 +53,8 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in { int i, err; int indegree, outdegree; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLTOALLV, 1); @@ -154,8 +156,12 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in #endif /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_neighbor_alltoallv(sendbuf, sendcounts, sdispls, sendtype, - recvbuf, recvcounts, rdispls, recvtype, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_neighbor_alltoallv(sendbuf, &sendcounts_desc, &sdispls_desc, sendtype, + recvbuf, &recvcounts_desc, &rdispls_desc, recvtype, comm, comm->c_coll->coll_neighbor_alltoallv_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/neighbor_alltoallv_init.c b/ompi/mpi/c/neighbor_alltoallv_init.c index 66bce716217..5839059be36 100644 --- a/ompi/mpi/c/neighbor_alltoallv_init.c +++ b/ompi/mpi/c/neighbor_alltoallv_init.c @@ -54,6 +54,8 @@ int MPI_Neighbor_alltoallv_init(const void *sendbuf, const int sendcounts[], con { int i, err; int indegree, outdegree; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLTOALLV_INIT, 1); @@ -144,8 +146,12 @@ int MPI_Neighbor_alltoallv_init(const void *sendbuf, const int sendcounts[], con } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_neighbor_alltoallv_init(sendbuf, sendcounts, sdispls, - sendtype, recvbuf, recvcounts, rdispls, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_neighbor_alltoallv_init(sendbuf, &sendcounts_desc, &sdispls_desc, + sendtype, recvbuf, &recvcounts_desc, &rdispls_desc, recvtype, comm, info, request, comm->c_coll->coll_neighbor_alltoallv_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/neighbor_alltoallw.c b/ompi/mpi/c/neighbor_alltoallw.c index df0a48becac..d921106ed4f 100644 --- a/ompi/mpi/c/neighbor_alltoallw.c +++ b/ompi/mpi/c/neighbor_alltoallw.c @@ -53,6 +53,8 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP { int i, err; int indegree, outdegree; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLTOALLW, 1); @@ -150,8 +152,12 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP #endif /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_neighbor_alltoallw(sendbuf, sendcounts, sdispls, sendtypes, - recvbuf, recvcounts, rdispls, recvtypes, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_neighbor_alltoallw(sendbuf, &sendcounts_desc, &sdispls_desc, sendtypes, + recvbuf, &recvcounts_desc, &rdispls_desc, recvtypes, comm, comm->c_coll->coll_neighbor_alltoallw_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/neighbor_alltoallw_init.c b/ompi/mpi/c/neighbor_alltoallw_init.c index 891f7706afb..d3f6506889a 100644 --- a/ompi/mpi/c/neighbor_alltoallw_init.c +++ b/ompi/mpi/c/neighbor_alltoallw_init.c @@ -54,6 +54,8 @@ int MPI_Neighbor_alltoallw_init(const void *sendbuf, const int sendcounts[], con { int i, err; int indegree, outdegree; + ompi_count_array sendcounts_desc, recvcounts_desc; + ompi_disp_array sdispls_desc, rdispls_desc; SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLTOALLW_INIT, 1); @@ -142,8 +144,12 @@ int MPI_Neighbor_alltoallw_init(const void *sendbuf, const int sendcounts[], con } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_neighbor_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, - recvbuf, recvcounts, rdispls, recvtypes, comm, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&sdispls_desc, sdispls); + OMPI_DISP_ARRAY_INIT(&rdispls_desc, rdispls); + err = comm->c_coll->coll_neighbor_alltoallw_init(sendbuf, &sendcounts_desc, &sdispls_desc, sendtypes, + recvbuf, &recvcounts_desc, &rdispls_desc, recvtypes, comm, info, request, comm->c_coll->coll_neighbor_alltoallw_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/reduce_scatter.c b/ompi/mpi/c/reduce_scatter.c index 976b3032101..76be0219587 100644 --- a/ompi/mpi/c/reduce_scatter.c +++ b/ompi/mpi/c/reduce_scatter.c @@ -48,6 +48,7 @@ int MPI_Reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[ MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) { int i, err, size, count; + ompi_count_array recvcounts_desc; SPC_RECORD(OMPI_SPC_REDUCE_SCATTER, 1); @@ -140,8 +141,9 @@ int MPI_Reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[ /* Invoke the coll component to perform the back-end operation */ + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); OBJ_RETAIN(op); - err = comm->c_coll->coll_reduce_scatter(sendbuf, recvbuf, recvcounts, + err = comm->c_coll->coll_reduce_scatter(sendbuf, recvbuf, &recvcounts_desc, datatype, op, comm, comm->c_coll->coll_reduce_scatter_module); OBJ_RELEASE(op); diff --git a/ompi/mpi/c/reduce_scatter_init.c b/ompi/mpi/c/reduce_scatter_init.c index 85c39567580..c9aae3e5365 100644 --- a/ompi/mpi/c/reduce_scatter_init.c +++ b/ompi/mpi/c/reduce_scatter_init.c @@ -50,6 +50,7 @@ int MPI_Reduce_scatter_init(const void *sendbuf, void *recvbuf, const int recvco MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Info info, MPI_Request *request) { int i, err, size, count; + ompi_count_array recvcounts_desc; SPC_RECORD(OMPI_SPC_REDUCE_SCATTER_INIT, 1); @@ -133,7 +134,8 @@ int MPI_Reduce_scatter_init(const void *sendbuf, void *recvbuf, const int recvco /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_reduce_scatter_init(sendbuf, recvbuf, recvcounts, + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + err = comm->c_coll->coll_reduce_scatter_init(sendbuf, recvbuf, &recvcounts_desc, datatype, op, comm, info, request, comm->c_coll->coll_reduce_scatter_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/mpi/c/scatterv.c b/ompi/mpi/c/scatterv.c index 55b4fd383e4..c2f7337745f 100644 --- a/ompi/mpi/c/scatterv.c +++ b/ompi/mpi/c/scatterv.c @@ -48,6 +48,8 @@ int MPI_Scatterv(const void *sendbuf, const int sendcounts[], const int displs[] MPI_Datatype recvtype, int root, MPI_Comm comm) { int i, size, err; + ompi_count_array sendcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_SCATTERV, 1); @@ -213,7 +215,9 @@ int MPI_Scatterv(const void *sendbuf, const int sendcounts[], const int displs[] } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_scatterv(updated_sendbuf, sendcounts, displs, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); + err = comm->c_coll->coll_scatterv(updated_sendbuf, &sendcounts_desc, &displs_desc, sendtype, updated_recvbuf, recvcount, recvtype, root, comm, comm->c_coll->coll_scatterv_module); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/scatterv_init.c b/ompi/mpi/c/scatterv_init.c index 9ea5a0ae157..5c30aa2a0c8 100644 --- a/ompi/mpi/c/scatterv_init.c +++ b/ompi/mpi/c/scatterv_init.c @@ -48,6 +48,8 @@ int MPI_Scatterv_init(const void *sendbuf, const int sendcounts[], const int dis MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Info info, MPI_Request *request) { int i, size, err; + ompi_count_array sendcounts_desc; + ompi_disp_array displs_desc; SPC_RECORD(OMPI_SPC_SCATTERV_INIT, 1); @@ -202,7 +204,9 @@ int MPI_Scatterv_init(const void *sendbuf, const int sendcounts[], const int dis } /* Invoke the coll component to perform the back-end operation */ - err = comm->c_coll->coll_scatterv_init(updated_sendbuf, sendcounts, displs, + OMPI_COUNT_ARRAY_INIT(&sendcounts_desc, sendcounts); + OMPI_DISP_ARRAY_INIT(&displs_desc, displs); + err = comm->c_coll->coll_scatterv_init(updated_sendbuf, &sendcounts_desc, &displs_desc, sendtype, updated_recvbuf, recvcount, recvtype, root, comm, info, request, comm->c_coll->coll_scatterv_init_module); if (OPAL_LIKELY(OMPI_SUCCESS == err)) { diff --git a/ompi/util/Makefile.am b/ompi/util/Makefile.am index 45f01c77069..53a89a074eb 100644 --- a/ompi/util/Makefile.am +++ b/ompi/util/Makefile.am @@ -10,4 +10,5 @@ # Source code files headers += \ - util/timings.h + util/timings.h \ + util/count_disp_array.h diff --git a/ompi/util/count_disp_array.h b/ompi/util/count_disp_array.h new file mode 100644 index 00000000000..9d1e4d665e3 --- /dev/null +++ b/ompi/util/count_disp_array.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2024 Triad National Security, LLC. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#ifndef OMPI_UTIL_COUNT_DISP_ARRAY_H +#define OMPI_UTIL_COUNT_DISP_ARRAY_H + +#include +#include +#include + +enum ompi_count_array_type { + OMPI_COUNT_ARRAY_TYPE_INT, + OMPI_COUNT_ARRAY_TYPE_SIZE_T, +}; + +typedef struct ompi_count_array { + enum ompi_count_array_type type; + union { + const int *int_array; + const size_t *size_t_array; + } data; +} ompi_count_array; + +/* Initialize an int variant of the count array */ +static inline void ompi_count_array_init(ompi_count_array *array, const int *data) +{ + array->type = OMPI_COUNT_ARRAY_TYPE_INT; + array->data.int_array = data; +} + +/* Initialize a bigcount variant of the count array */ +static inline void ompi_count_array_init_c(ompi_count_array *array, const size_t *data) +{ + array->type = OMPI_COUNT_ARRAY_TYPE_SIZE_T; + array->data.size_t_array = data; +} + +#if OPAL_C_HAVE__GENERIC +#define OMPI_COUNT_ARRAY_INIT(array, data) _Generic((data), \ + int *: ompi_count_array_init, \ + const int *: ompi_count_array_init, \ + size_t *: ompi_count_array_init_c, \ + const size_t *: ompi_count_array_init_c)(array, data) +#else +#define OMPI_COUNT_ARRAY_INIT(array, data) \ + do { \ + if (sizeof(*data) == sizeof(int)) { \ + ompi_count_array_init(array, (const int *) data); \ + } else if (sizeof(*data) == sizeof(size_t)) { \ + ompi_count_array_init_c(array, (const size_t *) data); \ + } \ + } while (0) +#endif + +/* Return if the internal type is 64-bit or not */ +static inline bool ompi_count_array_is_64bit(ompi_count_array *array) +{ + return array->type == OMPI_COUNT_ARRAY_TYPE_SIZE_T; +} + +static inline const void *ompi_count_array_ptr(ompi_count_array *array) +{ + if (OPAL_LIKELY(array->type == OMPI_COUNT_ARRAY_TYPE_INT)) + return array->data.int_array; + return array->data.size_t_array; +} + +/* Get a count in the array at index i */ +static inline size_t ompi_count_array_get(ompi_count_array *array, size_t i) +{ + if (OPAL_LIKELY(array->type == OMPI_COUNT_ARRAY_TYPE_INT)) + return array->data.int_array[i]; + return array->data.size_t_array[i]; +} + +enum ompi_disp_array_type { + OMPI_DISP_ARRAY_TYPE_INT, + OMPI_DISP_ARRAY_TYPE_PTRDIFF_T, +}; + +typedef struct ompi_disp_array { + enum ompi_disp_array_type type; + union { + const int *int_array; + const ptrdiff_t *ptrdiff_t_array; + } data; +} ompi_disp_array; + +/* Initialize an int variant of the disp array */ +static inline void ompi_disp_array_init(ompi_disp_array *array, const int *data) +{ + array->type = OMPI_DISP_ARRAY_TYPE_INT; + array->data.int_array = data; +} + +/* Initialize a bigcount variant of the disp array */ +static inline void ompi_disp_array_init_c(ompi_disp_array *array, const ptrdiff_t *data) +{ + array->type = OMPI_DISP_ARRAY_TYPE_PTRDIFF_T; + array->data.ptrdiff_t_array = data; +} + +#if OPAL_C_HAVE__GENERIC +#define OMPI_DISP_ARRAY_INIT(array, data) _Generic((data), \ + int *: ompi_disp_array_init, \ + const int *: ompi_disp_array_init, \ + ptrdiff_t *: ompi_disp_array_init_c, \ + const ptrdiff_t *: ompi_disp_array_init_c)(array, data) +#else +#define OMPI_DISP_ARRAY_INIT(array, data) \ + do { \ + if (sizeof(*data) == sizeof(int)) { \ + ompi_disp_array_init(array, (const int *) data); \ + } else if (sizeof(*data) == sizeof(ptrdiff_t)) { \ + ompi_disp_array_init(array, (const ptrdiff_t *) data); \ + } \ + } while(0) +#endif + +/* Return if the internal type is 64-bit or not */ +static inline bool ompi_disp_array_is_64bit(ompi_disp_array *array) +{ + return array->type == OMPI_DISP_ARRAY_TYPE_PTRDIFF_T; +} + +/* Get a displacement in the array at index i */ +static inline ptrdiff_t ompi_disp_array_get(ompi_disp_array *array, size_t i) +{ + if (OPAL_LIKELY(array->type == OMPI_DISP_ARRAY_TYPE_INT)) + return array->data.int_array[i]; + return array->data.ptrdiff_t_array[i]; +} + +static inline const void *ompi_disp_array_ptr(ompi_disp_array *array) +{ + if (OPAL_LIKELY(array->type == OMPI_DISP_ARRAY_TYPE_INT)) + return array->data.int_array; + return array->data.ptrdiff_t_array; +} + +#endif diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c index d40bb76a4c6..1016a38e5e3 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c @@ -115,6 +115,8 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, int i; void *sbuf, *rbuf; int *disps, *recvcounts; + ompi_count_array recvcounts_desc; + ompi_disp_array disps_desc; MPI_COLL_VERBOSE(20,"RUNNING MPI ALLGATHER"); mpi_module = (mca_scoll_mpi_module_t *) group->g_scoll.scoll_collect_module; @@ -196,8 +198,10 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, disps[i] = disps[i - 1] + recvcounts[i - 1]; } - rc = mpi_module->comm->c_coll->coll_allgatherv(source, nlong, stype, target, recvcounts, - disps, rtype, mpi_module->comm, + OMPI_COUNT_ARRAY_INIT(&recvcounts_desc, recvcounts); + OMPI_DISP_ARRAY_INIT(&disps_desc, disps); + rc = mpi_module->comm->c_coll->coll_allgatherv(source, nlong, stype, target, &recvcounts_desc, + &disps_desc, rtype, mpi_module->comm, mpi_module->comm->c_coll->coll_allgatherv_module); failed_allgather: free(recvcounts);