From a710f8b8477a0000a67878179a76c6fc6c772bd1 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Mon, 24 Mar 2025 01:03:58 +0100 Subject: [PATCH] The AlpakaServiceSerialSync should always be available The AlpakaServiceSerialSync should always be available, even if the "cpu" accelerator is not listed in process.options.accelerators. --- .../AlpakaCore/python/ProcessAcceleratorAlpaka.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/HeterogeneousCore/AlpakaCore/python/ProcessAcceleratorAlpaka.py b/HeterogeneousCore/AlpakaCore/python/ProcessAcceleratorAlpaka.py index 910f7ecd58ce8..cadb4ccf6e8fb 100644 --- a/HeterogeneousCore/AlpakaCore/python/ProcessAcceleratorAlpaka.py +++ b/HeterogeneousCore/AlpakaCore/python/ProcessAcceleratorAlpaka.py @@ -83,19 +83,10 @@ def apply(self, process, accelerators): if not hasattr(process.MessageLogger, "AlpakaService"): process.MessageLogger.AlpakaService = cms.untracked.PSet() - # Check if the CPU backend is available - try: - if not "cpu" in accelerators: - raise False + # The CPU backend is effectively always available, ensure the AlpakaServiceSerialSync is loaded + if not hasattr(process, "AlpakaServiceSerialSync"): from HeterogeneousCore.AlpakaServices.AlpakaServiceSerialSync_cfi import AlpakaServiceSerialSync - except: - # the CPU backend is not available, do not load the AlpakaServiceSerialSync - if hasattr(process, "AlpakaServiceSerialSync"): - del process.AlpakaServiceSerialSync - else: - # the CPU backend is available, ensure the AlpakaServiceSerialSync is loaded - if not hasattr(process, "AlpakaServiceSerialSync"): - process.add_(AlpakaServiceSerialSync) + process.add_(AlpakaServiceSerialSync) # Check if CUDA is available, and if the system has at least one usable NVIDIA GPU try: