1 #include <boost/core/demangle.hpp> 3 #include <alpaka/alpaka.hpp> 17 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 20 #endif // ALPAKA_ACC_GPU_CUDA_ENABLED 25 : enabled_(
config.getUntrackedParameter<
bool>(
"enabled")),
26 verbose_(
config.getUntrackedParameter<
bool>(
"verbose")) {
27 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 30 #endif // ALPAKA_ACC_GPU_CUDA_ENABLED 41 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 42 if (not cudaService->
enabled()) {
47 #endif // ALPAKA_ACC_GPU_CUDA_ENABLED 50 auto const&
devices = cms::alpakatools::devices<Platform>();
52 const std::string platform = boost::core::demangle(
typeid(Platform).
name());
53 edm::LogWarning(
"AlpakaService") <<
"Could not find any devices on platform " << platform <<
".\n" 54 <<
"Disabling " << ALPAKA_TYPE_ALIAS_NAME(
AlpakaService) <<
".";
60 const char*
suffix[] = {
"s.",
":",
"s:"};
63 out << ALPAKA_TYPE_ALIAS_NAME(
AlpakaService) <<
" succesfully initialised.\n";
64 out <<
"Found " <<
n <<
" device" <<
suffix[
n < 2 ?
n : 2];
65 for (
auto const& device :
devices) {
71 cms::alpakatools::getQueueCache<Queue>().
clear();
72 cms::alpakatools::getEventCache<Event>().
clear();
75 cms::alpakatools::getHostCachingAllocator<Queue>();
76 for (
auto const& device :
devices)
77 cms::alpakatools::getDeviceCachingAllocator<Device, Queue>(device);
82 cms::alpakatools::getHostCachingAllocator<Queue>().freeAllCached();
83 for (
auto const& device : cms::alpakatools::devices<Platform>())
84 cms::alpakatools::getDeviceCachingAllocator<Device, Queue>(device).freeAllCached();
87 cms::alpakatools::getQueueCache<Queue>().
clear();
88 cms::alpakatools::getEventCache<Event>().
clear();
93 desc.addUntracked<
bool>(
"enabled",
true);
94 desc.addUntracked<
bool>(
"verbose",
false);
AlpakaService(edm::ParameterSet const &config, edm::ActivityRegistry &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
TString getName(TString structure, int layer, TString geometry)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Log< level::Warning, false > LogWarning