环境:
CUDA10.0.130
CUDNN7.6.5
具体参见Ubuntu显卡驱动安装、CUDA+CUDNN安装文章,本文不赘述。
需要配置环境变量:
vim .bashrc
export PATH=/usr/local/cuda-10.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=/usr/local/cuda-10.0:$CUDA_HOME
export CPATH="/usr/local/cuda-10.0/include:$CPATH"
source .bashrc
可通过以下命令查看:
echo $PATH
echo $CPATH
以pytorch1.4.0+cu100为例:
pip --default-timeout=100 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.4.0+cu100 torchvision==0.5.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html
为避免torch-sparse等安装报错,先行下载:
https://pytorch-geometric.com/whl/torch-1.4.0.html
具体根据torch版本改变网址即可。
下载完毕后,安装如下:
cd 下载
pip install torch_scatter-2.0.3+cu100-cp36-cp36m-linux_x86_64.whl
pip install torch_sparse-0.6.0+cu100-cp36-cp36m-linux_x86_64.whl
pip install torch_cluster-1.5.4+cu100-cp36-cp36m-linux_x86_64.whl
pip install torch_spline_conv-latest+cu100-cp36-cp36m-linux_x86_64.whl
pip --default-timeout=100 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch-geometric==1.4.1
以上,安装了torch_scatter,torch_sparse,torch_cluster,torch_spline_conv,torch_geometric包及相关依赖。