Docker

About some of the options

  • CUDA: For acceleration. Requires a good nVidia Graphics Card (which supports CUDA inside)
  • Docker: Provide a ready-made image. Hide trivial details. Get you straight to the project.
  • nVidia-Docker: Access to the nVidia GPU on host machine from inside container.

CUDA with Docker in 20 minutes.

INFO    The tool provides tips for installation
        and installs required python packages
INFO    Setup in Linux 4.14.39-1-MANJARO
INFO    Installed Python: 3.6.5 64bit
INFO    Installed PIP: 10.0.1
Enable  Docker? [Y/n] 
INFO    Docker Enabled
Enable  CUDA? [Y/n] 
INFO    CUDA Enabled
INFO    1. Install Docker
        https://www.docker.com/community-edition
        
        2. Install Nvidia-Docker & Restart Docker Service
        https://github.com/NVIDIA/nvidia-docker
        
        3. Build Docker Image For Faceswap
        docker build -t deepfakes-gpu -f Dockerfile.gpu .
        
        4. Mount faceswap volume and Run it
        # without gui. tools.py gui not working.
        nvidia-docker run --rm -it -p 8888:8888             --hostname faceswap-gpu --name faceswap-gpu             -v /opt/faceswap:/srv             deepfakes-gpu
        
        # with gui. tools.py gui working.
        ## enable local access to X11 server
        xhost +local:
        ## enable nvidia device if working under bumblebee
        echo ON > /proc/acpi/bbswitch
        ## create container 
        nvidia-docker run -p 8888:8888             --hostname faceswap-gpu --name faceswap-gpu             -v /opt/faceswap:/srv             -v /tmp/.X11-unix:/tmp/.X11-unix             -e DISPLAY=unix$DISPLAY             -e AUDIO_GID=`getent group audio | cut -d: -f3`             -e VIDEO_GID=`getent group video | cut -d: -f3`             -e GID=`id -g`             -e UID=`id -u`             deepfakes-gpu
        
        5. Open a new terminal to interact with the project
        docker exec faceswap-gpu python /srv/tools.py gui

A successful setup log, without docker.

INFO    The tool provides tips for installation
        and installs required python packages
INFO    Setup in Linux 4.14.39-1-MANJARO
INFO    Installed Python: 3.6.5 64bit
INFO    Installed PIP: 10.0.1
Enable  Docker? [Y/n] n
INFO    Docker Disabled
Enable  CUDA? [Y/n] 
INFO    CUDA Enabled
INFO    CUDA version: 9.1
INFO    cuDNN version: 7
WARNING Tensorflow has no official prebuild for CUDA 9.1 currently.
        To continue, You have to build your own tensorflow-gpu.
        Help: https://www.tensorflow.org/install/install_sources
Are System Dependencies met? [y/N] y
INFO    Installing Missing Python Packages...
INFO    Installing tensorflow-gpu
INFO    Installing pathlib==1.0.1
......
INFO    Installing tqdm
INFO    Installing matplotlib
INFO    All python3 dependencies are met.
        You are good to go.

Docker是一个什么工具?为什么要装它?能用它做什么?

原文地址:https://www.cnblogs.com/2008nmj/p/10353381.html