首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在R-无效版本规范中安装Keras GPU时出错

在R-无效版本规范中安装Keras GPU时出错
EN

Stack Overflow用户
提问于 2021-03-09 02:39:35
回答 1查看 904关注 0票数 0

我遵循了许多指南,尝试在我的新笔记本上安装带有GPU的Keras。一些细节:

  • Windows 10 64位
  • Nvidia T1000 GPU
  • R版本4.0.4
  • 我跟踪了的软件依赖关系,包括CUDA11.2和cuDNN 8.1.1。基于cuDNN站点,这是数据自动化系统11.2的正确cuDNN。我还更新了司机的信息。
  • 我在NVIDIA计算工具包中将cuDNN文件从bin、include和lib复制到各自的文件夹中。
  • 我还将这些文件夹和cuDNN文件夹添加到PATH环境变量中。

以下是我的CUDA bin文件夹中的文件(我尝试过安装CUDA 10、10.1和11.2):

代码语言:javascript
复制
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"    

我试过引导这里这里这里

我成功地跑了:

代码语言:javascript
复制
tensorflow::install_tensorflow(gpu = TRUE)
reticulate::use_condaenv("r-tensorflow")
tf$constant("hello")

然后我收到消息:

代码语言:javascript
复制
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)

但是,如果我试着

代码语言:javascript
复制
keras::install_keras(tensorflow = "gpu")

在新的RStudio会话中,我得到

代码语言:javascript
复制
Error: invalid version specification

但随后我尝试从命令行运行conda install -c anaconda keras-gpu,并安装了OK。如果我使用IMDB数据集在Keras上运行测试,那么它似乎运行得很好:

代码语言:javascript
复制
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")

返回:

代码语言:javascript
复制
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

任何帮助都非常感谢:upside_down_face:

EN

回答 1

Stack Overflow用户

发布于 2021-04-26 20:29:10

我认为问题在最新的R方案中。我通过使用

代码语言:javascript
复制
require(devtools)
install_version("keras", version = "2.3.0.0")

然后就可以正确安装keras了。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66540020

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档