From 7d523a885253543ba3b0419b74649d21fdf3cdc0 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 5 Mar 2012 14:30:30 +0000 Subject: [PATCH] Avoid calling the bcast with counts larger than INT_MAX. This commit was SVN r26098. --- ompi/mca/coll/tuned/coll_tuned_allgather.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_allgather.c b/ompi/mca/coll/tuned/coll_tuned_allgather.c index be328f635b..a5864f3622 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allgather.c +++ b/ompi/mca/coll/tuned/coll_tuned_allgather.c @@ -726,8 +726,18 @@ ompi_coll_tuned_allgather_intra_basic_linear(void *sbuf, int scount, rbuf, rcount, rdtype, 0, comm, comm->c_coll.coll_gather_module); if (MPI_SUCCESS == err) { - err = comm->c_coll.coll_bcast(rbuf, rcount * ompi_comm_size(comm), rdtype, - 0, comm, comm->c_coll.coll_bcast_module); + size_t length = (size_t)rcount * ompi_comm_size(comm); + if( length < (size_t)INT_MAX ) { + err = comm->c_coll.coll_bcast(rbuf, rcount * ompi_comm_size(comm), rdtype, + 0, comm, comm->c_coll.coll_bcast_module); + } else { + ompi_datatype_t* temptype; + ompi_datatype_create_contiguous(ompi_comm_size(comm), rdtype, &temptype); + ompi_datatype_commit(&temptype); + err = comm->c_coll.coll_bcast(rbuf, rcount, temptype, + 0, comm, comm->c_coll.coll_bcast_module); + ompi_datatype_free(&temptype); + } } /* All done */