Skip to content

Commit

Permalink
Docker: Add option to select nvidia runtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxq authored and lianglia-apollo committed May 7, 2018
1 parent 83f1d7a commit 5230c2a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion docker/build/dev.x86_64.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN bash /tmp/installers/post_install.sh
RUN apt-get install -y \
bc \
cppcheck \
cuda \
debconf-utils \
doxygen \
graphviz \
Expand Down
1 change: 1 addition & 0 deletions docker/build/installers/install_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ USER_NAME=apollo

adduser --disabled-password --gecos '' ${USER_NAME}
usermod -aG sudo ${USER_NAME}
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

echo """
ulimit -c unlimited
Expand Down
19 changes: 19 additions & 0 deletions docker/canary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@
sudo bash ./docker/canary/setup_host.sh
```

1. If you are going to use GPU (recommended), you need to install
[nvidia-driver](http://www.nvidia.com/Download/index.aspx) and
[nvidia-docker](https://github.com/NVIDIA/nvidia-docker/blob/master/README.md#quickstart)
on HOST.

Nvidia-driver provides access to GPU from HOST, which will make the following
command work properly:

```bash
nvidia-smi
```

Nvidia-docker provides access to GPU from docker container, which will make
the following command work properly:

```bash
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
```

1. Start Apollo dev container.

```bash
Expand Down
7 changes: 7 additions & 0 deletions docker/canary/start_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def __init__(self):
help='Optional maps. Make sure it is '
'available as docker volume image at '
'<REPO>:map_volume-<MAP>-latest.')
self.parser.add_argument('--without_gpu', default=False,
action="store_true",
help='Whether to use GPU. Note that without '
'GPU, it might be not efficient enough for '
'road testing.')

self._args = None

Expand Down Expand Up @@ -146,6 +151,8 @@ def __init__(self, args):
'--hostname in_dev_docker',
'--shm-size 2G',
]
if not args.without_gpu:
self.other_options.append('--runtime nvidia')

def add_map_volume(self, repo, map_name, version='latest'):
"""Add map volume to apollo container."""
Expand Down

2 comments on commit 5230c2a

@poutyface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, libGL does not work on nvidia-docker2.
see NVIDIA/nvidia-docker#534

@xiaoxq
Copy link
Contributor Author

@xiaoxq xiaoxq commented on 5230c2a May 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @poutyface ! That might be the problem I got. Will investigate and maybe fallback to V1.

Please sign in to comment.