Skip ENOENT for vram_str_path and sdma_str_path if files not created when passing some, but not all, GPUs to a docker image #194
+14
−14
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.
This PR is intended to resolve these issues where
rocm-smi --showpids
unexpectedly returns UNKNOWNs:ROCm/ROCm#3002
When running
rocm-smi --showpids
when a process does not have access to all GPUs (eg. in a docker image where some, but not all devices are passed through), GetProcessInfoForPID attempts to enumerate all GPUs on the host and search for vram/sdma/cu_occupancy data. In the VRAM example:So, we attempt to access file
proc_str_path/vram_{gpu_id}
for each gpu on the host (where rocm-smi is invoked). However, since the host and the monitored process have different perspectives on which GPUs exist, there is an inconsistency:The monitored process will only create vram_{gpu_id} files for the GPUs it thinks exists, while the host expects to see vram_{gpu_id} files for all GPUs. This results in host attempting to read nonexistent files and return early out of the loop with ENOENT.
This PR will ignore ENOENTs when enumerating vram_ and sdma_ files but still return early if other errors are encountered, instead of prematurely returning from the loop. A previous PR - #155 - has handled the case for cu_occupancy which may be absent due to device non-support.