提交 63df7ae6 编写于 作者: L liaogang

Refine docker install doc and FAQ for gpu driver

上级 31e57175
...@@ -56,25 +56,38 @@ The PaddlePaddle images don't contain any entry command. You need to write your ...@@ -56,25 +56,38 @@ The PaddlePaddle images don't contain any entry command. You need to write your
Download and Run Docker images 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 <https://docs.docker.com/engine/installation/>`_ 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` \:
.. code-block:: bash
docker run -it paddledev/paddle:cpu-latest docker run -it paddledev/paddle:cpu-latest
PaddlePaddle on GPU
.....................
If you want to launch container with GPU support, you need to set some environment variables at the same time: To build GPU version, you will need the following installed:
.. code-block:: bash .. 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 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 {}:{}') export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}')
docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest
Some notes for docker Some notes for Docker
--------------------- ---------------------
Performance Performance
......
...@@ -60,21 +60,38 @@ mac osx或者是windows机器,请参考 ...@@ -60,21 +60,38 @@ mac osx或者是windows机器,请参考
`mac osx的安装文档 <https://docs.docker.com/engine/installation/mac/>`_ 和 `mac osx的安装文档 <https://docs.docker.com/engine/installation/mac/>`_ 和
`windows 的安装文档 <https://docs.docker.com/engine/installation/windows/>`_ 。 `windows 的安装文档 <https://docs.docker.com/engine/installation/windows/>`_ 。
启动CPU版Docker镜像
...................
您可以使用 :code:`docker pull` 命令预先下载镜像,也可以直接执行 您可以使用 :code:`docker pull` 命令预先下载镜像,也可以直接执行
:code:`docker run` 命令运行镜像。执行方法如下: :code:`docker run` 命令运行镜像。执行方法如下:
.. code-block:: bash .. code-block:: bash
$ docker run -it paddledev/paddle:cpu-latest $ docker run -it paddledev/paddlepaddle:cpu-latest
即可启动和进入PaddlePaddle的container。如果运行GPU版本的PaddlePaddle,则需要先将 即可启动和进入PaddlePaddle的container。
cuda相关的Driver和设备映射进container中,脚本类似于
.. code-block:: bash 启动GPU版Docker镜像
...................
首先, 请参考以下链接,在机器上安装CUDA Toolkit。
.. code-block:: bash
NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads)
其次,需要将cuda相关的驱动和设备映射进container中,脚本类似于
.. code-block:: bash
$ export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')" $ 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 {}:{}') $ export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}')
$ docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest $ docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddlepaddle:latest-gpu
使用PaddlePaddle
..................
进入Docker container后,运行 :code:`paddle version` 即可打印出PaddlePaddle的版本和构建 进入Docker container后,运行 :code:`paddle version` 即可打印出PaddlePaddle的版本和构建
信息。安装完成的PaddlePaddle主体包括三个部分, :code:`paddle` 脚本, python的 信息。安装完成的PaddlePaddle主体包括三个部分, :code:`paddle` 脚本, python的
......
...@@ -202,3 +202,18 @@ PaddlePaddle的参数使用名字 :code:`name` 作为参数的ID,相同名字 ...@@ -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包。 * 卸载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 文档 <http://www.paddlepaddle.org/doc_cn/build_and_install/install/docker_install.html>`_ 。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册