-
Notifications
You must be signed in to change notification settings - Fork 69
Energy profiling tools: NVML-based measurement tool #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Energy profiling tools: NVML-based measurement tool #301
Conversation
a642c0c to
eb99f1f
Compare
6332e5c to
2b6248c
Compare
2b6248c to
4f8fd2b
Compare
6517006 to
0ed10fc
Compare
- Implement NVMLProvider for GPU power monitoring. - Introduce PowerSampler for managing power sampling. - Update CMakeLists.txt to include new source files. - Enhance error logging and handling in timing utilities. - Add power data export functionality to CSV. - Integrate power sampling with existing energy profiling features.
…f log_error function
0ed10fc to
9b9e6f5
Compare
| # Check for NVML (required for energy profiler) | ||
| set(MIN_CUDA_VERSION 12.6) | ||
| find_package(CUDAToolkit ${MIN_CUDA_VERSION} QUIET) | ||
| if (CUDAToolkit_FOUND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you seen https://docs.nvidia.com/nsight-systems/UserGuide/index.html#nvml-power-and-temperature-metrics-preview ?
It would be great to actually better document this tool and compare it to what nsigh-systems may provide. Does your tool make anything special to help correlate Kokkos regions with consumption, trigger anything special ? Or is it "just" launching a thread that samples the energy consumption ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what about asynchronicity ? I mean:
{
Kokkos::Profiling::ScopeRegion region("my region");
Kokkos::parallel_for(Kokkos::RangePolicy(exec, 0, N), ...); // async
}If the tool reports the consumption of the my region region, if you're not Kokkos::fenceing, what is the meaning of the measurements reported by Kokkos Tools, especially when the kernel is actually running after the scoped region ends ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! I've seen this page one time but since I focused more on Variorum support at some point I haven't had the chance of reading it further. As of now, the tool is only launching a thread that samples the energy consumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what about asynchronicity ? I mean:
{ Kokkos::Profiling::ScopeRegion region("my region"); Kokkos::parallel_for(Kokkos::RangePolicy(exec, 0, N), ...); // async }If the tool reports the consumption of the my region region, if you're not
Kokkos::fenceing, what is the meaning of the measurements reported byKokkos Tools, especially when the kernel is actually running after the scoped region ends ?
For now, the system doesn't do anything special to correlate power consumption with a specific region or kernel. The timing system is meant to help visualize what the current situation is, so there's room for improvement (meaning adding more correlation using multiple metrics), especially since the daemon system would still allow for method/data propagation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romintomasetti we will check if Nsight does actually do something useful. It at least sounds like the exact same thing we are doing.
About the fencing: Nvidia at the moment allows power measurements every 100ms. But it seems to return only the power average of the last 25ms of that window, see http://arxiv.org/abs/2312.02741. Thus the tool will at the current state of Nvidas tools only be useful for measuring entire regions and even then it will need repetitions with shifts and post processing in order to get anything that is relatable to an algorithm. Due to these problems the tool currently does not require fencing, this should be done by the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be good to add the AMD tool to the mix:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on our ToDo list :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JBludau Do you still have plans to look at the AMD Profiling metrics, as mentioned above? Do you have updates you can share - particularly those that are pertinent to this PR - from your end?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr has been split into smaller ones to make it easier to review. Once we have these in, we can think about adding something for amd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not merge this PR without an example.
And I would be strongly against merging this one before we get proper Cuda testing, e.g. #271.
This PR adds NVML-based GPU energy monitoring to the Kokkos Energy Profiler:
Features:
NVMLProviderclass for GPU power monitoring with device discovery and power usage APIsPowerSamplerclass using daemon-based background monitoring for continuous power data collectionImplementation:
kp_energy_profiler(integrates timing + power monitoring)nvml_provider.cpp/hppfor GPU power monitoringpower_sampler.cpp/hppfor background sampling with daemonDependencies:
Usage:
The profiler automatically detects available GPUs and begins power monitoring during initialization. Power data is collected in the background and exported alongside timing data in CSV format.