CMS 3D CMS Logo

Classes | Namespaces | Typedefs | Functions
ROCmService.cc File Reference
#include <iomanip>
#include <iostream>
#include <limits>
#include <set>
#include <string>
#include <vector>
#include <hip/hip_runtime.h>
#include <rocm_version.h>
#include <rocm_smi/rocm_smi.h>
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/ResourceInformation.h"
#include "HeterogeneousCore/ROCmServices/interface/ROCmInterface.h"
#include "HeterogeneousCore/ROCmUtilities/interface/hipCheck.h"
#include "HeterogeneousCore/ROCmUtilities/interface/rsmiCheck.h"
#include "FWCore/ServiceRegistry/interface/ServiceMaker.h"

Go to the source code of this file.

Classes

class  ROCmService
 

Namespaces

 edm
 HLT enums.
 
 edm::service
 

Typedefs

typedef ROCmServiceMaker ::concrete_t ROCmService___t
 
typedef edm::serviceregistry::ServiceMaker< ROCmServiceMaker ::interface_t, ROCmServiceMakerROCmService__t
 
using ROCmServiceMaker = edm::serviceregistry::ParameterSetMaker< ROCmInterface, ROCmService >
 

Functions

std::string decodeVersion (int version)
 
bool edm::service::isProcessWideService (ROCmService const *)
 
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker< edm::DescriptionFillerForServices< ROCmService___t > > s_filler__LINE__ ("ROCmService")
 
static const edm::serviceregistry::ServicePluginFactory ::PMaker< ROCmService__ts_maker__LINE__ ("ROCmService")
 
void setHipLimit (hipLimit_t limit, const char *name, size_t request)
 

Typedef Documentation

◆ ROCmService___t

typedef ROCmServiceMaker ::concrete_t ROCmService___t

Definition at line 338 of file ROCmService.cc.

◆ ROCmService__t

Definition at line 338 of file ROCmService.cc.

◆ ROCmServiceMaker

Definition at line 337 of file ROCmService.cc.

Function Documentation

◆ decodeVersion()

std::string decodeVersion ( int  version)

Definition at line 76 of file ROCmService.cc.

References to_string(), and BeamSplash_cfg::version.

Referenced by ROCmService::ROCmService().

76  {
77  // decode 50631061 as 5.6.31061
78  return std::to_string(version / 10000000) + '.' + std::to_string(version / 100000 % 100) + '.' +
79  std::to_string(version % 100000);
80 }
static std::string to_string(const XMLCh *ch)

◆ s_filler__LINE__()

static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::DescriptionFillerForServices< ROCmService___t > > s_filler__LINE__ ( "ROCmService"  )
static

◆ s_maker__LINE__()

static const edm::serviceregistry::ServicePluginFactory ::PMaker< ROCmService__t > s_maker__LINE__ ( "ROCmService"  )
static

◆ setHipLimit()

void setHipLimit ( hipLimit_t  limit,
const char *  name,
size_t  request 
)

Definition at line 50 of file ROCmService.cc.

References hipCheck, remoteMonitoring_LASER_era2018_cfg::limit, Skims_PA_cff::name, mps_fire::result, and relativeConstraints::value.

Referenced by ROCmService::ROCmService().

50  {
51 #if HIP_VERSION >= 50400000
52  // read the current device
53  int device;
54  hipCheck(hipGetDevice(&device));
55  // try to set the requested limit
56  auto result = hipDeviceSetLimit(limit, request);
57  if (hipErrorUnsupportedLimit == result) {
58  edm::LogWarning("ROCmService") << "ROCm device " << device << ": unsupported limit \"" << name << "\"";
59  return;
60  }
61  // read back the limit value
62  size_t value;
63  result = hipDeviceGetLimit(&value, limit);
64  if (hipSuccess != result) {
65  edm::LogWarning("ROCmService") << "ROCm device " << device << ": failed to set limit \"" << name << "\" to "
66  << request << ", current value is " << value;
67  } else if (value != request) {
68  edm::LogWarning("ROCmService") << "ROCm device " << device << ": limit \"" << name << "\" set to " << value
69  << " instead of requested " << request;
70  }
71 #else
72  edm::LogWarning("ROCmService") << "ROCm versions below 5.4.0 do not support setting device limits.";
73 #endif
74 }
Definition: value.py:1
#define hipCheck(ARG,...)
Definition: hipCheck.h:52
Log< level::Warning, false > LogWarning