CMS 3D CMS Logo

CUDAService.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_CUDAServices_CUDAService_h
2 #define HeterogeneousCore_CUDAServices_CUDAService_h
3 
4 #include <utility>
5 #include <vector>
6 
8 
9 namespace edm {
10  class ParameterSet;
11  class ActivityRegistry;
13 } // namespace edm
14 
15 class CUDAService {
16 public:
17  CUDAService(edm::ParameterSet const& iConfig);
18  ~CUDAService();
19 
20  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
21 
22  bool enabled() const { return enabled_; }
23 
24  int numberOfDevices() const { return numberOfDevices_; }
25 
26  // major, minor
27  std::pair<int, int> computeCapability(int device) const { return computeCapabilities_.at(device); }
28 
29  // Returns the id of device with most free memory. If none is found, returns -1.
30  int deviceWithMostFreeMemory() const;
31 
32 private:
34  std::vector<std::pair<int, int>> computeCapabilities_;
35  bool enabled_ = false;
36 };
37 
38 #endif
ActivityRegistry
edm
HLT enums.
Definition: AlignableModifier.h:19
CUDAService::numberOfDevices
int numberOfDevices() const
Definition: CUDAService.h:24
CUDAService::enabled_
bool enabled_
Definition: CUDAService.h:35
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:36
CUDAService::computeCapability
std::pair< int, int > computeCapability(int device) const
Definition: CUDAService.h:27
ParameterSet
Definition: Functions.h:16
CUDAService::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: CUDAService.cc:339
CUDAService::numberOfDevices_
int numberOfDevices_
Definition: CUDAService.h:33
CUDAService::deviceWithMostFreeMemory
int deviceWithMostFreeMemory() const
Definition: CUDAService.cc:368
CUDAService::enabled
bool enabled() const
Definition: CUDAService.h:22
CUDAService::CUDAService
CUDAService(edm::ParameterSet const &iConfig)
Constructor.
Definition: CUDAService.cc:122
ConfigurationDescriptions
CUDAService::~CUDAService
~CUDAService()
Definition: CUDAService.cc:318
CUDAService::computeCapabilities_
std::vector< std::pair< int, int > > computeCapabilities_
Definition: CUDAService.h:34
CUDAService
Definition: CUDAService.h:15
StreamID.h