Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/3999-re-organize-th…
Browse files Browse the repository at this point in the history
…e-autoware-docker-containers' into 3999-re-organize-the-autoware-docker-containers
  • Loading branch information
oguzkaganozt committed Feb 4, 2024
2 parents bc17470 + b9a5711 commit 697ba40
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
base_image_env: base_image
lib_dir: aarch64
setup-args: --no-nvidia
additional-tag-suffix: -debug
additional-tag-suffix: ""
- name: cuda
base_image_env: base_image
lib_dir: aarch64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-and-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
base_image_env: base_image
lib_dir: x86_64
setup-args: --no-nvidia
additional-tag-suffix: -debug
additional-tag-suffix: ""
- name: cuda
base_image_env: base_image
lib_dir: x86_64
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/setup-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ on:
pull_request:

jobs:
load-env:
uses: ./.github/workflows/load-env.yaml

setup-docker:
needs: load-env
runs-on: ubuntu-latest
container: ${{ needs.load-env.outputs.base-image }}
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/setup-universe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ on:
pull_request:

jobs:
load-env:
uses: ./.github/workflows/load-env.yaml

setup-universe:
needs: load-env
runs-on: ubuntu-latest
container: ${{ needs.load-env.outputs.base-image }}
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion ansible/playbooks/openadk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@

# ONNX files and other artifacts
- role: autoware.dev_env.artifacts
when: module == 'dev-tools' or (module == 'all' and install_devel == 'false')
when: prompt_download_artifacts == 'y'
26 changes: 13 additions & 13 deletions ansible/roles/cuda/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,61 +83,61 @@
- name: Create Vulkan directory
become: true
ansible.builtin.file:
path: "/etc/vulkan/icd.d"
path: /etc/vulkan/icd.d
state: directory
mode: "0755"

- name: Create OpenGL directory
become: true
ansible.builtin.file:
path: "/etc/glvnd/egl_vendor.d"
path: /etc/glvnd/egl_vendor.d
state: directory
mode: "0755"

- name: Create OpenCL directory
become: true
ansible.builtin.file:
path: "/etc/OpenCL/vendors"
path: /etc/OpenCL/vendors
state: directory
mode: "0755"

- name: Register Vulkan GPU vendors
become: true
ansible.builtin.get_url:
url: "https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json"
dest: "/etc/vulkan/icd.d/nvidia_icd.json"
url: https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json
dest: /etc/vulkan/icd.d/nvidia_icd.json
mode: "0644"

- name: Set permissions for Vulkan GPU vendors
become: true
ansible.builtin.file:
path: "/etc/vulkan/icd.d/nvidia_icd.json"
path: /etc/vulkan/icd.d/nvidia_icd.json
mode: "0644"

- name: Register OpenGL GPU vendors
become: true
ansible.builtin.get_url:
url: "https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json"
dest: "/etc/glvnd/egl_vendor.d/10_nvidia.json"
url: https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json
dest: /etc/glvnd/egl_vendor.d/10_nvidia.json
mode: "0644"

- name: Set permissions for OpenGL GPU vendors
become: true
ansible.builtin.file:
path: "/etc/glvnd/egl_vendor.d/10_nvidia.json"
path: /etc/glvnd/egl_vendor.d/10_nvidia.json
mode: "0644"

- name: Register OpenCL GPU vendors
become: true
ansible.builtin.file:
path: "/etc/OpenCL/vendors/nvidia.icd"
state: "touch"
path: /etc/OpenCL/vendors/nvidia.icd
state: touch
mode: "0644"

- name: Set permissions for OpenCL GPU vendors
become: true
ansible.builtin.lineinfile:
path: "/etc/OpenCL/vendors/nvidia.icd"
line: "libnvidia-opencl.so.1"
path: /etc/OpenCL/vendors/nvidia.icd
line: libnvidia-opencl.so.1
create: true
mode: "0644"
1 change: 0 additions & 1 deletion ansible/roles/geographiclib/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
module: dev-tools
9 changes: 1 addition & 8 deletions ansible/roles/geographiclib/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
- name: Install libqt5charts5-dev # remove this task after merging https://github.com/ros/rosdistro/pull/39705.
become: true
ansible.builtin.apt:
name: libqt5charts5-dev
state: latest
update_cache: true

- name: Install geographiclib-tools
become: true
ansible.builtin.apt:
Expand All @@ -17,4 +10,4 @@
ansible.builtin.command:
cmd: geographiclib-get-geoids egm2008-1
creates: /usr/share/GeographicLib/geoids/egm2008-1.pgm
when: module == 'dev-tools' or install_devel== 'false'
when: prompt_download_artifacts == 'y'
28 changes: 16 additions & 12 deletions ansible/roles/nvidia_docker/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# tasks file for nvidia-container-toolkit-installation
- name: Add NVIDIA container toolkit GPG key
become: true
ansible.builtin.shell: |
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
ansible.builtin.apt_key:
url: https://nvidia.github.io/libnvidia-container/gpgkey
state: present
keyring: /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg

- name: Add NVIDIA container toolkit repository
become: true
ansible.builtin.shell: |
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
- name: Update apt cache
become: true
ansible.builtin.apt:
update_cache: yes
ansible.builtin.apt_repository:
repo: deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
state: present
filename: nvidia-container-toolkit
update_cache: true

- name: Install NVIDIA Container Toolkit
become: true
Expand All @@ -27,4 +24,11 @@
become: true
ansible.builtin.shell: |
nvidia-ctk runtime configure --runtime=docker
changed_when: true

- name: Restart docker daemon
become: true
ansible.builtin.systemd:
name: docker
state: restarted
changed_when: true
1 change: 0 additions & 1 deletion ansible/roles/tensorrt/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
install_devel: true
4 changes: 2 additions & 2 deletions ansible/roles/tensorrt/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
allow_change_held_packages: true
allow_downgrade: true
update_cache: true
when: install_devel | bool
when: install_devel == 'true'

# apt-mark hold
- name: Prevent CUDA-related packages from upgrading
Expand All @@ -49,4 +49,4 @@
- libnvinfer-plugin-dev
- libnvparsers-dev
- libnvonnxparsers-dev
when: install_devel | bool
when: install_devel == 'true'
6 changes: 3 additions & 3 deletions docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install development tools and artifacts
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module dev-tools openadk \
./setup-dev-env.sh -y --module dev-tools --download-artifacts openadk \
&& pip uninstall -y ansible ansible-core \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache

Expand All @@ -108,10 +108,10 @@ ARG ROS_DISTRO
ARG LIB_DIR
ARG SETUP_ARGS

# Set up runtime environment
# Set up runtime environment and artifacts
COPY autoware.repos /autoware/
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadk \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadk \
&& pip uninstall -y ansible ansible-core \
&& mkdir src \
&& vcs import src < autoware.repos \
Expand Down
2 changes: 2 additions & 0 deletions docker/autoware-openadk/etc/.bash_aliases
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# planning simulation
function download_planning_map() {
if [ ! -f ~/autoware_map/sample-map-planning.zip ]; then
Expand Down
39 changes: 28 additions & 11 deletions setup-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@

set -e

# Function to print help message
print_help() {
echo "Usage: setup-dev-env.sh [OPTIONS]"
echo "Options:"
echo " --help Display this help message"
echo " -h Display this help message"
echo " -y Use non-interactive mode"
echo " -v Enable debug outputs"
echo " --no-nvidia Disable installation of the NVIDIA-related roles ('cuda' and 'tensorrt')"
echo " --no-cuda-drivers Disable installation of 'cuda-drivers' in the role 'cuda'"
echo " --runtime Disable installation dev package of role 'cuda' and 'tensorrt'"
echo " --data-dir Set data directory (default: $HOME/autoware_data)"
echo " --download-artifacts"
echo " Download artifacts"
echo " --module Specify the module (default: all)"
echo ""
}

SCRIPT_DIR=$(readlink -f "$(dirname "$0")")

# Parse arguments
Expand All @@ -13,6 +31,10 @@ option_data_dir="$HOME/autoware_data"

while [ "$1" != "" ]; do
case "$1" in
--help | -h)
print_help
exit 1
;;
-y)
# Use non-interactive mode.
option_yes=true
Expand Down Expand Up @@ -42,10 +64,6 @@ while [ "$1" != "" ]; do
# Set download artifacts option
option_download_artifacts=true
;;
--docker)
# Set download artifacts option
option_docker=true
;;
--module)
option_module="$2"
shift
Expand All @@ -60,12 +78,6 @@ done
# Select installation type
target_playbook="autoware.dev_env.universe" # default

# Set-up docker environment
if [ "$option_docker" = "true" ]; then
target_playbook="autoware.dev_env.docker"
ansible_args+=("--extra-vars" "cuda_install_drivers=true")
fi

if [ ${#args[@]} -ge 1 ]; then
target_playbook="autoware.dev_env.${args[0]}"
fi
Expand Down Expand Up @@ -115,7 +127,12 @@ else
fi

# Check downloading artifacts
if [ "$option_yes" = "true" ] || [ "$option_download_artifacts" = "true" ]; then
if [ "$target_playbook" = "autoware.dev_env.openadk" ]; then
if [ "$option_download_artifacts" = "true" ]; then
echo -e "\e[36mArtifacts will be downloaded to $option_data_dir\e[m"
ansible_args+=("--extra-vars" "prompt_download_artifacts=y")
fi
elif [ "$option_yes" = "true" ] || [ "$option_download_artifacts" = "true" ]; then
echo -e "\e[36mArtifacts will be downloaded to $option_data_dir\e[m"
ansible_args+=("--extra-vars" "prompt_download_artifacts=y")
fi
Expand Down

0 comments on commit 697ba40

Please sign in to comment.