Skip to content
Snippets Groups Projects
Commit 078d8ead authored by Cyril Moineau's avatar Cyril Moineau Committed by Cyril Moineau
Browse files

Add showCudaVersion method.

parent aaa6137e
No related branches found
No related tags found
1 merge request!200.2.1
#ifndef AIDGE_UTILS_SYS_INFO_CUDA_VERSION_INFO_H
#define AIDGE_UTILS_SYS_INFO_CUDA_VERSION_INFO_H
#include "aidge/backend/cuda/utils/CudaUtils.hpp" // CHECK_CUDA_STATUS
#include "aidge/utils/Log.hpp"
namespace Aidge {
void showCudaVersion() {
Log::info("CuDNN version: {}.{}.{}\n", CUDNN_MAJOR, CUDNN_MINOR,
CUDNN_PATCHLEVEL);
int deviceCount = 0;
CHECK_CUDA_STATUS(cudaGetDeviceCount(&deviceCount));
if (deviceCount == 0) {
Log::warn("There are no available device(s) that support CUDA");
} else {
Log::info("Detected {} CUDA Capable device(s)", deviceCount);
}
for (int dev = 0; dev < deviceCount; ++dev) {
cudaSetDevice(dev);
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);
Log::info("\nDevice #{}: \"{}\"", dev, deviceProp.name);
int driverVersion = 0;
int runtimeVersion = 0;
cudaDriverGetVersion(&driverVersion);
cudaRuntimeGetVersion(&runtimeVersion);
Log::info(
"\tCUDA Driver Version / Runtime Version: {}.{} / {}.{}",
(driverVersion / 1000), ((driverVersion % 100) / 10),
(runtimeVersion / 1000), ((runtimeVersion % 100) / 10));
Log::info("\tCUDA Capability Major/Minor version number: {}.{}",
deviceProp.major, deviceProp.minor);
}
}
} // namespace Aidge
#endif // AIDGE_UTILS_SYS_INFO_CUDA_VERSION_INFO_H
...@@ -6,8 +6,10 @@ namespace py = pybind11; ...@@ -6,8 +6,10 @@ namespace py = pybind11;
namespace Aidge { namespace Aidge {
void init_Aidge(py::module& /*m*/){ void init_cuda_sys_info(py::module& m);
void init_Aidge(py::module& m){
init_cuda_sys_info(m);
} }
PYBIND11_MODULE(aidge_backend_cuda, m) { PYBIND11_MODULE(aidge_backend_cuda, m) {
......
#include <pybind11/pybind11.h>
#include "aidge/utils/sys_info/CudaVersionInfo.hpp"
namespace py = pybind11;
namespace Aidge {
void init_cuda_sys_info(py::module& m){
m.def("show_cuda_version", &showCudaVersion);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment