From 63df7ae65d5f003f0166d5a403991b73081db83f Mon Sep 17 00:00:00 2001 From: liaogang Date: Wed, 30 Nov 2016 12:51:13 +0800 Subject: [PATCH] Refine docker install doc and FAQ for gpu driver --- .../build_and_install/docker_install.rst | 33 +++++++++++++------ .../install/docker_install.rst | 33 ++++++++++++++----- doc_cn/faq/index.rst | 15 +++++++++ 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/doc/getstarted/build_and_install/docker_install.rst b/doc/getstarted/build_and_install/docker_install.rst index e95de35f4da..88d83573044 100644 --- a/doc/getstarted/build_and_install/docker_install.rst +++ b/doc/getstarted/build_and_install/docker_install.rst @@ -56,25 +56,38 @@ The PaddlePaddle images don't contain any entry command. You need to write your Download and Run Docker images ------------------------------ -You have to install Docker in your machine which has linux kernel version 3.10+ first. You can refer to the official guide https://docs.docker.com/engine/installation/ for further information. +Currently, Docker is supported on macOS, Windows and Linux distributions. Please check out `Install Docker Engine `_ to find out much more details. -You can use :code:`docker pull ` to download images first, or just launch a container with :code:`docker run` \: +PaddlePaddle on CPU +..................... -.. code-block:: bash +You can use :code:`docker pull ` to download images, or directly launch a container with :code:`docker run` \: - docker run -it paddledev/paddle:cpu-latest + .. code-block:: bash + docker run -it paddledev/paddle:cpu-latest -If you want to launch container with GPU support, you need to set some environment variables at the same time: +PaddlePaddle on GPU +..................... -.. code-block:: bash +To build GPU version, you will need the following installed: + + .. code-block:: bash + + 1. a CUDA-capable GPU + 2. NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads) + + +Then, you will need to mount related CUDA driver and library into container. + + .. code-block:: bash - export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')" - export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}') - docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest + export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')" + export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}') + docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest -Some notes for docker +Some notes for Docker --------------------- Performance diff --git a/doc_cn/build_and_install/install/docker_install.rst b/doc_cn/build_and_install/install/docker_install.rst index 40339659be4..90a5c937094 100644 --- a/doc_cn/build_and_install/install/docker_install.rst +++ b/doc_cn/build_and_install/install/docker_install.rst @@ -60,21 +60,38 @@ mac osx或者是windows机器,请参考 `mac osx的安装文档 `_ 和 `windows 的安装文档 `_ 。 + +启动CPU版Docker镜像 +................... + 您可以使用 :code:`docker pull` 命令预先下载镜像,也可以直接执行 :code:`docker run` 命令运行镜像。执行方法如下: -.. code-block:: bash + .. code-block:: bash + + $ docker run -it paddledev/paddlepaddle:cpu-latest + +即可启动和进入PaddlePaddle的container。 + +启动GPU版Docker镜像 +................... + +首先, 请参考以下链接,在机器上安装CUDA Toolkit。 + + .. code-block:: bash - $ docker run -it paddledev/paddle:cpu-latest + NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads) -即可启动和进入PaddlePaddle的container。如果运行GPU版本的PaddlePaddle,则需要先将 -cuda相关的Driver和设备映射进container中,脚本类似于 +其次,需要将cuda相关的驱动和设备映射进container中,脚本类似于 -.. code-block:: bash + .. code-block:: bash + + $ export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')" + $ export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}') + $ docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddlepaddle:latest-gpu - $ export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')" - $ export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}') - $ docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest +使用PaddlePaddle +.................. 进入Docker container后,运行 :code:`paddle version` 即可打印出PaddlePaddle的版本和构建 信息。安装完成的PaddlePaddle主体包括三个部分, :code:`paddle` 脚本, python的 diff --git a/doc_cn/faq/index.rst b/doc_cn/faq/index.rst index 551430eb417..838fa651d85 100644 --- a/doc_cn/faq/index.rst +++ b/doc_cn/faq/index.rst @@ -202,3 +202,18 @@ PaddlePaddle的参数使用名字 :code:`name` 作为参数的ID,相同名字 解决办法是: * 卸载PaddlePaddle包 :code:`pip uninstall paddle`, 清理掉老旧的PaddlePaddle安装包,使得单元测试有一个干净的环境。如果PaddlePaddle包已经在python的site-packages里面,单元测试会引用site-packages里面的python包,而不是源码目录里 :code:`/python` 目录下的python包。同时,即便设置 :code:`PYTHONPATH` 到 :code:`/python` 也没用,因为python的搜索路径是优先已经安装的python包。 + + +9. 运行Docker GPU镜像出现 "CUDA driver version is insufficient" +---------------------------------------------------------------- + +用户在使用PaddlePaddle GPU的Docker镜像的时候,常常出现 `Cuda Error: CUDA driver version is insufficient for CUDA runtime version`, 原因在于没有把机器上CUDA相关的驱动和库映射到容器内部。 +具体的解决方法是: + +.. code-block:: bash + + $ export CUDA_SO="$(\ls usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')" + $ export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}') + $ docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddlepaddle:latest-gpu + +更多关于Docker的安装与使用, 请参考 `PaddlePaddle Docker 文档 `_ 。 -- GitLab