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
20
namespace
RDKit
{
21
inline
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();
26
if
(
res
>
rdcast<unsigned int>
(-
target
)) {
27
return
res
+
target
;
28
}
else
{
29
return
1;
30
}
31
}
32
}
// namespace RDKit
33
34
#else
35
36
namespace
RDKit
{
37
inline
unsigned
int
getNumThreadsToUse
(
int
target
) {
38
RDUNUSED_PARAM
(
target
);
39
return
1;
40
}
41
}
// namespace RDKit
42
#endif
43
44
#endif
Invariant.h
RDUNUSED_PARAM
#define RDUNUSED_PARAM(x)
Definition
Invariant.h:196
export.h
RDKit
Std stuff.
Definition
Abbreviations.h:19
RDKit::rdvalue_is
bool rdvalue_is(const RDValue_cast_t)
Definition
RDValue-doublemagic.h:372
RDKit::getNumThreadsToUse
unsigned int getNumThreadsToUse(int target)
Definition
RDThreads.h:37
RDGeneral
RDThreads.h
Generated on Mon Sep 30 2024 05:19:34 for RDKit by
1.9.8