RuntimeError: GET was unable to find an engine to execute this computation

文章讲述了在使用CUDA11.1和虚拟环境中安装的PyTorch2.0.0时遇到的ImportError和RuntimeError问题,涉及文件缺失、重新安装、设备选择以及CUDNN的配置,最终解决了计算引擎找不到的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CUDA版本是11.1,虚拟环境中安装的torch是2.0.0,首先调用torch出现问题ImportError: libcupti.so.11.7:cannot open shared object file: No such file or directory该问题的解决办法如下:

  • 检查是否存在该文件

    locate libcupti.so.11.7
    

    在这里插入图片描述

  • 在该虚拟环境中重新安装torch,还是没生成nvidia这个文件。

  • 从其他的文件中将文件拷贝到虚拟环境的对应包下。
    在这里插入图片描述

解决上述问题后又出现问题RuntimeError: GET was unable to find an engine to execute this computation该问题解决方法:

  • 检测torch和cuda是否能用

    import torch
    print(torch.__version__)
    print(torch.cuda.is_available())
    

    在这里插入图片描述

  • 测试

    import torch
    
    print(torch.cuda.is_available())
    num_gpu =1 
    # Decide which device to run on
    device = torch.device("cuda:0" if (torch.cuda.is_available() and num_gpu > 0) else "cpu")
    print(device)
    print(torch.cuda.get_device_name(0))
    print(torch.rand(3,3).cuda())
    

    在这里插入图片描述

  • 检查cudnn是否可用

    print(torch.backends.cudnn.version())
    

    在这里插入图片描述

  • 官网下载cuda
    CUDA官网下载
    在这里插入图片描述

  • cuda安装
    在这里插入图片描述

  • 下载解压cudnn
    Local Installers for Windows and Linux, Ubuntu(x86_64, armsbsa)
    在这里插入图片描述
    在这里插入图片描述

  • 安装cudnn
    在这里插入图片描述

  • 设置环境

     export PATH=/opt/xxx/soft/cuda-11.7/bin:$PATH
     export LD_LIBRARY_PATH=LD_LIBRARY_PATH:/opt/xxx/soft/cuda-11.7/lib64
     export CUDA_HOME=/opt/xxx/soft/cuda-11.7
    
    
  • 运行代码,问题解决

参考资料
RuntimeError: GET was unable to find an engine to execute this computation

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值