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 22 #ifdef ALPAKA_ACC_GPU_HIP_ENABLED 25 #endif // ALPAKA_ACC_GPU_HIP_ENABLED 30 : enabled_(
config.getUntrackedParameter<
bool>(
"enabled")),
31 verbose_(
config.getUntrackedParameter<
bool>(
"verbose")) {
32 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 35 #endif // ALPAKA_ACC_GPU_CUDA_ENABLED 36 #ifdef ALPAKA_ACC_GPU_HIP_ENABLED 39 #endif // ALPAKA_ACC_GPU_HIP_ENABLED 50 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 51 if (not cuda
or not cuda->enabled()) {
56 #endif // ALPAKA_ACC_GPU_CUDA_ENABLED 57 #ifdef ALPAKA_ACC_GPU_HIP_ENABLED 63 #endif // ALPAKA_ACC_GPU_HIP_ENABLED 66 auto const&
devices = cms::alpakatools::devices<Platform>();
68 const std::string platform = boost::core::demangle(
typeid(Platform).
name());
69 edm::LogWarning(
"AlpakaService") <<
"Could not find any devices on platform " << platform <<
".\n" 70 <<
"Disabling " << ALPAKA_TYPE_ALIAS_NAME(
AlpakaService) <<
".";
76 const char*
suffix[] = {
"s.",
":",
"s:"};
79 out << ALPAKA_TYPE_ALIAS_NAME(
AlpakaService) <<
" succesfully initialised.\n";
80 out <<
"Found " <<
n <<
" device" <<
suffix[
n < 2 ?
n : 2];
81 for (
auto const& device :
devices) {
87 cms::alpakatools::getQueueCache<Queue>().
clear();
88 cms::alpakatools::getEventCache<Event>().
clear();
91 cms::alpakatools::getHostCachingAllocator<Queue>();
92 for (
auto const& device :
devices)
93 cms::alpakatools::getDeviceCachingAllocator<Device, Queue>(device);
98 cms::alpakatools::getHostCachingAllocator<Queue>().freeAllCached();
99 for (
auto const& device : cms::alpakatools::devices<Platform>())
100 cms::alpakatools::getDeviceCachingAllocator<Device, Queue>(device).freeAllCached();
103 cms::alpakatools::getQueueCache<Queue>().
clear();
104 cms::alpakatools::getEventCache<Event>().
clear();
109 desc.addUntracked<
bool>(
"enabled",
true);
110 desc.addUntracked<
bool>(
"verbose",
false);
AlpakaService(edm::ParameterSet const &config, edm::ActivityRegistry &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Log< level::Info, false > LogInfo
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual bool enabled() const =0
std::string getName(const G4String &)
Log< level::Warning, false > LogWarning