jax不识别gpu gpu: RuntimeError: Unknown backend: ‘gpu‘ requested

jax 不识别gpu

以下内容在 x86 linux cudagpu 测试通过

错误信息

jax-0.4.25 jaxlib-0.4.25 不识别gpu: RuntimeError: Unknown backend: ‘gpu’ requested, but no platforms that are instances of gpu are present. Platforms present are: cpu

最终解决方案

根据cudnn版本和py版本去 https://storage.googleapis.com/jax-releases/jax_cuda_releases.html 查对于的jaxlib版本来进行安装。

倒腾过程

pip install --upgrade “jax[cuda]” 会装jax-0.2.22 jaxlib-0.4.25

jax-0.2.22:引入就报错。ImportError: cannot import name ‘pocketfft’ from ‘jaxlib’

pip uninstall jax jaxlib

https://pypi.org/project/jax/

pip install -U “jax[cuda12_pip]” -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

装完就是 jax-0.4.25 jaxlib-0.4.25+cuda12.cudnn89

jax.devices() 会爆下面的错误

CUDA backend failed to initialize: Found cuDNN version 8400, but JAX was built against version 8906, which is newer. The copy of cuDNN that is installed must be at least as new as the version against which JAX was built. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)

https://blog.csdn.net/Papageno_Xue/article/details/125754893

不存在 /usr/local/cuda-12.1/include/cudnn_version.h,/usr/local/cuda/include/cudnn_version.h 显示是840,和上面提示的错误信息一直

这里确定了cudaa 版本8400,然后我是py39

jaxlib version

https://storage.googleapis.com/jax-releases/jax_cuda_releases.html 里没有 0.4.25+84的,cudnn84以下有的82的,但是是cuda11,直接 pip install -U “jax[cuda11_pip]” -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html 的话装的是jaxlib==0.4.25+cuda11.cudnn86,根据 py39+cudaa82 查看得知最高 jaxlib0.4.7

pip install jax0.4.7 jaxlib0.4.7+cuda11.cudnn82 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

    >>> import jax
    >>> jax.devices()
    [StreamExecutorGpuDevice(id=0, process_index=0, slice_index=0), StreamExecutorGpuDevice(id=1, process_index=0, slice_index=0), StreamExecutorGpuDevice(id=2, process_index=0, slice_index=0), StreamExecutorGpuDevice(id=3, process_index=0, slice_index=0)]
  • 21
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值