Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
smp
openmp
Functions.h
Go to the documentation of this file.
1
//=================================================================================================
33
//=================================================================================================
34
35
#ifndef _BLAZE_MATH_SMP_OPENMP_FUNCTIONS_H_
36
#define _BLAZE_MATH_SMP_OPENMP_FUNCTIONS_H_
37
38
39
//*************************************************************************************************
40
// Includes
41
//*************************************************************************************************
42
43
#include <omp.h>
44
#include <
blaze/math/Exception.h
>
45
#include <
blaze/system/Inline.h
>
46
#include <
blaze/system/SMP.h
>
47
#include <
blaze/util/StaticAssert.h
>
48
#include <
blaze/util/Types.h
>
49
50
51
namespace
blaze {
52
53
//=================================================================================================
54
//
55
// SMP UTILITY FUNCTIONS
56
//
57
//=================================================================================================
58
59
//*************************************************************************************************
70
BLAZE_ALWAYS_INLINE
size_t
getNumThreads
()
71
{
72
return
omp_get_max_threads();
73
}
75
//*************************************************************************************************
76
77
78
//*************************************************************************************************
91
BLAZE_ALWAYS_INLINE
void
setNumThreads
(
size_t
number )
92
{
93
if
( number == 0UL ) {
94
BLAZE_THROW_INVALID_ARGUMENT
(
"Invalid number of threads"
);
95
}
96
97
omp_set_num_threads(
static_cast<
int
>
( number ) );
98
}
100
//*************************************************************************************************
101
102
103
//*************************************************************************************************
128
BLAZE_ALWAYS_INLINE
void
shutDownThreads
()
129
{}
131
//*************************************************************************************************
132
133
134
135
136
//=================================================================================================
137
//
138
// COMPILE TIME CONSTRAINTS
139
//
140
//=================================================================================================
141
142
//*************************************************************************************************
144
namespace
{
145
146
BLAZE_STATIC_ASSERT
(
BLAZE_OPENMP_PARALLEL_MODE
);
147
148
}
150
//*************************************************************************************************
151
152
}
// namespace blaze
153
154
#endif
StaticAssert.h
Compile time assertion.
blaze::getNumThreads
BLAZE_ALWAYS_INLINE size_t getNumThreads()
Returns the number of threads used for thread parallel operations.
Definition
Functions.h:77
blaze::setNumThreads
BLAZE_ALWAYS_INLINE void setNumThreads(size_t number)
Sets the number of threads to be used for thread parallel operations.
Definition
Functions.h:97
blaze::shutDownThreads
BLAZE_ALWAYS_INLINE void shutDownThreads()
Provides a reliable shutdown of C++11 threads for Visual Studio compilers.
Definition
Functions.h:128
BLAZE_STATIC_ASSERT
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition
StaticAssert.h:112
BLAZE_ALWAYS_INLINE
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition
Inline.h:85
BLAZE_OPENMP_PARALLEL_MODE
#define BLAZE_OPENMP_PARALLEL_MODE
Compilation switch for the OpenMP parallelization.
Definition
SMP.h:68
BLAZE_THROW_INVALID_ARGUMENT
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition
Exception.h:235
Exception.h
Header file for the exception macros of the math module.
Inline.h
System settings for the inline keywords.
SMP.h
System settings for the shared-memory parallelization.
Types.h
Header file for basic type definitions.
Generated by
1.18.0