CMS 3D CMS Logo

host.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_AlpakaInterface_interface_host_h
2 #define HeterogeneousCore_AlpakaInterface_interface_host_h
3 
4 #include <cassert>
5 
6 namespace cms::alpakatools {
7 
8  namespace detail {
9 
10  inline alpaka::DevCpu enumerate_host() {
11  using Platform = alpaka::PltfCpu;
12  using Host = alpaka::DevCpu;
13 
14  assert(alpaka::getDevCount<Platform>() == 1);
15  Host host = alpaka::getDevByIdx<Platform>(0);
16  assert(alpaka::getNativeHandle(host) == 0);
17 
18  return host;
19  }
20 
21  } // namespace detail
22 
23  // returns the alpaka host device
24  inline alpaka::DevCpu const& host() {
25  static const auto host = detail::enumerate_host();
26  return host;
27  }
28 
29 } // namespace cms::alpakatools
30 
31 #endif // HeterogeneousCore_AlpakaInterface_interface_host_h
assert(be >=bs)
alpaka::DevCpu enumerate_host()
Definition: host.h:10
alpaka::DevCpu const & host()
Definition: host.h:24