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  bool verbose_ = false;
37 };
38 
39 #endif
bool verbose_
Definition: CUDAService.h:36
int numberOfDevices() const
Definition: CUDAService.h:24
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: CUDAService.cc:395
int numberOfDevices_
Definition: CUDAService.h:33
std::pair< int, int > computeCapability(int device) const
Definition: CUDAService.h:27
bool enabled_
Definition: CUDAService.h:35
int deviceWithMostFreeMemory() const
Definition: CUDAService.cc:425
std::vector< std::pair< int, int > > computeCapabilities_
Definition: CUDAService.h:34
bool enabled() const
Definition: CUDAService.h:22
HLT enums.
CUDAService(edm::ParameterSet const &iConfig)
Constructor.
Definition: CUDAService.cc:134