diff --git a/HeterogeneousCore/CUDACore/interface/ESProduct.h b/HeterogeneousCore/CUDACore/interface/ESProduct.h index 485d694e5b522..7fc7c103d8c8b 100644 --- a/HeterogeneousCore/CUDACore/interface/ESProduct.h +++ b/HeterogeneousCore/CUDACore/interface/ESProduct.h @@ -7,9 +7,9 @@ #include #include "FWCore/Utilities/interface/thread_safety_macros.h" +#include "HeterogeneousCore/CUDAServices/interface/numberOfDevices.h" #include "HeterogeneousCore/CUDAUtilities/interface/EventCache.h" #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" -#include "HeterogeneousCore/CUDAUtilities/interface/deviceCount.h" #include "HeterogeneousCore/CUDAUtilities/interface/currentDevice.h" #include "HeterogeneousCore/CUDAUtilities/interface/eventWorkHasCompleted.h" @@ -18,7 +18,7 @@ namespace cms { template class ESProduct { public: - ESProduct() : gpuDataPerDevice_(deviceCount()) { + ESProduct() : gpuDataPerDevice_(numberOfDevices()) { for (size_t i = 0; i < gpuDataPerDevice_.size(); ++i) { gpuDataPerDevice_[i].m_event = getEventCache().get(); } diff --git a/HeterogeneousCore/CUDAServices/interface/numberOfCUDADevices.h b/HeterogeneousCore/CUDAServices/interface/numberOfCUDADevices.h deleted file mode 100644 index b563b98b516cf..0000000000000 --- a/HeterogeneousCore/CUDAServices/interface/numberOfCUDADevices.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef HeterogeneousCore_CUDAServices_numberOfCUDADevices_h -#define HeterogeneousCore_CUDAServices_numberOfCUDADevices_h - -// Returns the number of CUDA devices -// The difference wrt. the standard CUDA function is that if -// CUDAService is disabled, this function returns 0. -int numberOfCUDADevices(); - -#endif diff --git a/HeterogeneousCore/CUDAServices/interface/numberOfDevices.h b/HeterogeneousCore/CUDAServices/interface/numberOfDevices.h new file mode 100644 index 0000000000000..fb6f4ef310f7e --- /dev/null +++ b/HeterogeneousCore/CUDAServices/interface/numberOfDevices.h @@ -0,0 +1,14 @@ +#ifndef HeterogeneousCore_CUDAServices_numberOfDevices_h +#define HeterogeneousCore_CUDAServices_numberOfDevices_h + +namespace cms { + namespace cuda { + // Returns the number of CUDA devices + // The difference wrt. the standard CUDA function or + // cms::cuda::deviceCount() is that if CUDAService is disabled, + // this function returns 0. + int numberOfDevices(); + } // namespace cuda +} // namespace cms + +#endif diff --git a/HeterogeneousCore/CUDAServices/src/numberOfCUDADevices.cc b/HeterogeneousCore/CUDAServices/src/numberOfCUDADevices.cc deleted file mode 100644 index a0bbc503c3451..0000000000000 --- a/HeterogeneousCore/CUDAServices/src/numberOfCUDADevices.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "HeterogeneousCore/CUDAServices/interface/numberOfCUDADevices.h" -#include "HeterogeneousCore/CUDAServices/interface/CUDAService.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -int numberOfCUDADevices() { - edm::Service cs; - return cs->enabled() ? cs->numberOfDevices() : 0; -} diff --git a/HeterogeneousCore/CUDAServices/src/numberOfDevices.cc b/HeterogeneousCore/CUDAServices/src/numberOfDevices.cc new file mode 100644 index 0000000000000..4bc852f3a60c4 --- /dev/null +++ b/HeterogeneousCore/CUDAServices/src/numberOfDevices.cc @@ -0,0 +1,10 @@ +#include "HeterogeneousCore/CUDAServices/interface/numberOfDevices.h" +#include "HeterogeneousCore/CUDAServices/interface/CUDAService.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +namespace cms::cuda { + int numberOfDevices() { + edm::Service cs; + return cs->enabled() ? cs->numberOfDevices() : 0; + } +} // namespace cms::cuda