Functions.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SMP_THREADS_FUNCTIONS_H_
36 #define _BLAZE_MATH_SMP_THREADS_FUNCTIONS_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Exception.h>
45 #include <blaze/system/Inline.h>
46 #include <blaze/system/SMP.h>
48 #include <blaze/util/Types.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // SMP UTILITY FUNCTIONS
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
69 {
70  return TheThreadBackend::size();
71 }
73 //*************************************************************************************************
74 
75 
76 //*************************************************************************************************
89 BLAZE_ALWAYS_INLINE void setNumThreads( size_t number )
90 {
91  if( number == 0UL ) {
92  BLAZE_THROW_INVALID_ARGUMENT( "Invalid number of threads" );
93  }
94 
95  TheThreadBackend::resize( number );
96 }
98 //*************************************************************************************************
99 
100 
101 //*************************************************************************************************
127 {
128 #if (defined _MSC_VER)
129  TheThreadBackend::resize( 0UL, true );
130 #endif
131 }
133 //*************************************************************************************************
134 
135 
136 
137 
138 //=================================================================================================
139 //
140 // COMPILE TIME CONSTRAINTS
141 //
142 //=================================================================================================
143 
144 //*************************************************************************************************
146 namespace {
147 
149 
150 }
152 //*************************************************************************************************
153 
154 } // namespace blaze
155 
156 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for basic type definitions.
#define BLAZE_BOOST_THREADS_PARALLEL_MODE
Compilation switch for the Boost parallelization.This compilation switch enables/disables the paralle...
Definition: SMP.h:152
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Compile time assertion.
System settings for the shared-memory parallelization.
#define BLAZE_CPP_THREADS_PARALLEL_MODE
Compilation switch for the C++11 parallelization.This compilation switch enables/disables the paralle...
Definition: SMP.h:124
Header file for the exception macros of the math module.
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
BLAZE_ALWAYS_INLINE void shutDownThreads()
Provides a reliable shutdown of C++11 threads for Visual Studio compilers.
Definition: Functions.h:128
BLAZE_ALWAYS_INLINE void setNumThreads(size_t number)
Sets the number of threads to be used for thread parallel operations.
Definition: Functions.h:97
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Header file for the C++11 and Boost thread backend.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
System settings for the inline keywords.
BLAZE_ALWAYS_INLINE size_t getNumThreads()
Returns the number of threads used for thread parallel operations.
Definition: Functions.h:77