OP_REQUIRES failed at xla_ops.cc:301 : Internal: libdevice not found at ./libdevice.10.bc

题目限制100字,一个较为完整的报错信息应该是

W tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:73] Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice. This may result in compilation or runtime failures, if the program we try to run uses routines from libdevice.
W tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:74] Searched for CUDA in the following directories:
W tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:77]   ./cuda_sdk_lib
W tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:77]   C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2
W tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:77]   .
W tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:79] You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule's DebugOptions.  For most apps, setting the environment variable XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda will work.
W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:328] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
W tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at xla_ops.cc:301 : Internal: libdevice not found at ./libdevice.10.bc

这个问题出现的原因有两个:
1、没有安装cudatoolkit、cuDNN这些;
2、在安装的时候更改路径,没有安装到默认的C:/Program Files/NVIDIA GPU Computing路径下。
针对第一个原因,没什么好说的,安装好即可;
针对第二个原因,则需要配置环境变量。

这里注意到报错中核心的一句

You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule's DebugOptions.  For most apps, setting the environment variable XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda will work.

因此,在电脑系统中添加环境变量即可,环境变量名为

XLA_FLAGS

变量值为(具体路径当然需要根据实际情况进行修改(一句唠叨话))

--xla_gpu_cuda_data_dir='E:\CUDA\NVIDIA GPU Computing Toolkit\CUDA\v11.2'

注意两点:
1、此处的–xla_gpu_cuda_data_dir不可省,等号右边的单引号也不可省略
2、在满足第一点的基础上,在电脑系统中配置环境变量,或是通过pycharm的设置等配置环境变量都可

补充:
在stackoverflow论坛中找到的关于该问题的单双引号的表述
这是stackoverflow论坛中关于该问题的单双引号的表述

参考网址:

  1. 标题:设置python环境变量的三种方法(pycharm)
    网址:https://www.iotword.com/5087.html
  2. 标题:TensorFlow libdevice not found. Why is it not found in the searched path?
    网址:https://stackoverflow.com/questions/68614547/tensorflow-libdevice-not-found-why-is-it-not-found-in-the-searched-path
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值