Repository navigation
test: select CUDA devices relative to the host, not cuda:6/7/8 (#4768) - #4857
Merged
Merged
Conversation
Part 2 of #4768. Four files gated on a lab-specific device index, so they skipped on every host with fewer than seven GPUs: - ``tests/test_gptq.py``: ``TestGPTQAddBatchCPU`` and ``TestGPTQHessianChunking`` gated on ``device_count() <= 6`` and ran on ``cuda:6``; they now need only CUDA and use ``torch.cuda.current_device()``. - ``tests/test_g2h_tensor_quality.py``: hard-coded ``gpu_index = 6`` replaced with the current device. - ``tests/test_cuda_event_stream_activation_buffer.py``: same gate and index replaced with a CUDA-availability skip and the current device. - ``tests/test_fp4_llama3_fp4.py``: ``cuda:7``/``cuda:8`` parametrization replaced with the visible devices (current, plus the last one when a second GPU exists). ``tests/test_device_index_gates_4768.py`` guards the four files against a fixed index above 0 coming back; it fails on ``main`` and passes with this change. Measured on a 1-GPU host (GB10, sm_121): the selected tests go from 11 skipped to 9 passed + 1 skipped (the FP4 checkpoint is absent) plus the two benchmark classes now passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part 2 of #4768 (parts 1, 3 and 4 landed in #4787). Five test sites gated on a
device index from the lab's 8-GPU box, so they skipped on every host with fewer
than seven GPUs and never ran in CI. AGENTS.md requires capability-relative
device selection, not a fixed index.
tests/test_gptq.py(TestGPTQAddBatchCPU,TestGPTQHessianChunking)device_count() <= 6gate,cuda:6torch.cuda.current_device()tests/test_g2h_tensor_quality.pygpu_index = 6+ count skiptorch.cuda.current_device()tests/test_cuda_event_stream_activation_buffer.pydevice_count() <= 6gate,cuda:6torch.cuda.current_device()tests/test_fp4_llama3_fp4.pycuda:7/cuda:8tests/test_hessian.py(the fifth site in the issue) already usescuda:0anda 2-device gate since #4787.
Regression guard
tests/test_device_index_gates_4768.pyfails if any of the four filesreintroduces a
device_count() <= Ngate withN > 0, atorch.device("cuda", N)/"cuda:N"literal withN > 0, orgpu_index = NwithN > 0.main: 4 failed.Evidence (1x GB10, sm_121)
ruff checkpasses on all five files.Closes #4768.