2013-03-28 01:09:41 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2007-02-28 04:11:01 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2015-02-15 22:47:27 +03:00
|
|
|
* Copyright (c) 2004-2015 The University of Tennessee and The University
|
2007-02-28 04:11:01 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2013-03-28 01:09:41 +04:00
|
|
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
|
|
|
|
* reserved.
|
coll/tuned: fix memory leaks and misc issues
as reported by Coverity with CIDs
70132, 70265, 70267, 70268, 70322, 70400, 70580, 70615,
1269934, 1269944, 1269968, 1269982, 1269983
2015-02-18 10:29:42 +03:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2007-02-28 04:11:01 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "mpi.h"
|
|
|
|
#include "ompi/constants.h"
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
#include "ompi/datatype/ompi_datatype.h"
|
2007-02-28 04:11:01 +03:00
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/mca/coll/coll.h"
|
|
|
|
#include "ompi/mca/coll/base/coll_tags.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
2015-02-15 22:47:27 +03:00
|
|
|
#include "ompi/mca/coll/base/coll_base_functions.h"
|
|
|
|
#include "coll_base_topo.h"
|
|
|
|
#include "coll_base_util.h"
|
2007-02-28 04:11:01 +03:00
|
|
|
|
2007-03-02 20:02:29 +03:00
|
|
|
/* Todo: gather_intra_generic, gather_intra_binary, gather_intra_chain,
|
|
|
|
* gather_intra_pipeline, segmentation? */
|
2007-02-28 04:11:01 +03:00
|
|
|
int
|
2015-02-15 22:47:27 +03:00
|
|
|
ompi_coll_base_gather_intra_binomial(void *sbuf, int scount,
|
2012-04-06 19:48:07 +04:00
|
|
|
struct ompi_datatype_t *sdtype,
|
|
|
|
void *rbuf, int rcount,
|
|
|
|
struct ompi_datatype_t *rdtype,
|
|
|
|
int root,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
mca_coll_base_module_t *module)
|
2007-02-28 04:11:01 +03:00
|
|
|
{
|
2012-04-06 19:48:07 +04:00
|
|
|
int line = -1, i, rank, vrank, size, total_recv = 0, err;
|
|
|
|
char *ptmp = NULL, *tempbuf = NULL;
|
2007-02-28 04:11:01 +03:00
|
|
|
ompi_coll_tree_t* bmtree;
|
|
|
|
MPI_Status status;
|
2015-02-15 22:47:27 +03:00
|
|
|
MPI_Aint sextent, slb, strue_lb, strue_extent;
|
2007-02-28 04:11:01 +03:00
|
|
|
MPI_Aint rextent, rlb, rtrue_lb, rtrue_extent;
|
2015-02-15 22:47:27 +03:00
|
|
|
mca_coll_base_module_t *base_module = (mca_coll_base_module_t*) module;
|
|
|
|
mca_coll_base_comm_t *data = base_module->base_data;
|
2007-02-28 04:11:01 +03:00
|
|
|
|
|
|
|
size = ompi_comm_size(comm);
|
|
|
|
rank = ompi_comm_rank(comm);
|
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
|
|
|
|
"ompi_coll_base_gather_intra_binomial rank %d", rank));
|
2007-02-28 04:11:01 +03:00
|
|
|
|
|
|
|
/* create the binomial tree */
|
2015-02-15 22:47:27 +03:00
|
|
|
COLL_BASE_UPDATE_IN_ORDER_BMTREE( comm, base_module, root );
|
2007-08-19 07:37:49 +04:00
|
|
|
bmtree = data->cached_in_order_bmtree;
|
2007-02-28 04:11:01 +03:00
|
|
|
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
ompi_datatype_get_extent(sdtype, &slb, &sextent);
|
|
|
|
ompi_datatype_get_true_extent(sdtype, &strue_lb, &strue_extent);
|
2007-02-28 04:11:01 +03:00
|
|
|
|
|
|
|
vrank = (rank - root + size) % size;
|
|
|
|
|
|
|
|
if (rank == root) {
|
2010-02-17 19:01:50 +03:00
|
|
|
ompi_datatype_get_extent(rdtype, &rlb, &rextent);
|
|
|
|
ompi_datatype_get_true_extent(rdtype, &rtrue_lb, &rtrue_extent);
|
2012-04-06 19:48:07 +04:00
|
|
|
if (0 == root){
|
|
|
|
/* root on 0, just use the recv buffer */
|
|
|
|
ptmp = (char *) rbuf;
|
|
|
|
if (sbuf != MPI_IN_PLACE) {
|
|
|
|
err = ompi_datatype_sndrcv(sbuf, scount, sdtype,
|
|
|
|
ptmp, rcount, rdtype);
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* root is not on 0, allocate temp buffer for recv,
|
|
|
|
* rotate data at the end */
|
|
|
|
tempbuf = (char *) malloc(rtrue_extent + ((ptrdiff_t)rcount * (ptrdiff_t)size - 1) * rextent);
|
|
|
|
if (NULL == tempbuf) {
|
|
|
|
err= OMPI_ERR_OUT_OF_RESOURCE; line = __LINE__; goto err_hndl;
|
|
|
|
}
|
|
|
|
|
2014-11-14 07:22:01 +03:00
|
|
|
ptmp = tempbuf - rtrue_lb;
|
2012-04-06 19:48:07 +04:00
|
|
|
if (sbuf != MPI_IN_PLACE) {
|
|
|
|
/* copy from sbuf to temp buffer */
|
|
|
|
err = ompi_datatype_sndrcv(sbuf, scount, sdtype,
|
|
|
|
ptmp, rcount, rdtype);
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
|
|
|
} else {
|
|
|
|
/* copy from rbuf to temp buffer */
|
2015-02-15 22:47:27 +03:00
|
|
|
err = ompi_datatype_copy_content_same_ddt(rdtype, rcount, ptmp,
|
2012-04-06 19:48:07 +04:00
|
|
|
(char *)rbuf + (ptrdiff_t)rank * rextent * (ptrdiff_t)rcount);
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
total_recv = rcount;
|
2007-02-28 04:11:01 +03:00
|
|
|
} else if (!(vrank % 2)) {
|
2012-04-06 19:48:07 +04:00
|
|
|
/* other non-leaf nodes, allocate temp buffer for data received from
|
|
|
|
* children, the most we need is half of the total data elements due
|
|
|
|
* to the property of binimoal tree */
|
|
|
|
tempbuf = (char *) malloc(strue_extent + ((ptrdiff_t)scount * (ptrdiff_t)size - 1) * sextent);
|
|
|
|
if (NULL == tempbuf) {
|
|
|
|
err= OMPI_ERR_OUT_OF_RESOURCE; line = __LINE__; goto err_hndl;
|
|
|
|
}
|
|
|
|
|
2014-11-14 07:22:01 +03:00
|
|
|
ptmp = tempbuf - strue_lb;
|
2012-04-06 19:48:07 +04:00
|
|
|
/* local copy to tempbuf */
|
|
|
|
err = ompi_datatype_sndrcv(sbuf, scount, sdtype,
|
2010-02-17 19:01:50 +03:00
|
|
|
ptmp, scount, sdtype);
|
2012-04-06 19:48:07 +04:00
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
|
|
|
|
|
|
|
/* use sdtype,scount as rdtype,rdcount since they are ignored on
|
|
|
|
* non-root procs */
|
|
|
|
rdtype = sdtype;
|
|
|
|
rcount = scount;
|
|
|
|
rextent = sextent;
|
|
|
|
total_recv = rcount;
|
2007-02-28 04:11:01 +03:00
|
|
|
} else {
|
2012-04-06 19:48:07 +04:00
|
|
|
/* leaf nodes, no temp buffer needed, use sdtype,scount as
|
|
|
|
* rdtype,rdcount since they are ignored on non-root procs */
|
|
|
|
ptmp = (char *) sbuf;
|
|
|
|
total_recv = scount;
|
2007-02-28 04:11:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(vrank % 2)) {
|
2012-04-06 19:48:07 +04:00
|
|
|
/* all non-leaf nodes recv from children */
|
|
|
|
for (i = 0; i < bmtree->tree_nextsize; i++) {
|
|
|
|
int mycount = 0, vkid;
|
|
|
|
/* figure out how much data I have to send to this child */
|
|
|
|
vkid = (bmtree->tree_next[i] - root + size) % size;
|
|
|
|
mycount = vkid - vrank;
|
|
|
|
if (mycount > (size - vkid))
|
|
|
|
mycount = size - vkid;
|
|
|
|
mycount *= rcount;
|
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
|
|
|
|
"ompi_coll_base_gather_intra_binomial rank %d recv %d mycount = %d",
|
2012-04-06 19:48:07 +04:00
|
|
|
rank, bmtree->tree_next[i], mycount));
|
|
|
|
|
|
|
|
err = MCA_PML_CALL(recv(ptmp + total_recv*rextent, (ptrdiff_t)rcount * size - total_recv, rdtype,
|
|
|
|
bmtree->tree_next[i], MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
comm, &status));
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
|
|
|
|
|
|
|
total_recv += mycount;
|
|
|
|
}
|
2007-02-28 04:11:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rank != root) {
|
2012-04-06 19:48:07 +04:00
|
|
|
/* all nodes except root send to parents */
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
|
|
|
|
"ompi_coll_base_gather_intra_binomial rank %d send %d count %d\n",
|
2012-04-06 19:48:07 +04:00
|
|
|
rank, bmtree->tree_prev, total_recv));
|
|
|
|
|
|
|
|
err = MCA_PML_CALL(send(ptmp, total_recv, sdtype,
|
|
|
|
bmtree->tree_prev,
|
|
|
|
MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
2007-02-28 04:11:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rank == root) {
|
2012-04-06 19:48:07 +04:00
|
|
|
if (root != 0) {
|
|
|
|
/* rotate received data on root if root != 0 */
|
|
|
|
err = ompi_datatype_copy_content_same_ddt(rdtype, (ptrdiff_t)rcount * (ptrdiff_t)(size - root),
|
|
|
|
(char *)rbuf + rextent * (ptrdiff_t)root * (ptrdiff_t)rcount, ptmp);
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
2007-02-28 04:11:01 +03:00
|
|
|
|
|
|
|
|
2012-04-06 19:48:07 +04:00
|
|
|
err = ompi_datatype_copy_content_same_ddt(rdtype, (ptrdiff_t)rcount * (ptrdiff_t)root,
|
|
|
|
(char *) rbuf, ptmp + rextent * (ptrdiff_t)rcount * (ptrdiff_t)(size-root));
|
|
|
|
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
2007-02-28 04:11:01 +03:00
|
|
|
|
2012-04-06 19:48:07 +04:00
|
|
|
free(tempbuf);
|
|
|
|
}
|
2007-02-28 04:11:01 +03:00
|
|
|
} else if (!(vrank % 2)) {
|
2012-04-06 19:48:07 +04:00
|
|
|
/* other non-leaf nodes */
|
|
|
|
free(tempbuf);
|
2007-02-28 04:11:01 +03:00
|
|
|
}
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
|
|
|
|
err_hndl:
|
|
|
|
if (NULL != tempbuf)
|
2012-04-06 19:48:07 +04:00
|
|
|
free(tempbuf);
|
2007-02-28 04:11:01 +03:00
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "%s:%4d\tError occurred %d, rank %2d",
|
2012-04-06 19:48:07 +04:00
|
|
|
__FILE__, line, err, rank));
|
2007-08-19 07:37:49 +04:00
|
|
|
return err;
|
2007-02-28 04:11:01 +03:00
|
|
|
}
|
|
|
|
|
2007-06-22 00:00:36 +04:00
|
|
|
/*
|
|
|
|
* gather_intra_linear_sync
|
|
|
|
*
|
|
|
|
* Function: - synchronized gather operation with
|
|
|
|
* Accepts: - same arguments as MPI_Gather(), first segment size
|
|
|
|
* Returns: - MPI_SUCCESS or error code
|
|
|
|
*/
|
|
|
|
int
|
2015-02-15 22:47:27 +03:00
|
|
|
ompi_coll_base_gather_intra_linear_sync(void *sbuf, int scount,
|
2007-06-22 00:00:36 +04:00
|
|
|
struct ompi_datatype_t *sdtype,
|
|
|
|
void *rbuf, int rcount,
|
|
|
|
struct ompi_datatype_t *rdtype,
|
2015-02-15 22:47:27 +03:00
|
|
|
int root,
|
2007-06-22 00:00:36 +04:00
|
|
|
struct ompi_communicator_t *comm,
|
2012-04-06 19:48:07 +04:00
|
|
|
mca_coll_base_module_t *module,
|
2007-06-22 00:00:36 +04:00
|
|
|
int first_segment_size)
|
|
|
|
{
|
2012-04-06 19:48:07 +04:00
|
|
|
int i, ret, line, rank, size, first_segment_count;
|
|
|
|
MPI_Aint extent, lb;
|
2007-06-22 00:00:36 +04:00
|
|
|
size_t typelng;
|
coll/tuned: fix memory leaks and misc issues
as reported by Coverity with CIDs
70132, 70265, 70267, 70268, 70322, 70400, 70580, 70615,
1269934, 1269944, 1269968, 1269982, 1269983
2015-02-18 10:29:42 +03:00
|
|
|
ompi_request_t **reqs = NULL;
|
2007-06-22 00:00:36 +04:00
|
|
|
|
|
|
|
size = ompi_comm_size(comm);
|
|
|
|
rank = ompi_comm_rank(comm);
|
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
|
|
|
|
"ompi_coll_base_gather_intra_linear_sync rank %d, segment %d", rank, first_segment_size));
|
2007-06-22 00:00:36 +04:00
|
|
|
|
|
|
|
if (rank != root) {
|
|
|
|
/* Non-root processes:
|
|
|
|
- receive zero byte message from the root,
|
|
|
|
- send the first segment of the data synchronously,
|
|
|
|
- send the second segment of the data.
|
|
|
|
*/
|
|
|
|
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
ompi_datatype_type_size(sdtype, &typelng);
|
|
|
|
ompi_datatype_get_extent(sdtype, &lb, &extent);
|
2007-06-22 00:00:36 +04:00
|
|
|
first_segment_count = scount;
|
2015-02-15 22:47:27 +03:00
|
|
|
COLL_BASE_COMPUTED_SEGCOUNT( (size_t) first_segment_size, typelng,
|
2007-06-22 00:00:36 +04:00
|
|
|
first_segment_count );
|
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
ret = MCA_PML_CALL(recv(sbuf, 0, MPI_BYTE, root,
|
2007-06-22 00:00:36 +04:00
|
|
|
MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
comm, MPI_STATUS_IGNORE));
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
|
|
|
|
ret = MCA_PML_CALL(send(sbuf, first_segment_count, sdtype, root,
|
|
|
|
MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
ret = MCA_PML_CALL(send((char*)sbuf + extent * first_segment_count,
|
|
|
|
(scount - first_segment_count), sdtype,
|
2007-06-22 00:00:36 +04:00
|
|
|
root, MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
|
2012-04-06 19:48:07 +04:00
|
|
|
} else {
|
|
|
|
|
2015-02-15 22:47:27 +03:00
|
|
|
/* Root process,
|
2007-06-22 00:00:36 +04:00
|
|
|
- For every non-root node:
|
2012-04-06 19:48:07 +04:00
|
|
|
- post irecv for the first segment of the message
|
|
|
|
- send zero byte message to signal node to send the message
|
|
|
|
- post irecv for the second segment of the message
|
|
|
|
- wait for the first segment to complete
|
2007-06-22 00:00:36 +04:00
|
|
|
- Copy local data if necessary
|
|
|
|
- Waitall for all the second segments to complete.
|
2012-04-06 19:48:07 +04:00
|
|
|
*/
|
2007-06-22 00:00:36 +04:00
|
|
|
char *ptmp;
|
coll/tuned: fix memory leaks and misc issues
as reported by Coverity with CIDs
70132, 70265, 70267, 70268, 70322, 70400, 70580, 70615,
1269934, 1269944, 1269968, 1269982, 1269983
2015-02-18 10:29:42 +03:00
|
|
|
ompi_request_t *first_segment_req;
|
2007-06-22 00:00:36 +04:00
|
|
|
reqs = (ompi_request_t**) calloc(size, sizeof(ompi_request_t*));
|
|
|
|
if (NULL == reqs) { ret = -1; line = __LINE__; goto error_hndl; }
|
2015-02-15 22:47:27 +03:00
|
|
|
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
ompi_datatype_type_size(rdtype, &typelng);
|
|
|
|
ompi_datatype_get_extent(rdtype, &lb, &extent);
|
2007-06-22 00:00:36 +04:00
|
|
|
first_segment_count = rcount;
|
2015-02-15 22:47:27 +03:00
|
|
|
COLL_BASE_COMPUTED_SEGCOUNT( (size_t)first_segment_size, typelng,
|
2007-06-22 00:00:36 +04:00
|
|
|
first_segment_count );
|
|
|
|
|
|
|
|
ptmp = (char *) rbuf;
|
2007-07-06 00:40:50 +04:00
|
|
|
for (i = 0; i < size; ++i) {
|
2015-02-15 22:47:27 +03:00
|
|
|
if (i == rank) {
|
2007-06-22 00:00:36 +04:00
|
|
|
/* skip myself */
|
2015-02-15 22:47:27 +03:00
|
|
|
reqs[i] = MPI_REQUEST_NULL;
|
|
|
|
continue;
|
|
|
|
}
|
2007-06-22 00:00:36 +04:00
|
|
|
|
|
|
|
/* irecv for the first segment from i */
|
2012-03-06 02:23:44 +04:00
|
|
|
ptmp = (char*)rbuf + (ptrdiff_t)i * (ptrdiff_t)rcount * extent;
|
2007-06-22 00:00:36 +04:00
|
|
|
ret = MCA_PML_CALL(irecv(ptmp, first_segment_count, rdtype, i,
|
|
|
|
MCA_COLL_BASE_TAG_GATHER, comm,
|
|
|
|
&first_segment_req));
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
2015-02-15 22:47:27 +03:00
|
|
|
|
2007-06-22 00:00:36 +04:00
|
|
|
/* send sync message */
|
|
|
|
ret = MCA_PML_CALL(send(rbuf, 0, MPI_BYTE, i,
|
|
|
|
MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
|
|
|
|
/* irecv for the second segment */
|
2012-03-06 02:23:44 +04:00
|
|
|
ptmp = (char*)rbuf + ((ptrdiff_t)i * (ptrdiff_t)rcount + first_segment_count) * extent;
|
2015-02-15 22:47:27 +03:00
|
|
|
ret = MCA_PML_CALL(irecv(ptmp, (rcount - first_segment_count),
|
2007-06-22 00:00:36 +04:00
|
|
|
rdtype, i, MCA_COLL_BASE_TAG_GATHER, comm,
|
|
|
|
&reqs[i]));
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
|
|
|
|
/* wait on the first segment to complete */
|
|
|
|
ret = ompi_request_wait(&first_segment_req, MPI_STATUS_IGNORE);
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy local data if necessary */
|
|
|
|
if (MPI_IN_PLACE != sbuf) {
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
ret = ompi_datatype_sndrcv(sbuf, scount, sdtype,
|
2015-02-15 22:47:27 +03:00
|
|
|
(char*)rbuf + (ptrdiff_t)rank * (ptrdiff_t)rcount * extent,
|
2012-04-06 19:48:07 +04:00
|
|
|
rcount, rdtype);
|
2007-06-22 00:00:36 +04:00
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
}
|
2015-02-15 22:47:27 +03:00
|
|
|
|
2007-06-22 00:00:36 +04:00
|
|
|
/* wait all second segments to complete */
|
|
|
|
ret = ompi_request_wait_all(size, reqs, MPI_STATUSES_IGNORE);
|
|
|
|
if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
|
|
|
|
|
|
|
|
free(reqs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
error_hndl:
|
coll/tuned: fix memory leaks and misc issues
as reported by Coverity with CIDs
70132, 70265, 70267, 70268, 70322, 70400, 70580, 70615,
1269934, 1269944, 1269968, 1269982, 1269983
2015-02-18 10:29:42 +03:00
|
|
|
if (NULL != reqs) {
|
|
|
|
free(reqs);
|
|
|
|
}
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT (( ompi_coll_base_framework.framework_output,
|
|
|
|
"ERROR_HNDL: node %d file %s line %d error %d\n",
|
2007-06-22 00:00:36 +04:00
|
|
|
rank, __FILE__, line, ret ));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-02-28 04:11:01 +03:00
|
|
|
/*
|
|
|
|
* Linear functions are copied from the BASIC coll module
|
|
|
|
* they do not segment the message and are simple implementations
|
2015-02-15 22:47:27 +03:00
|
|
|
* but for some small number of nodes and/or small data sizes they
|
|
|
|
* are just as fast as base/tree based segmenting operations
|
2007-02-28 04:11:01 +03:00
|
|
|
* and as such may be selected by the decision functions
|
|
|
|
* These are copied into this module due to the way we select modules
|
|
|
|
* in V1. i.e. in V2 we will handle this differently and so will not
|
|
|
|
* have to duplicate code.
|
2015-02-15 22:47:27 +03:00
|
|
|
* JPG following the examples from other coll_base implementations. Dec06.
|
2007-02-28 04:11:01 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* copied function (with appropriate renaming) starts here */
|
|
|
|
/*
|
|
|
|
* gather_intra
|
|
|
|
*
|
|
|
|
* Function: - basic gather operation
|
|
|
|
* Accepts: - same arguments as MPI_Gather()
|
|
|
|
* Returns: - MPI_SUCCESS or error code
|
|
|
|
*/
|
|
|
|
int
|
2015-02-15 22:47:27 +03:00
|
|
|
ompi_coll_base_gather_intra_basic_linear(void *sbuf, int scount,
|
2012-04-06 19:48:07 +04:00
|
|
|
struct ompi_datatype_t *sdtype,
|
|
|
|
void *rbuf, int rcount,
|
|
|
|
struct ompi_datatype_t *rdtype,
|
|
|
|
int root,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
mca_coll_base_module_t *module)
|
2007-02-28 04:11:01 +03:00
|
|
|
{
|
2012-04-06 19:48:07 +04:00
|
|
|
int i, err, rank, size;
|
2007-02-28 04:11:01 +03:00
|
|
|
char *ptmp;
|
2012-04-06 19:48:07 +04:00
|
|
|
MPI_Aint incr, extent, lb;
|
2007-02-28 04:11:01 +03:00
|
|
|
|
|
|
|
size = ompi_comm_size(comm);
|
|
|
|
rank = ompi_comm_rank(comm);
|
|
|
|
|
|
|
|
/* Everyone but root sends data and returns. */
|
2015-02-15 22:47:27 +03:00
|
|
|
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
|
|
|
|
"ompi_coll_base_gather_intra_basic_linear rank %d", rank));
|
2007-02-28 04:11:01 +03:00
|
|
|
|
|
|
|
if (rank != root) {
|
|
|
|
return MCA_PML_CALL(send(sbuf, scount, sdtype, root,
|
|
|
|
MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
MCA_PML_BASE_SEND_STANDARD, comm));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* I am the root, loop receiving the data. */
|
|
|
|
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
ompi_datatype_get_extent(rdtype, &lb, &extent);
|
2012-03-06 02:23:44 +04:00
|
|
|
incr = extent * (ptrdiff_t)rcount;
|
2007-02-28 04:11:01 +03:00
|
|
|
for (i = 0, ptmp = (char *) rbuf; i < size; ++i, ptmp += incr) {
|
|
|
|
if (i == rank) {
|
|
|
|
if (MPI_IN_PLACE != sbuf) {
|
- Split the datatype engine into two parts: an MPI specific part in
OMPI
and a language agnostic part in OPAL. The convertor is completely
moved into OPAL. This offers several benefits as described in RFC
http://www.open-mpi.org/community/lists/devel/2009/07/6387.php
namely:
- Fewer basic types (int* and float* types, boolean and wchar
- Fixing naming scheme to ompi-nomenclature.
- Usability outside of the ompi-layer.
- Due to the fixed nature of simple opal types, their information is
completely
known at compile time and therefore constified
- With fewer datatypes (22), the actual sizes of bit-field types may be
reduced
from 64 to 32 bits, allowing reorganizing the opal_datatype
structure, eliminating holes and keeping data required in convertor
(upon send/recv) in one cacheline...
This has implications to the convertor-datastructure and other parts
of the code.
- Several performance tests have been run, the netpipe latency does not
change with
this patch on Linux/x86-64 on the smoky cluster.
- Extensive tests have been done to verify correctness (no new
regressions) using:
1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and
ompi-ddt:
a. running both trunk and ompi-ddt resulted in no differences
(except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run
correctly).
b. with --enable-memchecker and running under valgrind (one buglet
when run with static found in test-suite, commited)
2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt:
all passed (except for the dynamic/ tests failed!! as trunk/MTT)
3. compilation and usage of HDF5 tests on Jaguar using PGI and
PathScale compilers.
4. compilation and usage on Scicortex.
- Please note, that for the heterogeneous case, (-m32 compiled
binaries/ompi), neither
ompi-trunk, nor ompi-ddt branch would successfully launch.
This commit was SVN r21641.
2009-07-13 08:56:31 +04:00
|
|
|
err = ompi_datatype_sndrcv(sbuf, scount, sdtype,
|
2012-04-06 19:48:07 +04:00
|
|
|
ptmp, rcount, rdtype);
|
2007-02-28 04:11:01 +03:00
|
|
|
} else {
|
|
|
|
err = MPI_SUCCESS;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
err = MCA_PML_CALL(recv(ptmp, rcount, rdtype, i,
|
|
|
|
MCA_COLL_BASE_TAG_GATHER,
|
|
|
|
comm, MPI_STATUS_IGNORE));
|
|
|
|
}
|
|
|
|
if (MPI_SUCCESS != err) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* copied function (with appropriate renaming) ends here */
|