CMS 3D CMS Logo

Classes | Functions | Variables
ALPAKA_ACCELERATOR_NAMESPACE::detail Namespace Reference

Classes

struct  DeviceProductType
 
class  EDMetadataAcquireSentry
 
class  EDMetadataSentry
 
struct  ESDeviceProductType
 
class  ESDeviceProductWithStorage
 

Functions

Device const & chooseDevice (edm::StreamID id)
 

Variables

template<typename TProduct >
constexpr bool useESProductDirectly = std::is_same_v<typename ESDeviceProductType<TProduct>::type, TProduct>
 
template<typename TProduct >
constexpr bool useProductDirectly = std::is_same_v<typename DeviceProductType<TProduct>::type, TProduct>
 

Function Documentation

◆ chooseDevice()

Device const & ALPAKA_ACCELERATOR_NAMESPACE::detail::chooseDevice ( edm::StreamID  id)

Definition at line 9 of file chooseDevice.cc.

References cms::Exception::addContext(), cms::alpakatools::devices(), EDM_STRINGIZE, and ALPAKA_ACCELERATOR_NAMESPACE::AlpakaService::enabled().

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::detail::EDMetadataSentry::EDMetadataSentry().

9  {
10  // The idea of checking the AlpakaService status here is that
11  // regardless of process.options.accelerators setting the
12  // configuration may contain an EDModule for a specific Alpaka
13  // backend. Checking the AlpakaService status here ensures that an
14  // explanatory error messages even in that case. The information
15  // on the intended accelerators is (eventually) communicated from
16  // process.options.accelerators to AlpakaServices via
17  // ProcessAcceleratorAlpaka.
19  if (not alpakaService->enabled()) {
20  cms::Exception ex("AlpakaError");
21  ex << "Unable to choose current device because AlpakaService is disabled. If AlpakaService was not explicitly\n"
22  "disabled in the configuration, the probable cause is that there is no GPU or there is some problem\n"
23  "in the platform runtime or drivers.";
24  ex.addContext("Calling " EDM_STRINGIZE(ALPAKA_ACCELERATOR_NAMESPACE) "::detail::chooseDevice()");
25  throw ex;
26  };
27 
28  // For startes we "statically" assign the device based on
29  // edm::Stream number. This is suboptimal if the number of
30  // edm::Streams is not a multiple of the number of devices
31  // (and even then there is no load balancing).
32 
33  // TODO: improve the "assignment" logic
34  auto const& devices = cms::alpakatools::devices<Platform>();
35  return devices[id % devices.size()];
36  }
#define EDM_STRINGIZE(token)
Definition: stringize.h:6
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:22

Variable Documentation

◆ useESProductDirectly

template<typename TProduct >
constexpr bool ALPAKA_ACCELERATOR_NAMESPACE::detail::useESProductDirectly = std::is_same_v<typename ESDeviceProductType<TProduct>::type, TProduct>
inline

Definition at line 24 of file ESDeviceProductType.h.

◆ useProductDirectly

template<typename TProduct >
constexpr bool ALPAKA_ACCELERATOR_NAMESPACE::detail::useProductDirectly = std::is_same_v<typename DeviceProductType<TProduct>::type, TProduct>
inline

Definition at line 24 of file DeviceProductType.h.