Skip to content

Commit

Permalink
Handle "gpus" not in facts
Browse files Browse the repository at this point in the history
  • Loading branch information
damonmaria committed Mar 29, 2020
1 parent c967ce5 commit 430ba42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@

# nvidia_docker_runtime

This is a PDK based module https://puppet.com/pdk/latest/pdk_generating_modules.html .

#### Table of Contents

1. [Description](#description)
3. [Usage - Configuration options and additional functionality](#usage)
2. [Usage - Configuration options and additional functionality](#usage)

## Description

Modifies Docker for use with NVIDIA GPU based containers, including in swarm mode.

## Setup
Modifies Docker for use with NVIDIA GPU based containers, including in swarm mode.

## Usage

Expand All @@ -22,3 +19,10 @@ class { 'nvidia_docker_runtime':
nvidia_docker2_version => '2.2.2-1',
}
```

## Limitations

Since GPU UUIDs are needed to specify `node-generic-resources`, and these are not available through facts until
the NVIDIA driver has been installed, it takes two applies to fully setup. Until then swarm cannot use gpu resources.

Due to Docker limitations you can only specify gpus in compose files for compose format 2.3. As `docker stack` requires format 3.0 this means you can't use gpus in stacks.
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@
}
~> Service['docker']
$gpu_ids = $facts['gpus'].map |$gpu| { $gpu['gpu_uuid'][0,11] }
$gpu_ids = if 'gpus' in $facts {
$facts['gpus'].map |$gpu| { $gpu['gpu_uuid'][0,11] }
} else {
[]
}
Package['nvidia-docker2']
-> augeas { 'daemon.json':
lens => 'Json.lns',
Expand Down

0 comments on commit 430ba42

Please sign in to comment.