- 安装ubuntu18 安装docker,这些就不讲,安装3090的gpu驱动
➜ stylegan2 git:(master) ✗ nvidia-smi Wed Apr 20 17:17:01 2022 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 495.46 Driver Version: 495.46 CUDA Version: 11.5 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A | | 0% 35C P8 10W / 370W | 217MiB / 24267MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 983 G /usr/lib/xorg/Xorg 18MiB | | 0 N/A N/A 1033 G /usr/bin/gnome-shell 74MiB | | 0 N/A N/A 1314 G /usr/lib/xorg/Xorg 94MiB | | 0 N/A N/A 1444 G /usr/bin/gnome-shell 26MiB | +-----------------------------------------------------------------------------+
- 配置nvidia-container-runtime,按照这个https://github.com/NVIDIA/nvidia-container-runtime的官方说明搞了一下就可以了,具体记不清楚了,应该是两步
- https://nvidia.github.io/nvidia-container-runtime/
Debian-based distributions
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list sudo apt-get update
- sudo apt-get install nvidia-container-runtime
- git clone stylegan2 的仓库 cd进去
- 修改Dockerfile pip加速 不然很慢的
FROM tensorflow/tensorflow:1.14.0-gpu-py3 RUN pip config set global.index-url http://mirrors.aliyun.com/pypi/simple RUN pip config set install.trusted-host mirrors.aliyun.com RUN pip install scipy==1.3.3 RUN pip install requests==2.22.0 RUN pip install Pillow==6.2.1
- 从Dockerfile构建一个干净的镜像 docker build --tag stylegan2:latest .
- 运行镜像
docker run --gpus all -it -v `pwd`:/scratch --user $(id -u):$(id -g) stylegan2:latest bash
- 连进去了 测试一下哈哈
root@ee0a53ccec56:/# nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Sat_Aug_25_21:08:01_CDT_2018 Cuda compilation tools, release 10.0, V10.0.130 root@ee0a53ccec56:/# cd /scratch/ root@ee0a53ccec56:/scratch# nvcc test_nvcc.cu -o test_nvcc -run CPU says hello. GPU says hello.
教程搬运自youtubu的视频https://www.youtube.com/watch?v=VVj8EvgVjLo



