/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
HeterogeneousCore/CUDAUtilities/src/requireDevices.cc
30 строк
718 B
Andrea Bocci
Import CUDA interaction layer from Patatrack, part 1
18 янв 2020, 01:00
18 янв 2020, 01:00
f143441
Код
Авторство
О чём код?
#include <cstdlib> #include <iostream> #include <cuda_runtime.h> #include "HeterogeneousCore/CUDAUtilities/interface/requireDevices.h" namespace cms::cudatest { bool testDevices() { int devices = 0; auto status = cudaGetDeviceCount(&devices); if (status != cudaSuccess) { std::cerr << "Failed to initialise the CUDA runtime, the test will be skipped." << "\n"; return false; } if (devices == 0) { std::cerr << "No CUDA devices available, the test will be skipped." << "\n"; return false; } return true; } void requireDevices() { if (not testDevices()) { exit(EXIT_SUCCESS); } } } // namespace cms::cudatest