src
HeterogeneousCore
ROCmUtilities
interface
hipCheck.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_ROCmUtilities_hipCheck_h
2
#define HeterogeneousCore_ROCmUtilities_hipCheck_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 <hip/hip_runtime.h>
13
14
// CMSSW headers
15
#include "
FWCore/Utilities/interface/Likely.h
"
16
17
namespace
cms
{
18
namespace
rocm {
19
20
[[noreturn]]
inline
void
abortOnError
(
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
<<
"hipCheck("
<<
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
hipCheck_
(
const
char
*
file
,
37
int
line
,
38
const
char
*
cmd
,
39
hipError_t
result
,
40
std::string_view
description
= std::string_view()) {
41
if
(
LIKELY
(
result
== hipSuccess))
42
return
true
;
43
44
const
char
*
error
= hipGetErrorName(
result
);
45
const
char
* message = hipGetErrorString(
result
);
46
abortOnError
(
file
,
line
,
cmd
,
error
, message,
description
);
47
return
false
;
48
}
49
}
// namespace rocm
50
}
// namespace cms
51
52
#define hipCheck(ARG, ...) (cms::rocm::hipCheck_(__FILE__, __LINE__, #ARG, (ARG), ##__VA_ARGS__))
53
54
#endif // HeterogeneousCore_ROCmUtilities_hipCheck_h
relativeConstraints.error
error
Definition:
relativeConstraints.py:53
mps_fire.result
result
Definition:
mps_fire.py:311
cms::rocm::abortOnError
void abortOnError(const char *file, int line, const char *cmd, const char *error, const char *message, std::string_view description=std::string_view())
Definition:
hipCheck.h:20
LIKELY
#define LIKELY(x)
Definition:
Likely.h:20
cms::rocm::hipCheck_
bool hipCheck_(const char *file, int line, const char *cmd, hipError_t result, std::string_view description=std::string_view())
Definition:
hipCheck.h:36
mps_splice.line
line
Definition:
mps_splice.py:76
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:41
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
Likely.h
makeListRunsInFiles.description
description
Definition:
makeListRunsInFiles.py:15
Generated for CMSSW Reference Manual by
1.8.14