Skip to content

Instantly share code, notes, and snippets.

@carlthome
Created January 28, 2022 09:51
Show Gist options
  • Save carlthome/138045aae02bde7cabeedfa2605890c4 to your computer and use it in GitHub Desktop.
Save carlthome/138045aae02bde7cabeedfa2605890c4 to your computer and use it in GitHub Desktop.
Check that a host system can use NVIDIA GPUs inside containers. Usage: `docker-compose run test-gpu`
version: "3"
services:
test-gpu:
image: tensorflow/tensorflow:latest-gpu
command: python -c "import tensorflow as tf; assert tf.test.is_gpu_available()"
deploy:
resources:
reservations:
devices:
- driver: nvidia
capabilities: [gpu]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment