2007-03-03 02:19:02 +03:00
/*
* Copyright ( c ) 2004 - 2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation . All rights reserved .
2012-03-06 02:23:44 +04:00
* Copyright ( c ) 2004 - 2012 The University of Tennessee and The University
2007-03-03 02:19:02 +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 .
* $ 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-03-03 02:19:02 +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"
# include "coll_tuned.h"
# include "coll_tuned_topo.h"
# include "coll_tuned_util.h"
int
ompi_coll_tuned_scatter_intra_binomial ( void * sbuf , int scount ,
struct ompi_datatype_t * sdtype ,
void * rbuf , int rcount ,
struct ompi_datatype_t * rdtype ,
2007-08-19 07:37:49 +04:00
int root ,
struct ompi_communicator_t * comm ,
2008-07-29 02:40:57 +04:00
mca_coll_base_module_t * module )
2007-03-03 02:19:02 +03:00
{
int line = - 1 ;
int i ;
int rank ;
int vrank ;
int size ;
2007-04-02 23:11:06 +04:00
int total_send = 0 ;
2007-03-03 02:19:02 +03:00
char * ptmp = NULL ;
char * tempbuf = NULL ;
int err ;
ompi_coll_tree_t * bmtree ;
MPI_Status status ;
MPI_Aint sextent , slb , strue_lb , strue_extent ;
MPI_Aint rextent , rlb , rtrue_lb , rtrue_extent ;
2007-08-19 07:37:49 +04:00
mca_coll_tuned_module_t * tuned_module = ( mca_coll_tuned_module_t * ) module ;
mca_coll_tuned_comm_t * data = tuned_module - > tuned_data ;
2007-03-03 02:19:02 +03:00
size = ompi_comm_size ( comm ) ;
rank = ompi_comm_rank ( comm ) ;
2008-06-09 18:53:58 +04:00
OPAL_OUTPUT ( ( ompi_coll_tuned_stream ,
2007-04-02 23:11:06 +04:00
" ompi_coll_tuned_scatter_intra_binomial rank %d " , rank ) ) ;
2007-03-03 02:19:02 +03:00
/* create the binomial tree */
2007-08-19 07:37:49 +04:00
COLL_TUNED_UPDATE_IN_ORDER_BMTREE ( comm , tuned_module , root ) ;
bmtree = data - > cached_in_order_bmtree ;
2007-03-03 02:19:02 +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 ) ;
ompi_datatype_get_extent ( rdtype , & rlb , & rextent ) ;
ompi_datatype_get_true_extent ( rdtype , & rtrue_lb , & rtrue_extent ) ;
2007-03-03 02:19:02 +03:00
vrank = ( rank - root + size ) % size ;
if ( rank = = root ) {
if ( 0 = = root ) {
/* root on 0, just use the send buffer */
2007-09-12 19:29:58 +04:00
ptmp = ( char * ) sbuf ;
2007-03-03 02:19:02 +03:00
if ( rbuf ! = MPI_IN_PLACE ) {
/* local copy to rbuf */
- 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 ,
2007-03-03 02:19:02 +03:00
rbuf , rcount , rdtype ) ;
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
}
} else {
/* root is not on 0, allocate temp buffer for send */
2012-03-06 02:23:44 +04:00
tempbuf = ( char * ) malloc ( strue_extent + ( ( ptrdiff_t ) scount * ( ptrdiff_t ) size - 1 ) * sextent ) ;
2007-03-03 02:19:02 +03:00
if ( NULL = = tempbuf ) {
err = OMPI_ERR_OUT_OF_RESOURCE ; line = __LINE__ ; goto err_hndl ;
}
ptmp = tempbuf - slb ;
/* and rotate data so they will eventually in the right place */
2012-03-06 02:23:44 +04:00
err = ompi_datatype_copy_content_same_ddt ( sdtype , ( ptrdiff_t ) scount * ( ptrdiff_t ) ( size - root ) ,
ptmp , ( char * ) sbuf + sextent * ( ptrdiff_t ) root * ( ptrdiff_t ) scount ) ;
2007-03-03 02:19:02 +03:00
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
2012-03-06 02:23:44 +04:00
err = ompi_datatype_copy_content_same_ddt ( sdtype , ( ptrdiff_t ) scount * ( ptrdiff_t ) root ,
ptmp + sextent * ( ptrdiff_t ) scount * ( ptrdiff_t ) ( size - root ) , ( char * ) sbuf ) ;
2007-03-03 02:19:02 +03:00
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
if ( rbuf ! = MPI_IN_PLACE ) {
/* local copy to rbuf */
- 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 ( ptmp , scount , sdtype ,
2007-03-03 02:19:02 +03:00
rbuf , rcount , rdtype ) ;
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
}
}
total_send = scount ;
} else if ( ! ( vrank % 2 ) ) {
/* non-root, non-leaf nodes, allocte temp buffer for recv
* the most we need is rcount * size / 2 */
2012-03-06 02:23:44 +04:00
tempbuf = ( char * ) malloc ( rtrue_extent + ( ( ptrdiff_t ) rcount * ( ptrdiff_t ) size - 1 ) * rextent ) ;
2007-03-03 02:19:02 +03:00
if ( NULL = = tempbuf ) {
err = OMPI_ERR_OUT_OF_RESOURCE ; line = __LINE__ ; goto err_hndl ;
}
ptmp = tempbuf - rlb ;
sdtype = rdtype ;
scount = rcount ;
sextent = rextent ;
total_send = scount ;
} else {
/* leaf nodes, just use rbuf */
2007-09-12 19:29:58 +04:00
ptmp = ( char * ) rbuf ;
2007-03-03 02:19:02 +03:00
}
if ( ! ( vrank % 2 ) ) {
if ( rank ! = root ) {
/* recv from parent on non-root */
2012-03-06 02:23:44 +04:00
err = MCA_PML_CALL ( recv ( ptmp , ( ptrdiff_t ) rcount * ( ptrdiff_t ) size , rdtype , bmtree - > tree_prev ,
2007-03-03 02:19:02 +03:00
MCA_COLL_BASE_TAG_SCATTER , comm , & status ) ) ;
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
/* local copy to rbuf */
- 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 ( ptmp , scount , sdtype ,
2007-03-03 02:19:02 +03:00
rbuf , rcount , rdtype ) ;
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
}
/* send to children on all non-leaf */
for ( i = 0 ; i < bmtree - > tree_nextsize ; i + + ) {
2012-03-06 02:23:44 +04:00
size_t mycount = 0 ;
int vkid ;
2007-03-03 02:19:02 +03:00
/* figure out how much data I have to send to this child */
vkid = ( bmtree - > tree_next [ i ] - root + size ) % size ;
mycount = vkid - vrank ;
2012-03-06 02:23:44 +04:00
if ( ( int ) mycount > ( size - vkid ) )
2007-03-03 02:19:02 +03:00
mycount = size - vkid ;
mycount * = scount ;
2012-03-06 02:23:44 +04:00
err = MCA_PML_CALL ( send ( ptmp + ( ptrdiff_t ) total_send * sextent , mycount , sdtype ,
2007-03-03 02:19:02 +03:00
bmtree - > tree_next [ i ] ,
MCA_COLL_BASE_TAG_SCATTER ,
MCA_PML_BASE_SEND_STANDARD , comm ) ) ;
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
total_send + = mycount ;
}
if ( NULL ! = tempbuf )
free ( tempbuf ) ;
} else {
/* recv from parent on leaf nodes */
err = MCA_PML_CALL ( recv ( ptmp , rcount , rdtype , bmtree - > tree_prev ,
MCA_COLL_BASE_TAG_SCATTER , comm , & status ) ) ;
if ( MPI_SUCCESS ! = err ) { line = __LINE__ ; goto err_hndl ; }
}
return MPI_SUCCESS ;
err_hndl :
if ( NULL ! = tempbuf )
free ( tempbuf ) ;
2008-06-09 18:53:58 +04:00
OPAL_OUTPUT ( ( ompi_coll_tuned_stream , " %s:%4d \t Error occurred %d, rank %2d " ,
2007-03-03 02:19:02 +03:00
__FILE__ , line , err , rank ) ) ;
2007-04-02 23:11:06 +04:00
return err ;
2007-03-03 02:19:02 +03:00
}
/*
* Linear functions are copied from the BASIC coll module
* they do not segment the message and are simple implementations
* but for some small number of nodes and / or small data sizes they
* are just as fast as tuned / tree based segmenting operations
* 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 .
* JPG following the examples from other coll_tuned implementations . Dec06 .
*/
/* copied function (with appropriate renaming) starts here */
/*
* scatter_intra
*
* Function : - basic scatter operation
* Accepts : - same arguments as MPI_Scatter ( )
* Returns : - MPI_SUCCESS or error code
*/
int
ompi_coll_tuned_scatter_intra_basic_linear ( void * sbuf , int scount ,
struct ompi_datatype_t * sdtype ,
void * rbuf , int rcount ,
struct ompi_datatype_t * rdtype ,
2007-08-19 07:37:49 +04:00
int root ,
struct ompi_communicator_t * comm ,
2008-07-29 02:40:57 +04:00
mca_coll_base_module_t * module )
2007-03-03 02:19:02 +03:00
{
int i , rank , size , err ;
char * ptmp ;
ptrdiff_t lb , incr ;
/* Initialize */
rank = ompi_comm_rank ( comm ) ;
size = ompi_comm_size ( comm ) ;
/* If not root, receive data. */
if ( rank ! = root ) {
err = MCA_PML_CALL ( recv ( rbuf , rcount , rdtype , root ,
MCA_COLL_BASE_TAG_SCATTER ,
comm , MPI_STATUS_IGNORE ) ) ;
return err ;
}
/* I am the root, loop sending 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
err = ompi_datatype_get_extent ( sdtype , & lb , & incr ) ;
2007-03-03 02:19:02 +03:00
if ( OMPI_SUCCESS ! = err ) {
return OMPI_ERROR ;
}
incr * = scount ;
for ( i = 0 , ptmp = ( char * ) sbuf ; i < size ; + + i , ptmp + = incr ) {
/* simple optimization */
if ( i = = rank ) {
if ( MPI_IN_PLACE ! = rbuf ) {
err =
- 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_sndrcv ( ptmp , scount , sdtype , rbuf , rcount ,
2007-03-03 02:19:02 +03:00
rdtype ) ;
}
} else {
err = MCA_PML_CALL ( send ( ptmp , scount , sdtype , i ,
MCA_COLL_BASE_TAG_SCATTER ,
MCA_PML_BASE_SEND_STANDARD , comm ) ) ;
}
if ( MPI_SUCCESS ! = err ) {
return err ;
}
}
/* All done */
return MPI_SUCCESS ;
}
/* copied function (with appropriate renaming) ends here */
/* The following are used by dynamic and forced rules */
/* publish details of each algorithm and if its forced/fixed/locked in */
/* as you add methods/algorithms you must update this and the query/map
routines */
/* this routine is called by the component only */
/* this makes sure that the mca parameters are set to their initial values
and perms */
/* module does not call this they call the forced_getvalues routine instead */
int
ompi_coll_tuned_scatter_intra_check_forced_init ( coll_tuned_force_algorithm_mca_param_indices_t * mca_param_indices )
{
int rc , max_alg = 2 , requested_alg ;
ompi_coll_tuned_forced_max_algorithms [ SCATTER ] = max_alg ;
rc = mca_base_param_reg_int ( & mca_coll_tuned_component . super . collm_version ,
" scatter_algorithm_count " ,
" Number of scatter algorithms available " ,
false , true , max_alg , NULL ) ;
mca_param_indices - > algorithm_param_index
= mca_base_param_reg_int ( & mca_coll_tuned_component . super . collm_version ,
" scatter_algorithm " ,
" Which scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 binomial. " ,
false , false , 0 , NULL ) ;
2009-01-03 18:56:25 +03:00
if ( mca_param_indices - > algorithm_param_index < 0 ) {
return mca_param_indices - > algorithm_param_index ;
}
2007-03-03 02:19:02 +03:00
mca_base_param_lookup_int ( mca_param_indices - > algorithm_param_index ,
& ( requested_alg ) ) ;
2008-08-11 15:21:04 +04:00
if ( 0 > requested_alg | | requested_alg > max_alg ) {
2007-03-03 02:19:02 +03:00
if ( 0 = = ompi_comm_rank ( MPI_COMM_WORLD ) ) {
2008-06-09 18:53:58 +04:00
opal_output ( 0 , " Scatter algorithm #%d is not available (range [0..%d]). Switching back to ignore(0) \n " ,
2007-03-03 02:19:02 +03:00
requested_alg , max_alg ) ;
}
mca_base_param_set_int ( mca_param_indices - > algorithm_param_index , 0 ) ;
}
mca_param_indices - > segsize_param_index
= mca_base_param_reg_int ( & mca_coll_tuned_component . super . collm_version ,
2007-06-29 00:56:55 +04:00
" scatter_algorithm_segmentsize " ,
2007-03-03 02:19:02 +03:00
" Segment size in bytes used by default for scatter algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation. Currently, available algorithms do not support segmentation. " ,
false , false , 0 , NULL ) ;
mca_param_indices - > tree_fanout_param_index
= mca_base_param_reg_int ( & mca_coll_tuned_component . super . collm_version ,
" scatter_algorithm_tree_fanout " ,
" Fanout for n-tree used for scatter algorithms. Only has meaning if algorithm is forced and supports n-tree topo based operation. Currently, available algorithms do not support n-tree topologies. " ,
false , false ,
ompi_coll_tuned_init_tree_fanout , /* get system wide default */
NULL ) ;
mca_param_indices - > chain_fanout_param_index
= mca_base_param_reg_int ( & mca_coll_tuned_component . super . collm_version ,
" scatter_algorithm_chain_fanout " ,
" Fanout for chains used for scatter algorithms. Only has meaning if algorithm is forced and supports chain topo based operation. Currently, available algorithms do not support chain topologies. " ,
false , false ,
ompi_coll_tuned_init_chain_fanout , /* get system wide default */
NULL ) ;
return ( MPI_SUCCESS ) ;
}
int
ompi_coll_tuned_scatter_intra_do_forced ( void * sbuf , int scount ,
struct ompi_datatype_t * sdtype ,
void * rbuf , int rcount ,
struct ompi_datatype_t * rdtype ,
2007-08-19 07:37:49 +04:00
int root ,
struct ompi_communicator_t * comm ,
2008-07-29 02:40:57 +04:00
mca_coll_base_module_t * module )
2007-03-03 02:19:02 +03:00
{
2007-08-19 07:37:49 +04:00
mca_coll_tuned_module_t * tuned_module = ( mca_coll_tuned_module_t * ) module ;
mca_coll_tuned_comm_t * data = tuned_module - > tuned_data ;
2008-06-09 18:53:58 +04:00
OPAL_OUTPUT ( ( ompi_coll_tuned_stream ,
2007-03-03 02:19:02 +03:00
" coll:tuned:scatter_intra_do_forced selected algorithm %d " ,
2007-08-19 07:37:49 +04:00
data - > user_forced [ SCATTER ] . algorithm ) ) ;
2007-03-03 02:19:02 +03:00
2007-08-19 07:37:49 +04:00
switch ( data - > user_forced [ SCATTER ] . algorithm ) {
2007-03-03 02:19:02 +03:00
case ( 0 ) :
return ompi_coll_tuned_scatter_intra_dec_fixed ( sbuf , scount , sdtype ,
rbuf , rcount , rdtype ,
2007-08-19 07:37:49 +04:00
root , comm , module ) ;
2007-03-03 02:19:02 +03:00
case ( 1 ) :
return ompi_coll_tuned_scatter_intra_basic_linear ( sbuf , scount , sdtype ,
rbuf , rcount , rdtype ,
2007-08-19 07:37:49 +04:00
root , comm , module ) ;
2007-03-03 02:19:02 +03:00
case ( 2 ) :
return ompi_coll_tuned_scatter_intra_binomial ( sbuf , scount , sdtype ,
rbuf , rcount , rdtype ,
2007-08-19 07:37:49 +04:00
root , comm , module ) ;
2007-03-03 02:19:02 +03:00
default :
2008-06-09 18:53:58 +04:00
OPAL_OUTPUT ( ( ompi_coll_tuned_stream ,
2007-03-03 02:19:02 +03:00
" coll:tuned:scatter_intra_do_forced attempt to select algorithm %d when only 0-%d is valid? " ,
2007-08-19 07:37:49 +04:00
data - > user_forced [ SCATTER ] . algorithm ,
2007-03-03 02:19:02 +03:00
ompi_coll_tuned_forced_max_algorithms [ SCATTER ] ) ) ;
return ( MPI_ERR_ARG ) ;
} /* switch */
}
int
ompi_coll_tuned_scatter_intra_do_this ( void * sbuf , int scount ,
struct ompi_datatype_t * sdtype ,
void * rbuf , int rcount ,
struct ompi_datatype_t * rdtype ,
2007-08-19 07:37:49 +04:00
int root ,
struct ompi_communicator_t * comm ,
2008-07-29 02:40:57 +04:00
mca_coll_base_module_t * module ,
2007-03-03 02:19:02 +03:00
int algorithm , int faninout , int segsize )
{
2008-06-09 18:53:58 +04:00
OPAL_OUTPUT ( ( ompi_coll_tuned_stream ,
2007-03-03 02:19:02 +03:00
" coll:tuned:scatter_intra_do_this selected algorithm %d topo faninout %d segsize %d " ,
algorithm , faninout , segsize ) ) ;
switch ( algorithm ) {
case ( 0 ) :
return ompi_coll_tuned_scatter_intra_dec_fixed ( sbuf , scount , sdtype ,
rbuf , rcount , rdtype ,
2007-08-19 07:37:49 +04:00
root , comm , module ) ;
2007-03-03 02:19:02 +03:00
case ( 1 ) :
return ompi_coll_tuned_scatter_intra_basic_linear ( sbuf , scount , sdtype ,
rbuf , rcount , rdtype ,
2007-08-19 07:37:49 +04:00
root , comm , module ) ;
2007-03-03 02:19:02 +03:00
case ( 2 ) :
return ompi_coll_tuned_scatter_intra_binomial ( sbuf , scount , sdtype ,
rbuf , rcount , rdtype ,
2007-08-19 07:37:49 +04:00
root , comm , module ) ;
2007-03-03 02:19:02 +03:00
default :
2008-06-09 18:53:58 +04:00
OPAL_OUTPUT ( ( ompi_coll_tuned_stream ,
2007-03-03 02:19:02 +03:00
" coll:tuned:scatter_intra_do_this attempt to select algorithm %d when only 0-%d is valid? " ,
algorithm ,
ompi_coll_tuned_forced_max_algorithms [ SCATTER ] ) ) ;
return ( MPI_ERR_ARG ) ;
} /* switch */
}