src
HeterogeneousCore
AlpakaInterface
interface
alpakastdAlgorithm.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_AlpakaInterface_interface_alpakastdAlgorithm_h
2
#define HeterogeneousCore_AlpakaInterface_interface_alpakastdAlgorithm_h
3
4
#include <algorithm>
5
#include <functional>
6
#include <utility>
7
8
#include <alpaka/alpaka.hpp>
9
10
// reimplementation of std algorithms able to compile with Alpaka,
11
// mostly by declaring them constexpr (until C++20, which will make it
12
// constexpr by default. TODO: drop when moving to C++20)
13
14
namespace
alpaka_std
{
15
16
template
<
typename
RandomIt,
typename
T,
typename
Compare = std::less<T>>
17
ALPAKA_FN_HOST_ACC
constexpr
RandomIt
upper_bound
(RandomIt
first
, RandomIt
last
,
const
T
&
value
, Compare
comp
= {}) {
18
auto
count
=
last
-
first
;
19
20
while
(
count
> 0) {
21
auto
it
=
first
;
22
auto
step
=
count
/ 2;
23
it
+=
step
;
24
if
(!
comp
(
value
, *
it
)) {
25
first
= ++
it
;
26
count
-=
step
+ 1;
27
}
else
{
28
count
=
step
;
29
}
30
}
31
return
first
;
32
}
33
34
}
// namespace alpaka_std
35
36
#endif // HeterogeneousCore_AlpakaInterface_interface_alpakastdAlgorithm_h
alpaka_std::upper_bound
ALPAKA_FN_HOST_ACC constexpr RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition:
alpakastdAlgorithm.h:17
alpaka_std
Definition:
alpakastdAlgorithm.h:14
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:249
ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr
if constexpr(n > 3)
Definition:
BrokenLine.h:164
value
Definition:
value.py:1
submitPVResolutionJobs.count
count
Definition:
submitPVResolutionJobs.py:359
dqmdumpme.last
last
Definition:
dqmdumpme.py:56
dqmdumpme.first
first
Definition:
dqmdumpme.py:55
ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it
auto & it
Definition:
splitVertices.h:48
step
step
Definition:
StallMonitor.cc:83
T
long double T
Definition:
Basic3DVectorLD.h:48
Generated for CMSSW Reference Manual by
1.8.14