Repository navigation
Conversation
An explicit `deviceid` at or beyond the number of devices (visible ones, if e.g. CUDA_VISIBLE_DEVICES is set) was silently ignored by the generated code, which then ran on the current device, while the memory query either raised IndexError (an off-by-one on the visible devices) or wrapped around them. Check it along with the other runtime arguments and raise an InvalidArgument naming the device and the number available
…is one The OpenACC runtime was initialized before selecting the device, so every rank not using the default device also created a context on it. And with no device found, the MPI device selection computed `rank % 0`
This was referenced Oct 16, 2026
This branch has not been deployed
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.
Stacked on #3066; the base switches to
mainonce that merges.deviceidat or beyond the number of devices (the visible ones if e.g.CUDA_VISIBLE_DEVICESis set) was ignored by the generated code, which ran on the current device; the memory query raisedIndexError(an off-by-one on the visible devices) or wrapped around them.DeviceID._arg_checknow raisesInvalidArgument: Device 2 does not exist: 2 device(s) available (CUDA_VISIBLE_DEVICES=0,1)before anything is launched. Tests:TestDeviceID::test_nonexistent_deviceid[None|0,1];test_deviceid_per_ranknow picks devices that exist on any node.nvidia-smion two H200s: odd ranks held contexts on both GPUs; after the fix one each). With no device found, the MPI default selection computedrank % 0, a SIGFPE with an OpenMP runtime reporting zero devices. Tests:test_gpu_openacc.py::TestCodeGeneration::test_init_acc_env;test_gpu_openmp.py::test_init_omp_env_w_mpiexpectation updated.Each test fails on the parent commit.
Coordination with #2930: this PR validates the device ID in
arguments(), so with both changes #2930'stest_no_visible_devicesraises insideop.arguments()(verified for the masks-1,''andNoDevFiles); that call needs to move insidepytest.raises. Whichever lands second rebases.Refs #2711, #2930. Out of scope, as follow-ups: visible-device lists naming devices the process cannot see (e.g. a container with
--gpus device=1andCUDA_VISIBLE_DEVICES=1), UUID/MIG masks, and validatingdeviceidinestimate_memory(). Does not close #2711.🤖 Generated with Claude Code