我照做了:sudo apt install nvidia-cuda-toolkit
系统安装了 CUDA 9.1。重要上下文:运行后nvidia-smi
输出以下结果:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
在 tf 中运行测试包将得到以下输出:
>>> tf.test.is_built_with_cuda()
True
>>> tf.test.is_built_with_gpu_support()
True
>>> tf.test.is_gpu_available(cuda_only=False,min_cuda_compute_capability=None)
2020-06-04 13:55:32.347286: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-06-04 13:55:32.666622: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2899885000 Hz
2020-06-04 13:55:32.669156: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5558285d1550 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-04 13:55:32.669288: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-06-04 13:55:32.782122: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-06-04 13:55:33.318362: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2020-06-04 13:55:33.318551: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (lenovo-ritik): /proc/driver/nvidia/version does not exist
False
那么我该如何解决这个问题?如何让 CUDA 运行,并让系统读取我的 GPU?