159 template<
typename T >
171 "Can only broadcast arithmetic types." );
186 template<
typename T >
197 "Can only broadcast arithmetic types." );
231 template <
typename T >
233 allreduce(
const T * aSend, T * aRecv,
const int aCount )
237 static_assert( std::is_arithmetic< T >::value,
238 "allreduce: MAX-reduction is defined for arithmetic types only" );
240 BELFEM_ASSERT( aCount >= 0,
"allreduce: negative count %d", aCount );
252 if ( aSend != aRecv )
254 for (
int i = 0; i < aCount; ++i )
256 aRecv[ i ] = aSend[ i ];
273 template <
typename T >
277 static_assert( std::is_arithmetic< T >::value,
278 "allreduce_min: MIN-reduction is defined for arithmetic types only" );
280 BELFEM_ASSERT( aCount >= 0,
"allreduce_min: negative count %d", aCount );
291 if ( aSend != aRecv )
293 for (
int i = 0; i < aCount; ++i )
295 aRecv[ i ] = aSend[ i ];
312 template<
typename T >
320 if( aTarget <
comm_size() && tMyRank != aTarget )
324 MPI_Request tRequest;
336 comm_check( MPI_Wait( &tRequest, &tStatus ) );
349 template<
typename T >
361 if( aSource < tCommSize && tMyRank != aSource )
365 MPI_Request tRequest;
377 comm_check( MPI_Wait( &tRequest, &tStatus ) );
399 template<
typename T >
410 if ( aTarget < tCommSize && aTarget != tMyRank )
413 MPI_Status tSizeStatus;
414 MPI_Request tSizeRequest;
417 int tCommTag =
comm_tag( tMyRank, aTarget );
429 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
432 if ( aLength == 0 ) return ;
438 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
439 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
450 for (
index_t c : tChunkSizes )
460 & tRequest[ tCount++] ) );
467 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
489 template<
typename T >
501 if ( aSource < tCommSize && aSource != tMyRank )
504 MPI_Status tSizeStatus;
505 MPI_Request tSizeRequest;
508 int tCommTag =
comm_tag( aSource, tMyRank );
522 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
525 BELFEM_ERROR( tSize <= aLength,
"Datastream too large ( length %u but expect <=%u ).",
526 (
unsigned int ) tSize, (
unsigned int ) aLength );
532 if ( aLength == 0 ) return ;
538 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
539 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
550 for (
index_t c : tChunkSizes )
560 & tRequest[ tCount++] ) );
567 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
585 template<
typename T >
594 if ( tMyRank == aTarget ) return ;
600 MPI_Status tSizeStatus;
601 MPI_Request tSizeRequest;
604 int tCommTag =
comm_tag( tMyRank, aTarget );
616 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
619 if ( tSize == 0 ) return ;
631 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
632 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
638 const T * tData = aData.
data();
640 for (
index_t c : tChunkSizes )
649 &tRequest[ tCount++ ] ) );
655 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
670 template<
typename T >
680 if ( tMyRank == aSource ) return ;
690 if ( tSize == 0 ) return ;
703 int tCommTag =
comm_tag( aSource, tMyRank ) + 1 ;
706 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
707 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
713 T * tData = aData.
data();
715 for (
index_t c : tChunkSizes )
725 &tRequest[ tCount++ ] ) );
731 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
746 template<
typename T >
756 index_t tSize = tMyRank == aRoot ? aData.
size() : 0 ;
759 MPI_Request tSizeRequest ;
769 MPI_Status tSizeStatus ;
770 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
773 if ( tMyRank != aRoot ) aData.
set_size( tSize );
775 if ( tSize == 0 ) return ;
778 MPI_Request tDataRequest ;
788 MPI_Status tDataStatus ;
789 comm_check( MPI_Wait( &tDataRequest, &tDataStatus ) );
802 template<
typename T >
814 "Length of cell does not match ( is %u, expect commsize %u ).",
815 (
unsigned int ) aData.
size(), (
unsigned int ) tCommSize );
818 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCommSize );
819 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCommSize );
821 for(
proc_t p=0; p<tCommSize; ++p )
825 tRequest[ p ] = MPI_REQUEST_NULL;
841 comm_check( MPI_Waitall( tCommSize, tRequest, tStatus ) );
857 template<
typename T >
871 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCommSize );
872 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCommSize );
874 for(
proc_t p=0; p<tCommSize; ++p )
878 tRequest[ p ] = MPI_REQUEST_NULL;
879 aData( p ) = aMyValue ;
895 comm_check( MPI_Waitall( tCommSize, tRequest, tStatus ) );
913 template<
typename T >
922 if ( tMyRank == aTarget ) return ;
928 MPI_Status tSizeStatus;
929 MPI_Request tSizeRequest;
932 int tCommTag =
comm_tag( tMyRank, aTarget );
944 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
947 if ( tSize == 0 ) return ;
959 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
960 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
966 const T * tData = aData.
data();
968 for (
index_t c : tChunkSizes )
977 &tRequest[ tCount++ ] ) );
983 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
998 template<
typename T >
1008 if ( tMyRank == aSource ) return ;
1018 if ( tSize == 0 ) return ;
1031 int tCommTag =
comm_tag( aSource, tMyRank ) + 1 ;
1034 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
1035 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
1041 T * tData = aData.
data();
1043 for (
index_t c : tChunkSizes )
1053 &tRequest[ tCount++ ] ) );
1059 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1074 template<
typename T >
1087 MPI_Request tSizeRequest ;
1097 MPI_Status tSizeStatus ;
1098 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
1101 if ( tMyRank != aRoot ) aData.
set_size( tSize );
1103 if ( tSize == 0 ) return ;
1106 MPI_Request tDataRequest ;
1116 MPI_Status tDataStatus ;
1117 comm_check( MPI_Wait( &tDataRequest, &tDataStatus ) );
1129 template<
typename T >
1141 "Length of vector does not match ( is %u, expect commsize %u ).",
1142 (
unsigned int ) aData.
length(), (
unsigned int ) tCommSize );
1145 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCommSize );
1146 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCommSize );
1148 for(
proc_t p=0; p<tCommSize; ++p )
1152 tRequest[ p ] = MPI_REQUEST_NULL;
1168 comm_check( MPI_Waitall( tCommSize, tRequest, tStatus ) );
1184 template<
typename T >
1198 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCommSize );
1199 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCommSize );
1201 for(
proc_t p=0; p<tCommSize; ++p )
1205 tRequest[ p ] = MPI_REQUEST_NULL;
1206 aData( p ) = aMyValue ;
1222 comm_check( MPI_Waitall( tCommSize, tRequest, tStatus ) );
1237 template<
typename T >
1250 "Length of data container does not match ( is %u, expect commsize %u ).",
1251 (
unsigned int ) aData.size(), (
unsigned int ) tCommSize );
1255 for (
proc_t p=0; p<tCommSize; ++p )
1257 tSizes( p ) = aData( p ).
length();
1265 MPI_Request* tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * tCount );
1266 MPI_Status* tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * tCount );
1275 for(
proc_t p=0; p<tCommSize; ++p )
1278 if ( p == tMyRank || aData( p ).length() == 0 ) continue ;
1281 const T * tData = aData( p ).data();
1291 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1293 for (
index_t c : tChunkSizes )
1302 &tRequest[ tCount++ ] ) );
1309 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1323 template<
typename T >
1336 "Length of data container does not match ( is %u, expect commsize %u ).",
1337 (
unsigned int ) aData.size(), (
unsigned int ) tCommSize );
1341 for (
proc_t p=0; p<tCommSize; ++p )
1343 tSizes( p ) = aData( p ).size();
1351 MPI_Request* tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * tCount );
1352 MPI_Status* tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * tCount );
1361 for(
proc_t p=0; p<tCommSize; ++p )
1364 if ( p == tMyRank || aData( p ).size() == 0 ) continue ;
1367 const T * tData = aData( p ).data();
1377 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1379 for (
index_t c : tChunkSizes )
1388 &tRequest[ tCount++ ] ) );
1395 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1412 template<
typename T,
typename U >
1425 "Length of offset container does not match ( is %u, expect commsize %u ).",
1426 (
unsigned int ) aOffsets.
length(), (
unsigned int ) tCommSize + 1 );
1432 for (
proc_t p=0; p<tCommSize; ++p )
1434 tSizes( p ) = aOffsets( p+1 ) - aOffsets( p );
1442 MPI_Request* tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * tCount );
1443 MPI_Status* tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * tCount );
1452 for(
proc_t p=0; p<tCommSize; ++p )
1455 if ( p == tMyRank || tSizes( p ) == 0 ) continue ;
1461 index_t tOffset = aOffsets( p ) ;
1465 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1467 for (
index_t c : tChunkSizes )
1476 &tRequest[ tCount++ ] ) );
1483 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1492 template<
typename T,
typename U >
1507 tSizes( 0 ) = aOffsets( 0 );
1511 for (
proc_t p=1; p<tCommSize; ++p )
1517 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCount );
1518 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCount );
1526 for(
proc_t p=1; p<tCommSize; ++p )
1531 if ( tSize == 0 )
continue;
1537 index_t tOffset = aOffsets( p ) ;
1541 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1543 for (
index_t c : tChunkSizes )
1552 &tRequest[ tCount++ ] ) );
1559 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1575 template<
typename T >
1588 aData.set_size( tCommSize, {} );
1595 for (
proc_t p=0;
p<tCommSize; ++
p )
1599 if( aMyData.length() > 0 )
1601 aData( p ).vector_data() = std::move( aMyData.vector_data() ) ;
1607 aData( p ).set_size( tSizes( p ), 0 );
1613 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCount );
1614 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCount );
1622 for(
proc_t p=0;
p<tCommSize; ++
p )
1627 if ( p == tMyRank || tSize == 0 )
continue;
1630 T * tData = aData( p ).data() ;
1640 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1642 for (
index_t c : tChunkSizes )
1651 &tRequest[ tCount++ ] ) );
1658 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1669 template<
typename T >
1681 MPI_Request* tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * ( tCommSize-1 ) );
1682 MPI_Status* tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * ( tCommSize-1 ) );
1692 for (
proc_t p=0; p<tCommSize; ++p )
1694 if ( p == tMyRank )
continue;
1696 int tCommTag =
comm_tag( tMyRank, p );
1704 &tRequest[ tCount ++ ] ) );
1708 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1716 tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * tCount );
1717 tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * tCount );
1719 if ( aData.
length() > 0 )
1722 for(
proc_t p=0; p<tCommSize; ++p )
1725 if ( p == tMyRank ) continue ;
1728 const T * tData = aData.
data();
1738 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1740 for (
index_t c : tChunkSizes )
1749 &tRequest[ tCount++ ] ) );
1756 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1769 template<
typename T >
1781 MPI_Request* tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * ( tCommSize-1 ) );
1782 MPI_Status* tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * ( tCommSize-1 ) );
1792 for (
proc_t p=0; p<tCommSize; ++p )
1794 if ( p == tMyRank )
continue;
1796 int tCommTag =
comm_tag( tMyRank, p );
1804 &tRequest[ tCount ++ ] ) );
1808 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1816 tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * tCount );
1817 tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * tCount );
1819 if ( aData.
size() > 0 )
1822 for(
proc_t p=0; p<tCommSize; ++p )
1825 if ( p == tMyRank ) continue ;
1828 const T * tData = aData.
data();
1838 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
1840 for (
index_t c : tChunkSizes )
1849 &tRequest[ tCount++ ] ) );
1856 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
1877 template<
typename T >
1897 tSize[ 0 ] = aData.
n_rows();
1898 tSize[ 1 ] = aData.
n_cols();
1902 MPI_Request tSizeRequest ;
1912 MPI_Status tSizeStatus ;
1913 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
1916 if ( tMyRank != aRoot ) aData.
set_size( tSize[ 0 ], tSize[ 1 ] );
1919 if( tSize[ 0 ] == 0 || tSize[ 1 ] == 0 ) return ;
1922 "broadcast( Matrix ) : transfer length %lu exceeds local buffer capacity %lu",
1923 (
long unsigned int ) tSize[ 2 ],
1924 (
long unsigned int ) aData.
capacity() );
1928 "broadcast( Matrix ) : matrix too large for unchunked broadcast, use send/receive" );
1931 MPI_Request tDataRequest ;
1941 MPI_Status tDataStatus ;
1942 comm_check( MPI_Wait( &tDataRequest, &tDataStatus ) );
1947 template<
typename T >
1957 if ( tMyRank == aTarget ) return ;
1970 tSize[ 0 ] = aData.
n_rows();
1971 tSize[ 1 ] = aData.
n_cols();
1975 MPI_Status tSizeStatus;
1976 MPI_Request tSizeRequest;
1979 int tCommTag =
comm_tag( tMyRank, aTarget );
1991 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
1994 if( tSize[ 0 ] == 0 || tSize[ 1 ] == 0 ) return ;
2006 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
2007 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
2013 const T * tData = aData.
data();
2015 for (
index_t c : tChunkSizes )
2024 &tRequest[ tCount++ ] ) );
2030 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
2045 template<
typename T >
2055 if ( tMyRank == aSource ) return ;
2058 MPI_Status tSizeStatus;
2059 MPI_Request tSizeRequest;
2062 int tCommTag =
comm_tag( tMyRank, aSource );
2082 comm_check( MPI_Wait( &tSizeRequest, &tSizeStatus ) );
2084 aData.
set_size( tSize[ 0 ], tSize[ 1 ] );
2087 if ( tSize[ 0 ] == 0 || tSize[ 1 ] == 0 ) return ;
2090 "receive( Matrix ) : transfer length %lu exceeds local buffer capacity %lu",
2091 (
long unsigned int ) tSize[ 2 ],
2092 (
long unsigned int ) aData.
capacity() );
2104 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tChunkSizes.
size() );
2105 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tChunkSizes.
size() );
2111 T * tData = aData.
data();
2113 for (
index_t c : tChunkSizes )
2122 &tRequest[ tCount++ ] ) );
2128 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
2142 template<
typename T >
2155 "Length of data container does not match ( is %u, expect commsize %u ).",
2156 (
unsigned int ) aData.size(), (
unsigned int ) tCommSize );
2161 for (
proc_t p=0; p<tCommSize; ++p )
2163 tSizes[ tCount++ ] = aData( p ).n_rows();
2164 tSizes[ tCount++ ] = aData( p ).n_cols();
2168 tSizes[ tCount++ ] = aData( p ).spacing() * aData( p ).n_cols();
2171 MPI_Request* tSizeRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCommSize );
2172 MPI_Status* tSizeStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCommSize );
2176 for (
proc_t p=0; p<tCommSize; ++p )
2180 tSizeRequest[ p ] = MPI_REQUEST_NULL;
2192 &tSizeRequest[ p ] ) );
2198 comm_check( MPI_Waitall( tCommSize, tSizeRequest, tSizeStatus ) );
2199 free( tSizeRequest );
2200 free( tSizeStatus );
2205 for (
proc_t p=0; p<tCommSize; ++p )
2208 if ( p == tMyRank || aData( p ).n_rows() == 0 || aData( p ).n_cols() == 0 )
2213 tCount +=
comm_split( tSizes[ tOffset ] ).size();
2222 MPI_Status* tStatus = ( MPI_Status * ) malloc(
sizeof( MPI_Status ) * tCount );
2223 MPI_Request* tRequest = ( MPI_Request * ) malloc(
sizeof( MPI_Request ) * tCount );
2231 for(
proc_t p=0; p<tCommSize; ++p )
2234 if ( p == tMyRank || aData( p ).n_rows() == 0 || aData( p ).n_cols() == 0 )
2240 const T * tData = aData( p ).data();
2250 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
2252 for (
index_t c : tChunkSizes )
2256 &tData[ tDataOffset ],
2262 &tRequest[ tCount++ ] ) );
2269 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
2285 template<
typename T >
2298 aData.set_size( tCommSize, {} );
2304 MPI_Request* tSizeRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCommSize );
2305 MPI_Status* tSizeStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCommSize );
2309 for (
proc_t p=0; p<tCommSize; ++p )
2313 tSizeRequest[ p ] = MPI_REQUEST_NULL;
2314 tSizes[ tOffset++ ] = 0 ;
2315 tSizes[ tOffset++ ] = 0 ;
2316 tSizes[ tOffset++ ] = 0 ;
2327 &tSizeRequest[ p ] ) );
2333 comm_check( MPI_Waitall( tCommSize, tSizeRequest, tSizeStatus ) );
2335 free( tSizeStatus );
2336 free( tSizeRequest );
2341 for (
proc_t p=0; p<tCommSize; ++p )
2350 aData( p ).set_size( tSizes[ tOffset ], tSizes[ tOffset+1 ] );
2353 if ( tSizes[ tOffset ] == 0 || tSizes[ tOffset+1 ] == 0 )
2360 tCount +=
comm_split( tSizes[ tOffset + 2 ] ).size();
2365 MPI_Status* tStatus = ( MPI_Status* ) malloc(
sizeof( MPI_Status ) * tCount );
2366 MPI_Request* tRequest = ( MPI_Request* ) malloc(
sizeof( MPI_Request ) * tCount );
2377 for(
proc_t p=0; p<tCommSize; ++p )
2385 if ( aData( p ).n_rows() == 0 || aData( p ).n_cols() == 0 )
2391 BELFEM_ERROR( aData( p ).capacity() >= tSizes[ tOffset + 2 ],
2392 "collect( Matrix ) : transfer length %lu from proc %u exceeds local buffer capacity %lu",
2393 (
long unsigned int ) tSizes[ tOffset + 2 ],
2395 (
long unsigned int ) aData( p ).capacity() );
2401 T * tData = aData( p ).data() ;
2408 int tCommTag =
comm_tag( tMyRank, p ) + 1 ;
2410 for (
index_t c : tChunkSizes )
2413 comm_check( MPI_Irecv( &tData[ tDataOffset ],
2419 &tRequest[ tCount++ ] ) );
2428 comm_check( MPI_Waitall( tCount, tRequest, tStatus ) );
2447 send(
const string & aMessage,
const proc_t aTarget=0 );
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
belfem::Communicator gComm
Definition belfem.cpp:35
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
void set_size(const size_t aSize)
Definition cl_Cell.hpp:189
size_t size() const
return the size of the Cell
Definition cl_Cell.hpp:181
T * data()
Definition cl_Cell.hpp:120
Global MPI communicator manager.
Definition cl_Communicator.hpp:60
COMM_TYPE & world()
Definition cl_Communicator.cpp:249
proc_t rank() const
Definition cl_Communicator.hpp:192
proc_t size() const
Definition cl_Communicator.hpp:200
Dense column-major matrix.
Definition cl_BZ_Matrix.hpp:28
size_t spacing() const
inter-column stride of the data container ( the leading dimension in BLAS terms; here always n_rows )
Definition cl_AR_Matrix.hpp:236
size_t capacity() const
length of data container
Definition cl_AR_Matrix.hpp:224
void set_size(const size_t aNumRows, const size_t aNumCols)
Definition cl_AR_Matrix.hpp:186
size_t n_rows() const
Definition cl_AR_Matrix.hpp:205
size_t n_cols() const
Definition cl_AR_Matrix.hpp:213
T * data()
Definition cl_AR_Matrix.hpp:135
Column vector.
Definition cl_BZ_Vector.hpp:41
T * data()
expose the underlying raw pointer ( writable version )
Definition cl_AR_Vector.hpp:182
void set_size(const size_t aNumRows)
change the size of the vector
Definition cl_AR_Vector.hpp:237
size_t length() const
get the length of the vector
Definition cl_AR_Vector.hpp:257
const real c
speed of light in m/s ( exact ) http://physics.nist.gov/cgi-bin/cuu/Value?c
Definition constants.hpp:65
USER GUIDES:
Definition cl_Capacitor.cpp:16
proc_t comm_rank()
Returns the rank of the current process in the communicator.
Definition commtools.cpp:30
void receive(string &aMessage, const proc_t aSource)
Definition commtools.cpp:348
comm_t comm_type()
returns the MPI datatype handle for T
Definition commtypes.hpp:37
void share(Vector< T > &aData)
Definition commtools.hpp:1671
void collect(Cell< T > &aData, const T aMyValue=0)
Collects scalar values from all processes into a cell.
Definition commtools.hpp:859
@ T
Definition cl_Material.hpp:122
void comm_barrier()
Synchronizes all processes in the communicator.
Definition commtools.cpp:57
int comm_t
Definition commtypes.hpp:27
void comm_drain_check(const char *aLabel)
Debug-build tripwire for the two-tags-per-pair ordering contract of the point-to-point fabric ( see c...
Definition commtools.cpp:117
int proc_t
Definition commtypes.hpp:29
index_t comm_splitcount(const Vector< index_t > &aLengths, const proc_t aRoot)
Calculates the total number of chunks needed for a set of message lengths.
Definition commtools.cpp:228
void distribute(Cell< T > &aData)
Distributes elements of a cell to other processes.
Definition commtools.hpp:804
void allreduce(const T *aSend, T *aRecv, const int aCount)
Collective MAX-reduction visible on every rank.
Definition commtools.hpp:233
int comm_tag(const proc_t aSource, const proc_t aTarget)
Generates a unique tag for MPI communication between two processes.
Definition commtools.cpp:102
constexpr int gMaxCommChunkLength
Definition commtools.hpp:31
void broadcast(Cell< string > &aData, const proc_t aRoot)
Definition commtools.cpp:276
Cell< int > comm_split(const index_t aLength)
Splits a message into chunks for MPI communication.
Definition commtools.cpp:207
uint32_t index_t
Definition typedefs.hpp:52
void allreduce_min(const T *aSend, T *aRecv, const int aCount)
Collective MIN-reduction visible on every rank.
Definition commtools.hpp:275
void send(const string &aMessage, const proc_t aTarget)
Definition commtools.cpp:340
void comm_check(const int aErrorCode)
Checks the MPI error code and reports any errors.
Definition commtools.cpp:38
proc_t comm_size()
Returns the number of processes in the communicator.
Definition commtools.cpp:22
p
Definition test_curve_frame.py:64
Definition commtools.hpp:38