Skip to content

Commit

Permalink
feat(setup, ansible): add an option for not installing cuda-drivers (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#338)

Signed-off-by: Kenji Miyake <[email protected]>
  • Loading branch information
kenji-miyake authored May 23, 2022
1 parent 717e197 commit 5b391a4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
7 changes: 4 additions & 3 deletions ansible/roles/cuda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ This role installs [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) fol

## Inputs

| Name | Required | Description |
| ------------ | -------- | ---------------------------- |
| cuda_version | true | The version of CUDA Toolkit. |
| Name | Required | Description |
| -------------------- | -------- | -------------------------------- |
| cuda_version | true | The version of CUDA Toolkit. |
| install_cuda_drivers | false | Whether to install cuda-drivers. |

## Manual Installation

Expand Down
1 change: 1 addition & 0 deletions ansible/roles/cuda/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install_cuda_drivers: true
13 changes: 11 additions & 2 deletions ansible/roles/cuda/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@
register: dash_case_cuda_version
changed_when: false

- name: Install cuda-{{ dash_case_cuda_version.stdout }}
- name: Install cuda-toolkit-{{ dash_case_cuda_version.stdout }}
become: true
ansible.builtin.apt:
name: cuda-{{ dash_case_cuda_version.stdout }}
name:
- cuda-toolkit-{{ dash_case_cuda_version.stdout }}
update_cache: true

- name: Install cuda-drivers
become: true
ansible.builtin.apt:
name:
- cuda-drivers
update_cache: true
when: install_cuda_drivers|bool

- name: Add PATH to .bashrc
ansible.builtin.lineinfile:
dest: ~/.bashrc
Expand Down
10 changes: 9 additions & 1 deletion setup-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ while [ "$1" != "" ]; do
--no-nvidia)
option_no_nvidia=true
;;
--no-cuda-drivers)
option_no_cuda_drivers=true
;;
*)
args+=("$1")
;;
Expand Down Expand Up @@ -58,13 +61,18 @@ if [ "$option_verbose" = "true" ]; then
ansible_args+=("-vvv")
fi

# Check NVIDIA Installation
# Check installation of NVIDIA libraries
if [ "$option_no_nvidia" = "true" ]; then
ansible_args+=("--extra-vars" "install_nvidia=n")
elif [ "$option_yes" = "true" ]; then
ansible_args+=("--extra-vars" "install_nvidia=y")
fi

# Check installation of CUDA Drivers
if [ "$option_no_cuda_drivers" = "true" ]; then
ansible_args+=("--extra-vars" "install_cuda_drivers=false")
fi

# Load env
source "$SCRIPT_DIR/amd64.env"
if [ "$(uname -m)" = "aarch64" ]; then
Expand Down

0 comments on commit 5b391a4

Please sign in to comment.