Skip to content

Commit

Permalink
Feat: Allow services to request GPU devices
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketeerbkw committed May 1, 2023
1 parent adc702c commit 18eb5ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions legacy/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,9 @@ do
fi
fi

# handle gpu configuration
. /kubectl-build-deploy/scripts/exec-gpu-generation.sh

# handle spot configurations
. /kubectl-build-deploy/scripts/exec-spot-generation.sh

Expand Down
25 changes: 25 additions & 0 deletions legacy/scripts/exec-gpu-generation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Handle GPU device requests
GPU_REQUEST=$(cat $DOCKER_COMPOSE_YAML | shyaml get-value services.$COMPOSE_SERVICE.labels.lagoon\\.gpu false)
if [ ! $GPU_REQUEST == "false" ]; then
GPU_REQUEST_SIZE=$(cat $DOCKER_COMPOSE_YAML | shyaml get-value services.$COMPOSE_SERVICE.labels.lagoon\\.gpu\\.size false)
if [ ! $GPU_REQUEST_SIZE == "false" ]; then
GPU_SIZE=1
else
GPU_SIZE=$GPU_REQUEST_SIZE
fi

echo -e "\
tolerations:
- key: lagoon.sh/gpu
operator: Equal
value: 'true'
effect: NoSchedule
nodeSelector:
lagoon.sh/gpu: 'true'
resources:
limits:
nvidia.com/gpu: ${GPU_SIZE}
" >> /kubectl-build-deploy/${SERVICE_NAME}-values.yaml
fi

0 comments on commit 18eb5ee

Please sign in to comment.