/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
HeterogeneousCore/ROCmUtilities/bin/rocmIsEnabled.cpp
31 строка
825 B
Andrea Bocci
Use different exit codes for different conditions
23 фев 2023, 18:33
Не верифицирован
23 фев 2023, 18:33
a2fe732
Код
Авторство
О чём код?
// C/C++ headers #include <cstdlib> // ROCm headers #include <hip/hip_runtime.h> // CMSSW headers #include "HeterogeneousCore/Common/interface/PlatformStatus.h" // local headers #include "isRocmDeviceSupported.h" // returns PlatformStatus::Success if at least one visible ROCm device can be used, // or different failure codes depending on the problem. int main() { int devices = 0; auto status = hipGetDeviceCount(&devices); if (status != hipSuccess) { // could not initialise the ROCm runtime return PlatformStatus::RuntimeNotAvailable; } // check that at least one visible ROCm device can be used for (int i = 0; i < devices; ++i) { if (isRocmDeviceSupported(i)) return PlatformStatus::Success; } // no usable ROCm devices were found return PlatformStatus::DevicesNotAvailable; }