RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDThreads.h
Go to the documentation of this file.
1//
2// Copyright (C) 2015-2018 Greg Landrum
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10
11#include <RDGeneral/export.h>
12#ifndef RDTHREADS_H_2015
13#define RDTHREADS_H_2015
14
15#include <RDGeneral/Invariant.h>
16
17#ifdef RDK_BUILD_THREADSAFE_SSS
18#include <thread>
19
20namespace RDKit {
21inline unsigned int getNumThreadsToUse(int target) {
22 if (target >= 1) {
23 return static_cast<unsigned int>(target);
24 }
25 unsigned int res = std::thread::hardware_concurrency();
27 return res + target;
28 } else {
29 return 1;
30 }
31}
32} // namespace RDKit
33
34#else
35
36namespace RDKit {
37inline unsigned int getNumThreadsToUse(int target) {
39 return 1;
40}
41} // namespace RDKit
42#endif
43
44#endif
#define RDUNUSED_PARAM(x)
Definition Invariant.h:196
Std stuff.
bool rdvalue_is(const RDValue_cast_t)
unsigned int getNumThreadsToUse(int target)
Definition RDThreads.h:37