MindSpore源码安装编译报错大合集(GPU)

编译报错大合集

Required package gmp not found, please install gmp and try building

# 安装GCC
sudo apt-get install gcc-7 git automake autoconf libtool libgmp-dev tcl patch libnuma-dev flex -y

  • The C compiler identification is unknown. 未配置环境变量。GCC版本不对。可能gcc、g++的路径和cmake中使用的gcc、g++路径不一致
apt-get install build-essential

gcc -v
# 怎么是9

image-20220505233151947.png

# 切换GCC到7
rm -fr /usr/bin/gcc
rm -fr /usr/bin/g++
sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
sudo ln -s /usr/bin/g++-7 /usr/bin/g++

image-20220506075759159.png

The CUDA compiler identification is unknown

-- Found CUDA: /usr (found version "10.1")

# nvcc 的原因  多版本CUda?  nvcc -V
export PATH=/usr/local/cuda-10.1/bin/:$PATH
# 发现有个配置出现问题,改正如下
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH

image-20220506151041543.png

# 问题还是cuda和cudnn版本不对应。安装对应Cuda10.1的CuDNN  https://developer.nvidia.com/rdp/cudnn-archive

# Cudnn 10.1
sudo tar xvf cudnn-10.1-linux-x64-v7.6.0.64.tgz
sudo mv cuda/include/cudnn.h /usr/local/cuda-10.1/include
sudo mv cuda/lib64/libcudnn* /usr/local/cuda-10.1/lib64
sudo chmod a+r /usr/local/cuda-10.1/include/cudnn.h /usr/local/cuda-10.1/lib64/libcudnn*
  • 最后修改 CMakeFile ,搞定
vim CMakeLists.txt
# 在开始增加如下
set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc")

image-20220506173043114.png

重新编译

source activate py39_ms17

rm -fr build

bash build.sh -e gpu -S on

image-20220506174529253.png

Pip安装本地生成的MindSpore

source activate py39_ms17

pip install output/mindspore_gpu-*.whl -i https://pypi.tuna.tsinghua.edu.cn/simple

image-20220506174805504.png

posted @ 2022-05-31 11:11  北林野老  阅读(173)  评论(0)    收藏  举报