src
HeterogeneousCore
ROCmUtilities
interface
rsmiCheck.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_ROCmUtilities_rsmiCheck_h
2
#define HeterogeneousCore_ROCmUtilities_rsmiCheck_h
3
4
// C++ standard headers
5
#include <iostream>
6
#include <sstream>
7
#include <stdexcept>
8
#include <string>
9
#include <string_view>
10
11
// ROCm headers
12
#include <rocm_smi/rocm_smi.h>
13
14
// CMSSW headers
15
#include "
FWCore/Utilities/interface/Likely.h
"
16
17
namespace
cms
{
18
namespace
rocm
{
19
20
[[noreturn]]
inline
void
abortOnRsmiError
(
const
char
*
file
,
21
int
line
,
22
const
char
*
cmd
,
23
const
char
*
error
,
24
const
char
* message,
25
std::string_view
description
= std::string_view()) {
26
std::ostringstream
out
;
27
out
<<
"\n"
;
28
out
<<
file
<<
", line "
<<
line
<<
":\n"
;
29
out
<<
"rsmiCheck("
<<
cmd
<<
");\n"
;
30
out
<<
error
<<
": "
<< message <<
"\n"
;
31
if
(!
description
.empty())
32
out
<<
description
<<
"\n"
;
33
throw
std::runtime_error(
out
.str());
34
}
35
36
inline
bool
rsmiCheck_
(
const
char
*
file
,
37
int
line
,
38
const
char
*
cmd
,
39
rsmi_status_t
result
,
40
std::string_view
description
= std::string_view()) {
41
if
(
LIKELY
(
result
== RSMI_STATUS_SUCCESS))
42
return
true
;
43
44
std::string
error
=
"ROCm SMI Error "
+
std::to_string
(
result
);
45
const
char
* message;
46
rsmi_status_string(
result
, &message);
47
abortOnRsmiError
(
file
,
line
,
cmd
,
error
.c_str(), message,
description
);
48
return
false
;
49
}
50
}
// namespace rocm
51
}
// namespace cms
52
53
#define rsmiCheck(ARG, ...) (cms::rocm::rsmiCheck_(__FILE__, __LINE__, #ARG, (ARG), ##__VA_ARGS__))
54
55
#endif // HeterogeneousCore_ROCmUtilities_rsmiCheck_h
tensorflow::Backend::rocm
relativeConstraints.error
error
Definition:
relativeConstraints.py:53
mps_fire.result
result
Definition:
mps_fire.py:311
LIKELY
#define LIKELY(x)
Definition:
Likely.h:20
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
to_string
static std::string to_string(const XMLCh *ch)
Definition:
TotemDAQMappingESSourceXML.cc:353
mps_splice.line
line
Definition:
mps_splice.py:76
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:41
cms::rocm::abortOnRsmiError
void abortOnRsmiError(const char *file, int line, const char *cmd, const char *error, const char *message, std::string_view description=std::string_view())
Definition:
rsmiCheck.h:20
geometryDiff.file
file
Definition:
geometryDiff.py:13
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
mps_setup.cmd
list cmd
Definition:
mps_setup.py:244
cms::rocm::rsmiCheck_
bool rsmiCheck_(const char *file, int line, const char *cmd, rsmi_status_t result, std::string_view description=std::string_view())
Definition:
rsmiCheck.h:36
Likely.h
makeListRunsInFiles.description
description
Definition:
makeListRunsInFiles.py:15
Generated for CMSSW Reference Manual by
1.8.14