-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding nvidia-docker v2 support #1167
Adding nvidia-docker v2 support #1167
Conversation
…ipt_for_dpx2 fix a docker script for dpx2
@koenlek this needs to point to |
@yk-fujii can you also please check this one? |
@koenlek Are the line 7 and 9 in the file build.sh commented on purpose? I tested with the nvidia-docker v2 and now Rviz is working. Thank you! |
Well spotted, I removed the comments, my bad. It now points to develop. I merged upstream develop in my branch and resolved two small merge conflicts that arose from that. |
@messi49 : can you make sure this MR is reviewed & merged? |
@messi49 Please review :) |
Will this MR be reviewed? Its 3 months old already. Give me a heads up if I need to fix the Merge conflicts. |
@koenlek Thanks for this contribution! I've tried it myself and I can confirm that it successfully builds a docker image containing Autoware using nvidia-docker2. I don't think we should maintain support for nvidia-docker (v1) any more. All (or at least most) of Nvidia's documentation now refers to version 2. We're just making life harder for ourselves by trying to support multiple setups. On that basis I would remove the second argument 'nvidia' to the run.sh and build.sh files. I'm also doubtful that we should be compiling the Autoware source code into the docker image that we build. In most other projects the docker image only serves to provide a consistent set of dependencies. After that it's common for the build script to mount the code in the newly created image and run build commands. |
@bdholt1, I agree on both that you should ditch nvidia-docker v1 and that it would be better to exclude source code from the docker image. That is how we use docker at our company too. The docker image should provide you with a development environment in which you can compile the autoware code (i.e. with all compile-time dependencies available). You can also make a runtime image which contains all the compiled software, but I would advice you to look into catkin install targets to make the deployed filesystem cleaner. When using the install targets you specify a file structure which contains only the files that need to be deployed (e.g. the binaries, launch files, param files, but not the src/header files). Just take a look at any official ros package github repo (e.g. https://github.com/ros-planning/navigation) for an example. Some recommendations:
We have a check_nvidia bash function that automatically can 'patch' a docker run command to take care, see this example: check_nvidia(){
if nvidia-smi &> /dev/null; then
export NV_RUN="--runtime=nvidia"
export NV_TAG_SUFFIX="-nvidia"
else
export NV_RUN=""
export NV_TAG_SUFFIX=""
fi
}
# adds GUI support and few other tricks
export DOCKER_COMMON_ARGS="--env=DISPLAY \
--env=XDG_RUNTIME_DIR \
--env=QT_X11_NO_MITSHM=1 \
--device=/dev/dri:/dev/dri \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v /etc/localtime:/etc/localtime:ro"
xhost +local:docker
check_nvidia
docker run ${NV_RUN} ${DOCKER_COMMON_ARGS:?} -it --rm \
--name="autoware" \
-v /dev/bus/usb:/dev/bus/usb \
-v /home/$USER/.Xauthority:/home/autoware/.Xauthority \
-v "$HOME/docker_shared:/home/autoware/docker_shared" \
-v autoware_home:/home/autoware \
-v /media:/media \
--net=host \
--add-host autoware:127.0.0.1 \
--hostname=autoware \
--privileged \
autoware/autoware:1.7.0-kinetic${NV_TAG_SUFFIX} Feel free to do with this advice whatever you like. I suggest you take it over from here from me and make some issues (stories) out of it if you like. |
@koenlek thanks for your contribution, I'll take over from here. |
Status
PRODUCTION, safe for the "optional" todos mentioned below.
Description
Adding nvidia docker v2 support as discussed in issue autowarefoundation/autoware_ai#93 .
Todos
nvidia-docker run
command (which isdocker run --runtime nvidia
these days).Steps to Test or Reproduce
See autowarefoundation/autoware_ai#93.
Make sure to install nvidia-docker v2 and see if the old image works for your (should not work. Opening RVIZ would crash for example). Then try again with the new image and see if it works.