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 343 of file ROCmService.cc.

◆ ROCmService__t

Definition at line 343 of file ROCmService.cc.

◆ ROCmServiceMaker

Definition at line 342 of file ROCmService.cc.

Function Documentation

◆ decodeVersion()

std::string decodeVersion ( int  version)

Definition at line 81 of file ROCmService.cc.

References to_string(), and BeamSplash_cfg::version.

Referenced by ROCmService::ROCmService().

81  {
82  // decode 50631061 as 5.6.31061
83  return std::to_string(version / 10000000) + '.' + std::to_string(version / 100000 % 100) + '.' +
84  std::to_string(version % 100000);
85 }
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 55 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().

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