lsst.base gc57f72a14a+0a940c1c1f
LSST Data Management Base Package
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
7namespace lsst {
8namespace base {
9
10extern bool const haveOpenBlas;
11extern bool const haveMkl;
12
16std::string const allowEnvvar = "LSST_ALLOW_IMPLICIT_THREADS";
17
18
21public:
22 NoThreadsException() : std::runtime_error("No threading library is available") {};
23};
24
26bool haveThreads() { return haveOpenBlas || haveMkl; }
27
31void setNumThreads(unsigned int numThreads);
32
37unsigned int getNumThreads();
38
56
57}} // namespace lsst::base
58
59
60#endif // include guard
No threading library is available.
Definition: threads.h:20
unsigned int getNumThreads()
Get maximum number of threads we might use.
Definition: threads.cc:120
bool disableImplicitThreading()
Disable threading that has not been set explicitly.
Definition: threads.cc:132
bool haveThreads()
Are threaded packages available?
Definition: threads.h:26
bool const haveOpenBlas
Is OpenBLAS available?
Definition: threads.cc:104
std::string const allowEnvvar
Environment variable to allow implicit threading.
Definition: threads.h:16
bool const haveMkl
Is MKL available?
Definition: threads.cc:105
void setNumThreads(unsigned int numThreads)
Set number of threads to use.
Definition: threads.cc:107
Definition: mainpage.dox:1
STL namespace.