LSSTApplications  20.0.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
lsst::base::haveThreads
bool haveThreads()
Are threaded packages available?
Definition: threads.h:26
std::string
STL class.
base
Definition: __init__.py:1
lsst::base::allowEnvvar
std::string const allowEnvvar
Environment variable to allow implicit threading.
Definition: threads.h:16
lsst::base::haveMkl
bool const haveMkl
Is MKL available?
Definition: threads.cc:105
lsst::base::disableImplicitThreading
bool disableImplicitThreading()
Disable threading that has not been set explicitly.
Definition: threads.cc:132
lsst::base::setNumThreads
void setNumThreads(unsigned int numThreads)
Set number of threads to use.
Definition: threads.cc:107
std::runtime_error
STL class.
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
std
STL namespace.
lsst::base::NoThreadsException::NoThreadsException
NoThreadsException()
Definition: threads.h:22
lsst::base::haveOpenBlas
bool const haveOpenBlas
Is OpenBLAS available?
Definition: threads.cc:104
lsst::base::getNumThreads
unsigned int getNumThreads()
Get maximum number of threads we might use.
Definition: threads.cc:120
lsst::base::NoThreadsException
No threading library is available.
Definition: threads.h:20