RDKit
Open-source cheminformatics and machine learning.
RDThreads.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2015 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
#ifndef RDTHREADS_H_2015
12
#define RDTHREADS_H_2015
13
14
#include <
RDGeneral/Invariant.h
>
15
16
#ifdef RDK_THREADSAFE_SSS
17
#include <
RDGeneral/BoostStartInclude.h
>
18
#include <boost/thread.hpp>
19
#include <
RDGeneral/BoostEndInclude.h
>
20
21
namespace
RDKit
{
22
inline
unsigned
int
getNumThreadsToUse
(
int
target) {
23
if
(target >= 1) {
24
return
static_cast<
unsigned
int
>
(target);
25
}
26
unsigned
int
res = boost::thread::hardware_concurrency();
27
if
(res > rdcast<unsigned int>(-target)) {
28
return
res + target;
29
}
else
{
30
return
1;
31
}
32
}
33
}
34
35
#else
36
37
namespace
RDKit
{
38
inline
unsigned
int
getNumThreadsToUse
(
int
target) {
39
RDUNUSED_PARAM
(target);
40
return
1;
41
}
42
}
43
#endif
44
45
#endif
BoostStartInclude.h
Invariant.h
BoostEndInclude.h
RDKit
Std stuff.
Definition:
Atom.h:29
RDKit::getNumThreadsToUse
unsigned int getNumThreadsToUse(int target)
Definition:
RDThreads.h:38
RDUNUSED_PARAM
#define RDUNUSED_PARAM(x)
Definition:
Invariant.h:194
RDGeneral
RDThreads.h
Generated on Mon Mar 26 2018 11:18:47 for RDKit by
1.8.13