Skip to content

Conversation

@ggorman
Copy link
Contributor

@ggorman ggorman commented Aug 12, 2025

CI: Cannot set --env CUDA_VISIBLE_DEVICES for docker run when using ng --gpus "device=${CUDA_VISIBLE_DEVICES:-all}" - dropping --env arg.

To see why, consider if we have export CUDA_VISIBLE_DEVICES=1, then setting --env CUDA_VISIBLE_DEVICES for docker run means that the docker runtime env will contain CUDA_VISIBLE_DEVICES=1; however, when you set docker run --gpus "device=${CUDA_VISIBLE_DEVICES:-all}", the docker runtime will only use GPU 1 but it renumbers it as zero. Therefore, when you run a cuda code inside docker the runtime only sees a single GPU device with device ID 0, but CUDA_VISIBLE_DEVICES is set to device id 1, and therefore you get an (uncaught) exception.

…ng `--gpus "device=${CUDA_VISIBLE_DEVICES:-all}"` - dropping --env arg.

To see why, consider if we have export CUDA_VISIBLE_DEVICES=1, then setting --env CUDA_VISIBLE_DEVICES for docker run means that the docker runtime env will contain CUDA_VISIBLE_DEVICES=1; however, when you set docker run --gpus "device=${CUDA_VISIBLE_DEVICES:-all}", the docker runtime will only use GPU 1 but it renumbers it as zero. Therefore, when you run a cuda code inside docker the runtime only sees a single GPU device with device ID 0, but CUDA_VISIBLE_DEVICES is set to device id 1, and therefore you get an (uncaught) exception.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a Docker GPU configuration issue in the CI workflow where setting both --env CUDA_VISIBLE_DEVICES and --gpus "device=${CUDA_VISIBLE_DEVICES:-all}" causes runtime conflicts. The Docker runtime renumbers GPUs starting from 0, but the environment variable retains the original device ID, leading to CUDA exceptions.

  • Removes the --env CUDA_VISIBLE_DEVICES flag from the Docker run command to prevent GPU ID mismatches

@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.11%. Comparing base (70c3ed1) to head (b0d3c60).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2710   +/-   ##
=======================================
  Coverage   92.11%   92.11%           
=======================================
  Files         248      248           
  Lines       49641    49641           
  Branches     4367     4367           
=======================================
  Hits        45726    45726           
  Misses       3208     3208           
  Partials      707      707           
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 71.07% <ø> (ø)
pytest-gpu-nvc-nvidiaX 72.05% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@FabioLuporini FabioLuporini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncontroversial, thanks

@FabioLuporini FabioLuporini merged commit f52cf7b into main Aug 12, 2025
36 checks passed
@FabioLuporini FabioLuporini deleted the fix_id branch August 12, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants