Fix SM utilization reporting for forked CUDA worker processes#199
Open
lyquid617 wants to merge 2 commits into
Open
Fix SM utilization reporting for forked CUDA worker processes#199lyquid617 wants to merge 2 commits into
lyquid617 wants to merge 2 commits into
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lyquid617 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
|
Welcome @lyquid617! It looks like this is your first PR to Project-HAMi/HAMi-core 🎉 |
Member
|
thanks for the fix, please sign-off your commit |
Signed-off-by: lyquid <l000064@lassoquant.com>
Signed-off-by: lyquid <l000064@lassoquant.com>
Author
fixed |
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.
Problem
For Python multiprocessing workloads using HAMi-core,
Device_utilization_desc_of_containermay stay at 0 even when GPU processes are actively running.In the affected workload:
nvidia-smi pmoninside the container reports ~97% SM utilization per worker process.nvmlDeviceGetProcessUtilizationinside the container returns correct per-process samples.vGPU_device_memory_usage_in_bytesis updated correctly.Device_utilization_desc_of_containerremains 0.last_kernel_time, butdevice_util[].sm_utilstays 0.Root Cause
postInit()starts the utilization watcher viainit_utilization_watcher(), but it is guarded bypthread_once(post_cuinit_flag)and is only reliably triggered through thecuInit()wrapper.For forked Python multiprocessing workers, the child process may inherit a completed
post_cuinit_flagfrom the parent. Later CUDA kernel launches in the worker call the hooked launch path, butpostInit()is skipped, so host PID detection and utilization watcher initialization never happen in the worker process.There is also an existing multi-GPU bug in
init_gpu_device_utilization(): the inner loop breaks after device 0, so only the first device is reset. See#148Fix
ensure_post_init()and call it from kernel launch wrappers.post_cuinit_flagandpidfoundin the child process after fork.breakininit_gpu_device_utilization().Validation
Tested with an 8-GPU Python multiprocessing workload:
Before:
nvidia-smi pmon: ~97% SM utilizationDevice_utilization_desc_of_container: 0After:
Device_utilization_desc_of_container: 97-98 per GPU