I've followed a number of guides to try and install Keras with a GPU on my new laptop. Some details:
- Windows 10 64bit
- Nvidia T1000 GPU
- R version 4.0.4
- I've followed this for software dependencies, including CUDA 11.2 and cuDNN 8.1.1. Based on the cuDNN site, this is the correct cuDNN for CUDA 11.2. I've also updated the drivers.
- I've copied the cuDNN files from bin, include, and lib to their respective folders in NVIDIA GPU Computing Toolkit.
- I've also added those folders and the cuDNN folder to my PATH environment variables.
Here are the files in my CUDA bin folder (I've tried installing CUDA 10, 10.1, and 11.2):
list.files("C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.2\\bin\\")
[1] "bin2c.exe" "compute-sanitizer.bat" "crt" "cu++filt.exe"
[5] "cublas64_10.dll" "cublas64_100.dll" "cublas64_11.dll" "cublasLt64_10.dll"
[9] "cublasLt64_11.dll" "cuda-memcheck.exe" "cudafe++.exe" "cudart32_110.dll"
[13] "cudart64_100.dll" "cudart64_101.dll" "cudart64_110.dll" "cudnn_adv_infer64_8.dll"
[17] "cudnn_adv_train64_8.dll" "cudnn_cnn_infer64_8.dll" "cudnn_cnn_train64_8.dll" "cudnn_ops_infer64_8.dll"
[21] "cudnn_ops_train64_8.dll" "cudnn64_8.dll" "cufft64_10.dll" "cufftw64_10.dll"
[25] "cuinj64_112.dll" "cuobjdump.exe" "curand64_10.dll" "cusolver64_10.dll"
[29] "cusolverMg64_11.dll" "cusparse64_10.dll" "cusparse64_11.dll" "fatbinary.exe"
[33] "nppc64_11.dll" "nppial64_11.dll" "nppicc64_11.dll" "nppidei64_11.dll"
[37] "nppif64_11.dll" "nppig64_11.dll" "nppim64_11.dll" "nppist64_11.dll"
[41] "nppisu64_11.dll" "nppitc64_11.dll" "npps64_11.dll" "nvblas64_11.dll"
[45] "nvcc.exe" "nvcc.profile" "nvdisasm.exe" "nvjpeg64_11.dll"
[49] "nvlink.exe" "nvprof.exe" "nvprune.exe" "nvrtc-builtins64_112.dll"
[53] "nvrtc-prev" "nvrtc64_112_0.dll" "nvvp.bat" "ptxas.exe"
I've tried guides here, here, and here.
I've successfully run:
tensorflow::install_tensorflow(gpu = TRUE)
reticulate::use_condaenv("r-tensorflow")
tf$constant("hello")
I then get the messages:
2021-03-08 20:54:50.917771: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-03-08 20:55:00.607511: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-03-08 20:55:02.286421: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: Quadro T1000 computeCapability: 7.5
coreClock: 1.53GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 178.84GiB/s
2021-03-08 20:55:02.286702: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-03-08 20:55:02.657731: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-03-08 20:55:03.052477: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-03-08 20:55:03.230033: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-03-08 20:55:03.526342: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-03-08 20:55:03.920362: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-03-08 20:55:03.930081: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-03-08 20:55:04.440275: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2021-03-08 20:55:04.440969: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-03-08 20:55:04.450175: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x211965ca050 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-03-08 20:55:04.450424: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2021-03-08 20:55:04.450851: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: Quadro T1000 computeCapability: 7.5
coreClock: 1.53GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 178.84GiB/s
2021-03-08 20:55:04.451300: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-03-08 20:55:04.451552: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-03-08 20:55:04.451803: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-03-08 20:55:04.451982: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-03-08 20:55:04.452149: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-03-08 20:55:04.452363: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-03-08 20:55:04.452502: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-03-08 20:55:04.452708: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2021-03-08 20:55:05.372995: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-03-08 20:55:05.373218: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0
2021-03-08 20:55:05.373358: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N
2021-03-08 20:55:05.373600: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2917 MB memory) -> physical GPU (device: 0, name: Quadro T1000, pci bus id: 0000:01:00.0, compute capability: 7.5)
2021-03-08 20:55:05.376339: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x211965dcad0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2021-03-08 20:55:05.376629: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Quadro T1000, Compute Capability 7.5
tf.Tensor(b'hello', shape=(), dtype=string)
However, if I then try
keras::install_keras(tensorflow = "gpu")
in a new RStudio session, I get
Error: invalid version specification
But I then tried running conda install -c anaconda keras-gpu
from the command line and that installed OK. If I run a test with Keras using the IMDB dataset, it seems like it's working OK nevertheless:
library(keras)
model <- keras_model_sequential() %>%
layer_dense(units = 16, activation = "relu", input_shape = c(10000)) %>%
layer_dense(units = 16, activation = "relu") %>%
layer_dense(units = 1, activation = "sigmoid")
returns:
2021-03-08 21:51:14.726620: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-03-08 21:51:16.456659: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: Quadro T1000 computeCapability: 7.5
coreClock: 1.53GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 178.84GiB/s
2021-03-08 21:51:16.456844: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-03-08 21:51:16.460816: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-03-08 21:51:16.465207: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-03-08 21:51:16.466657: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-03-08 21:51:16.470899: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-03-08 21:51:16.473512: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-03-08 21:51:16.482108: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-03-08 21:51:16.482375: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2021-03-08 21:51:16.484124: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-03-08 21:51:16.495226: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1edbf69c2d0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-03-08 21:51:16.495403: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2021-03-08 21:51:16.495774: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: Quadro T1000 computeCapability: 7.5
coreClock: 1.53GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 178.84GiB/s
2021-03-08 21:51:16.496029: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2021-03-08 21:51:16.496131: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2021-03-08 21:51:16.496247: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2021-03-08 21:51:16.496347: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2021-03-08 21:51:16.496438: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2021-03-08 21:51:16.496540: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2021-03-08 21:51:16.496703: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-03-08 21:51:16.496866: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2021-03-08 21:51:17.007480: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-03-08 21:51:17.007586: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0
2021-03-08 21:51:17.007676: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N
2021-03-08 21:51:17.007896: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2917 MB memory) -> physical GPU (device: 0, name: Quadro T1000, pci bus id: 0000:01:00.0, compute capability: 7.5)
2021-03-08 21:51:17.011318: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1edbf6afdd0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2021-03-08 21:51:17.011464: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Quadro T1000, Compute Capability 7.5
Any help is much appreciated