1 anaconda创建环境:
conda create -n your_env_name python=3.6
2 cuda10配置GPU版本的tensorflow和pytorch安装
tensorflow1.13:
pip install --ignore-installed --upgrade tensorflow_gpu==1.13.1
pytorch1.2.0:
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
3 缺少库的安装指令:
CV2:
pip install opencv-python
4 在虚拟环境中安装cuda跟cudnn
conda install cudatoolkit=10.1 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
conda install cudnn=7.6.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
5 tensorflow是否调用GPU
tf.test.is_gpu_available()
6 指定GPU进行训练
CUDA_VISIBLE_DEVICES=1 Only device 1 will be seen
CUDA_VISIBLE_DEVICES=0,1 Devices 0 and 1 will be visible
CUDA_VISIBLE_DEVICES="0,1" Same as above, quotation marks are optional
CUDA_VISIBLE_DEVICES=0,2,3 Devices 0, 2, 3 will be visible; device 1 is masked
CUDA_VISIBLE_DEVICES="" No GPU will be visible