Blaze 3.9
Classes
Shared memory parallelization module

Classes

class  blaze::ParallelSection< T >
 Section for the debugging of the shared-memory parallelization. More...
 
class  blaze::SerialSection< T >
 Section to enforce the serial execution of operations. More...
 

Dense matrix SMP functions

template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpAssign (Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
 Default implementation of the SMP assignment of a matrix to a dense matrix. More...
 
template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpAddAssign (Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
 Default implementation of the SMP addition assignment of a matrix to a dense matrix. More...
 
template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpSubAssign (Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
 Default implementation of the SMP subtraction assignment of a matrix to dense matrix. More...
 
template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpSchurAssign (Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
 Default implementation of the SMP Schur product assignment of a matrix to dense matrix. More...
 

Dense vector SMP functions

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpAssign (Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
 Default implementation of the SMP assignment of a vector to a dense vector. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpAddAssign (Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
 Default implementation of the SMP addition assignment of a vector to a dense vector. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpSubAssign (Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
 Default implementation of the SMP subtraction assignment of a vector to a dense vector. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpMultAssign (Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
 Default implementation of the SMP multiplication assignment of a vector to a dense vector. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpDivAssign (Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
 Default implementation of the SMP division assignment of a vector to a dense vector. More...
 

SMP utility functions

BLAZE_ALWAYS_INLINE size_t blaze::getNumThreads ()
 Returns the number of threads used for thread parallel operations. More...
 
BLAZE_ALWAYS_INLINE void blaze::setNumThreads (size_t number)
 Sets the number of threads to be used for thread parallel operations. More...
 
BLAZE_ALWAYS_INLINE void blaze::shutDownThreads ()
 Provides a reliable shutdown of C++11 threads for Visual Studio compilers. More...
 

ParallelSection functions

bool blaze::isParallelSectionActive ()
 Returns whether a parallel section is active or not. More...
 
#define BLAZE_PARALLEL_SECTION    if( blaze::ParallelSection<int> BLAZE_JOIN( parallelSection, __LINE__ ) = true )
 Section for the debugging of the shared-memory parallelization. More...
 

SerialSection functions

bool blaze::isSerialSectionActive ()
 Returns whether a serial section is active or not. More...
 
#define BLAZE_SERIAL_SECTION    if( blaze::SerialSection<int> BLAZE_JOIN( serialSection, __LINE__ ) = true )
 Section to enforce the serial execution of operations. More...
 

Detailed Description

Macro Definition Documentation

◆ BLAZE_PARALLEL_SECTION

#define BLAZE_PARALLEL_SECTION    if( blaze::ParallelSection<int> BLAZE_JOIN( parallelSection, __LINE__ ) = true )

Section for the debugging of the shared-memory parallelization.

During the shared-memory parallel (SMP) execution of an operation nested calls to the SMP assign functions are conceptually not allowed. In other words, it is not allowed to call a SMP assign function from within a non-SMP assign function. The BLAZE_PARALLEL_SECTION macro can be used to mark the start of a parallel section and with that detect nested SMP assign function calls. In case a nested use of a parallel section is detected, a std::runtime_error exception is thrown.
Note that this macro is reserved for internal debugging purposes only and therefore must NOT be used explicitly! Using this macro might result in erroneous results, runtime or compilation errors.

◆ BLAZE_SERIAL_SECTION

#define BLAZE_SERIAL_SECTION    if( blaze::SerialSection<int> BLAZE_JOIN( serialSection, __LINE__ ) = true )

Section to enforce the serial execution of operations.

This macro provides the option to start a serial section to enforce the serial execution of operations. The following example demonstrates how a serial section is used:

// ... Resizing and initialization
// Start of a serial section
// All operations executed within the serial section are guaranteed to be executed in
// serial (even if a parallel execution would be possible and/or beneficial).
x = A * b;
y = A * c;
z = A * d;
}
Efficient implementation of a dynamic matrix.
Definition: DynamicMatrix.h:242
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
#define BLAZE_SERIAL_SECTION
Section to enforce the serial execution of operations.
Definition: SerialSection.h:262
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
constexpr bool columnVector
Transpose flag for column vectors.
Definition: TransposeFlag.h:58

Note that it is not allowed to use nested serial sections (i.e. a serial section within another serial section). In case the nested use of a serial section is detected, a std::runtime_error exception is thrown.

Function Documentation

◆ getNumThreads()

BLAZE_ALWAYS_INLINE size_t blaze::getNumThreads ( )

Returns the number of threads used for thread parallel operations.

Returns
The number of threads used for thread parallel operations.

Via this function the number of threads used for thread parallel operations can be queried. Note that in case no parallelization is active the function will always return 1.

◆ isParallelSectionActive()

bool blaze::isParallelSectionActive ( )
inline

Returns whether a parallel section is active or not.

Returns
true if a parallel section is active, false if not.

◆ isSerialSectionActive()

bool blaze::isSerialSectionActive ( )
inline

Returns whether a serial section is active or not.

Returns
true if a serial section is active, false if not.

◆ setNumThreads()

BLAZE_ALWAYS_INLINE void blaze::setNumThreads ( size_t  number)

Sets the number of threads to be used for thread parallel operations.

Parameters
numberThe given number of threads $[1..\infty)$.
Returns
void
Exceptions
std::invalid_argumentInvalid number of threads.

Via this function the maximum number of threads for thread parallel operations can be specified. Note that the given number must be in the range $[1..\infty)$. In case an invalid number of threads is specified, a std::invalid_argument exception is thrown. Also note that in case no parallelization is active, the function has no effect.

◆ shutDownThreads()

BLAZE_ALWAYS_INLINE void blaze::shutDownThreads ( )

Provides a reliable shutdown of C++11 threads for Visual Studio compilers.

Returns
void

There is a known issue in Visual Studio 2012 and 2013 that may cause C++11 threads to hang if their destructor is executed after the main() function:

http://connect.microsoft.com/VisualStudio/feedback/details/747145

This function, which has only an effect for Visual Studio compilers, provides a reliable way to circumvent this problem. If called directly before the end of the main() function it blocks until all threads have been destroyed:

int main()
{
// ... Using the C++11 thread parallelization of Blaze
}
BLAZE_ALWAYS_INLINE void shutDownThreads()
Provides a reliable shutdown of C++11 threads for Visual Studio compilers.
Definition: Functions.h:128

◆ smpAddAssign() [1/2]

template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpAddAssign ( Matrix< MT1, SO1 > &  lhs,
const Matrix< MT2, SO2 > &  rhs 
) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
inline

Default implementation of the SMP addition assignment of a matrix to a dense matrix.

Default implementation of the SMP addition assignment of a matrix to a sparse matrix.

Parameters
lhsThe target left-hand side dense matrix.
rhsThe right-hand side matrix to be added.
Returns
void

This function implements the default SMP addition assignment of a matrix to a dense matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse matrix.
rhsThe right-hand side matrix to be added.
Returns
void

This function implements the default SMP addition assignment of a matrix to a sparse matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpAddAssign() [2/2]

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpAddAssign ( Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
) -> EnableIf_t< IsDenseVector_v< VT1 > >
inline

Default implementation of the SMP addition assignment of a vector to a dense vector.

Default implementation of the SMP addition assignment of a vector to a sparse vector.

Parameters
lhsThe target left-hand side dense vector.
rhsThe right-hand side vector to be added.
Returns
void

This function implements the default SMP addition assignment of a vector to a dense vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse vector.
rhsThe right-hand side vector to be added.
Returns
void

This function implements the default SMP addition assignment of a vector to a sparse vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpAssign() [1/2]

template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpAssign ( Matrix< MT1, SO1 > &  lhs,
const Matrix< MT2, SO2 > &  rhs 
) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
inline

Default implementation of the SMP assignment of a matrix to a dense matrix.

Default implementation of the SMP assignment of a matrix to a sparse matrix.

Parameters
lhsThe target left-hand side dense matrix.
rhsThe right-hand side matrix to be assigned.
Returns
void

This function implements the default SMP assignment of a matrix to a dense matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse matrix.
rhsThe right-hand side matrix to be assigned.
Returns
void

This function implements the default SMP assignment of a matrix to a sparse matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpAssign() [2/2]

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpAssign ( Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
) -> EnableIf_t< IsDenseVector_v< VT1 > >
inline

Default implementation of the SMP assignment of a vector to a dense vector.

Default implementation of the SMP assignment of a vector to a sparse vector.

Parameters
lhsThe target left-hand side dense vector.
rhsThe right-hand side vector to be assigned.
Returns
void

This function implements the default SMP assignment of a vector to a dense vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse vector.
rhsThe right-hand side vector to be assigned.
Returns
void

This function implements the default SMP assignment of a vector to a sparse vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpDivAssign()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpDivAssign ( Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
) -> EnableIf_t< IsDenseVector_v< VT1 > >
inline

Default implementation of the SMP division assignment of a vector to a dense vector.

Parameters
lhsThe target left-hand side dense vector.
rhsThe right-hand side vector divisor.
Returns
void

This function implements the default SMP division assignment of a vector to a dense vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpMultAssign()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpMultAssign ( Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
) -> EnableIf_t< IsDenseVector_v< VT1 > >
inline

Default implementation of the SMP multiplication assignment of a vector to a dense vector.

Default implementation of the SMP multiplication assignment of a vector to a sparse vector.

Parameters
lhsThe target left-hand side dense vector.
rhsThe right-hand side vector to be multiplied.
Returns
void

This function implements the default SMP multiplication assignment of a vector to a dense vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse vector.
rhsThe right-hand side vector to be multiplied.
Returns
void

This function implements the default SMP multiplication assignment of a vector to a sparse vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpSchurAssign()

template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpSchurAssign ( Matrix< MT1, SO1 > &  lhs,
const Matrix< MT2, SO2 > &  rhs 
) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
inline

Default implementation of the SMP Schur product assignment of a matrix to dense matrix.

Default implementation of the SMP Schur product assignment of a matrix to sparse matrix.

Parameters
lhsThe target left-hand side dense matrix.
rhsThe right-hand side matrix for the Schur product.
Returns
void

This function implements the default SMP Schur product assignment of a matrix to a dense matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse matrix.
rhsThe right-hand side matrix for the Schur product.
Returns
void

This function implements the default SMP Schur product assignment of a matrix to a sparse matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpSubAssign() [1/2]

template<typename MT1 , bool SO1, typename MT2 , bool SO2>
auto blaze::smpSubAssign ( Matrix< MT1, SO1 > &  lhs,
const Matrix< MT2, SO2 > &  rhs 
) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
inline

Default implementation of the SMP subtraction assignment of a matrix to dense matrix.

Default implementation of the SMP subtraction assignment of a matrix to sparse matrix.

Parameters
lhsThe target left-hand side dense matrix.
rhsThe right-hand side matrix to be subtracted.
Returns
void

This function implements the default SMP subtraction assignment of a matrix to a dense matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse matrix.
rhsThe right-hand side matrix to be subtracted.
Returns
void

This function implements the default SMP subtraction assignment of a matrix to a sparse matrix.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

◆ smpSubAssign() [2/2]

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
auto blaze::smpSubAssign ( Vector< VT1, TF1 > &  lhs,
const Vector< VT2, TF2 > &  rhs 
) -> EnableIf_t< IsDenseVector_v< VT1 > >
inline

Default implementation of the SMP subtraction assignment of a vector to a dense vector.

Default implementation of the SMP subtraction assignment of a vector to a sparse vector.

Parameters
lhsThe target left-hand side dense vector.
rhsThe right-hand side vector to be subtracted.
Returns
void

This function implements the default SMP subtraction assignment of a vector to a dense vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Parameters
lhsThe target left-hand side sparse vector.
rhsThe right-hand side vector to be subtracted.
Returns
void

This function implements the default SMP subtraction assignment of a vector to a sparse vector.
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.