- NV驱动下载安装https://www.nvidia.cn/Download/index.aspx
- 多卡的话,安装 NCCL https://developer.nvidia.com/nccl/nccl-download
- 配置 pip 源
vim ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
- 安装
virtualenv
包pip install virtualenv
- 创建虚拟环境
virtualenv yourenvname
,激活source yourenvname/bin/activate
- 安装paddle
python -m pip install paddlepaddle-gpu==2.2.1 -i https://mirror.baidu.com/pypi/simple
- 安装torch
pip install torch==1.10.1 torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple
这个时候 torch 是可以调用GPU的,paddle不可以
- 下载 cudnn https://developer.nvidia.com/cudnn
https://developer.nvidia.com/rdp/cudnn-archive
官网下载链接,可能需要登录
清华下载地址 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/cudnn-7.6.5-cuda10.2_0.tar.bz2
从清华下载:
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/cudnn-7.6.5-cuda10.2_0.tar.bz2 --no-check-certificate
解压:
tar -jxvf cudnn-7.6.5-cuda10.2_0.tar.bz2
解压后的文件放到虚拟环境里
mv ./lib/* ./yourenvname/lib/
mv ./info ./yourenvname/
mv ./include/ ./yourenvname/
-
vim ~/.bashrc
添加以下自己的路径
export LD_LIBRARY_PATH=/yourenvpath***/lib/
让文件配置生效 source ~/.bashrc
导出包列表 pip list --format=freeze > ./requirements.txt
ahocorasick_rs==0.12.0
astor==0.8.1
certifi==2021.10.8
charset-normalizer==2.0.10
click==8.0.3
colorama==0.4.4
colorlog==6.6.0
decorator==5.1.1
dill==0.3.4
filelock==3.4.2
h5py==3.6.0
huggingface-hub==0.4.0
idna==3.3
jieba==0.42.1
joblib==1.1.0
loguru==0.5.3
multiprocess==0.70.12.2
numpy==1.22.1
packaging==21.3
paddlenlp==2.2.3
paddlepaddle-gpu==2.2.1
Pillow==9.0.0
pip==21.3.1
protobuf==3.19.3
pyparsing==3.0.7
pypinyin==0.44.0
PyYAML==6.0
regex==2022.1.18
requests==2.27.1
sacremoses==0.0.47
scikit-learn==1.0.2
scipy==1.7.3
seqeval==1.2.2
setuptools==60.2.0
six==1.16.0
threadpoolctl==3.0.0
tokenizers==0.10.3
torch==1.10.1
torchaudio==0.10.1
torchvision==0.11.2
tqdm==4.62.3
transformers==4.15.0
typing_extensions==4.0.1
urllib3==1.26.8
wheel==0.37.1
这样两个框架就都被安装在一个虚拟环境下了。
参考:
paddle安装指导
torch安装指导
TensorFlow 2.x GPU版在conda虚拟环境下安装步骤
pip/conda导出 requirements.txt 注意事项
conda安装pytorch1.10.1+paddlepaddle-gpu2.2.1+cuda10.2+cudnn7.6.5