LSSTApplications  18.1.0
LSSTDataManagementBasePackage
threads.h
Go to the documentation of this file.
1 #ifndef LSST_BASE_THREADS_H
2 #define LSST_BASE_THREADS_H
3 
4 #include <stdexcept>
5 #include <string>
6 
7 namespace lsst {
8 namespace base {
9 
10 extern bool const haveOpenBlas;
11 extern bool const haveMkl;
12 
16 std::string const allowEnvvar = "LSST_ALLOW_IMPLICIT_THREADS";
17 
18 
21 public:
22  NoThreadsException() : std::runtime_error("No threading library is available") {};
23 };
24 
26 bool haveThreads() { return haveOpenBlas || haveMkl; }
27 
31 void setNumThreads(unsigned int numThreads);
32 
37 unsigned int getNumThreads();
38 
56 
57 }} // namespace lsst::base
58 
59 
60 #endif // include guard
STL namespace.
bool haveThreads()
Are threaded packages available?
Definition: threads.h:26
bool disableImplicitThreading()
Disable threading that has not been set explicitly.
Definition: threads.cc:132
bool const haveMkl
Is MKL available?
Definition: threads.cc:105
STL class.
No threading library is available.
Definition: threads.h:20
A base class for image defects.
std::string const allowEnvvar
Environment variable to allow implicit threading.
Definition: threads.h:16
void setNumThreads(unsigned int numThreads)
Set number of threads to use.
Definition: threads.cc:107
unsigned int getNumThreads()
Get maximum number of threads we might use.
Definition: threads.cc:120
bool const haveOpenBlas
Is OpenBLAS available?
Definition: threads.cc:104