安装pytorch后报错非法指令Illegal instruction (core dumped)

来源:互联网 发布:js调用支付宝扫一扫 编辑:程序博客网 时间:2024/06/03 17:36
  • 环境:
    unbuntu 14.04
    anaconda3
    cuda:7.5
    CPU:AMD

  • 安装方法:
    根据官网:
    conda install pytorch torchvision -c soumith

报错

import torchx=torch.Tensor(5,3)print(x)Illegal instruction (core dumped)

一般来说,SIGILL 错误在binary 包含CPU不支持的指令时出现,因为官网上的安装方式是 binary,也就是说官方的binary和我的CPU(AMD而不是 intel)不匹配,需要从source安装,方法如下:

  1. git clone 官方github地址

  2. sudo conda uninstall pytorch torchvision -c soumith (根据安装时的指令)

  3. sudo python3 setup.py install

官方对此错误的解释:

这里写图片描述

reference

  1. https://discuss.pytorch.org/t/help-core-dumped-problem/100
  2. https://github.com/pytorch/pytorch/issues/535