src
HeterogeneousCore
ROCmUtilities
src
requireDevices.cc
Go to the documentation of this file.
1
#include <cstdlib>
2
#include <iostream>
3
4
#include <hip/hip_runtime.h>
5
6
#include "
HeterogeneousCore/ROCmUtilities/interface/requireDevices.h
"
7
8
namespace
cms::rocmtest
{
9
10
bool
testDevices
() {
11
int
devices
= 0;
12
auto
status
= hipGetDeviceCount(&
devices
);
13
if
(
status
!= hipSuccess) {
14
std::cerr
<<
"Failed to initialise the ROCm runtime, the test will be skipped.\n"
;
15
return
false
;
16
}
17
if
(
devices
== 0) {
18
std::cerr
<<
"No ROCm devices available, the test will be skipped.\n"
;
19
return
false
;
20
}
21
return
true
;
22
}
23
24
void
requireDevices
() {
25
if
(not
testDevices
()) {
26
exit
(EXIT_SUCCESS);
27
}
28
}
29
30
}
// namespace cms::rocmtest
mps_update.status
status
Definition:
mps_update.py:68
cms::rocmtest::requireDevices
void requireDevices()
Print message and exit if there are no ROCm devices.
Definition:
requireDevices.cc:24
cms::rocmtest
Definition:
requireDevices.h:8
DMR_cfg.cerr
cerr
Definition:
DMR_cfg.py:78
requireDevices.h
cms::alpakatools::devices
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition:
devices.h:22
cms::rocmtest::testDevices
bool testDevices()
In presence of ROCm devices, return true; otherwise print message and return false.
Definition:
requireDevices.cc:10
beamvalidation.exit
def exit(msg="")
Definition:
beamvalidation.py:52
Generated for CMSSW Reference Manual by
1.8.14