Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:05:42

0001 #ifndef HeterogeneousCore_AlpakaInterface_interface_host_h
0002 #define HeterogeneousCore_AlpakaInterface_interface_host_h
0003 
0004 #include <cassert>
0005 
0006 namespace cms::alpakatools {
0007 
0008   namespace detail {
0009 
0010     inline alpaka::DevCpu enumerate_host() {
0011       using Platform = alpaka::PltfCpu;
0012       using Host = alpaka::DevCpu;
0013 
0014       assert(alpaka::getDevCount<Platform>() == 1);
0015       Host host = alpaka::getDevByIdx<Platform>(0);
0016       assert(alpaka::getNativeHandle(host) == 0);
0017 
0018       return host;
0019     }
0020 
0021   }  // namespace detail
0022 
0023   // returns the alpaka host device
0024   inline alpaka::DevCpu const& host() {
0025     static const auto host = detail::enumerate_host();
0026     return host;
0027   }
0028 
0029 }  // namespace cms::alpakatools
0030 
0031 #endif  // HeterogeneousCore_AlpakaInterface_interface_host_h