-
Notifications
You must be signed in to change notification settings - Fork 1
Add Cray/HPE pm_counters backend with cross-vendor GPU correlation hints #9
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
Draft
vancraar
wants to merge
7
commits into
develop
Choose a base branch
from
feature/cray-pm-counters
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ddce65
add Cray/HPE pm_counters hardware sampler backend
vancraar c19c7bc
add cross-vendor accel[i] <-> GPU correlation hints to pm_counters
vancraar 92a4104
fix system_hardware_sampler::dump_yaml to include correlation hints
vancraar 1884d03
fix turbostat subprocess deadlock and unreliable short sampling inter…
vancraar a029bd0
fix ROCm SMI device index resolution under device visibility masking
vancraar 6c36a23
Merge turbostat subprocess deadlock and interval jitter fix
vancraar 4b6bac1
add Python bindings for the Cray pm_counters backend
vancraar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,14 +35,14 @@ To download the hardware sampling use: | |
|
|
||
| ```bash | ||
| git clone git@github.com:SC-SGS/hardware_sampling.git | ||
| cd hardware_sampling | ||
| cd hardware_sampling | ||
| ``` | ||
|
|
||
| Building the library can be done using the normal CMake approach: | ||
|
|
||
| ```bash | ||
| mkdir build && cd build | ||
| cmake -DCMAKE_BUILD_TYPE=Release [optional_options] .. | ||
| mkdir build && cd build | ||
| cmake -DCMAKE_BUILD_TYPE=Release [optional_options] .. | ||
| cmake --build . -j | ||
| ``` | ||
|
|
||
|
|
@@ -73,6 +73,18 @@ The `[optional_options]` can be one or multiple of: | |
| - `HWS_ENABLE_ERROR_CHECKS=ON|OFF` (default: `OFF`): enable sanity checks during hardware sampling, may be problematic | ||
| with smaller sample intervals | ||
| - `HWS_SAMPLING_INTERVAL=100ms` (default: `100ms`): set the sampling interval in milliseconds | ||
|
|
||
| - `HWS_TURBOSTAT_INTERVAL=1` (default: `0.001`, kept for backwards compatibility): set the interval in | ||
| seconds (`"sec.subsec"`) that `turbostat` itself measures over for a single CPU power/frequency sample | ||
| (passed directly to `turbostat`'s own `-i` flag). | ||
| **Important:** very short values have been observed to produce | ||
| physically implausible readings (multi-kW package power, multi-GHz core clocks) on heavily loaded, | ||
| many-core machines, especially with older `turbostat` builds. | ||
| **Note:** if this value is larger than `HWS_SAMPLING_INTERVAL`, the `turbostat` backend dominates and | ||
| the achieved CPU sampling cadence will be closer to `HWS_TURBOSTAT_INTERVAL` than to | ||
| `HWS_SAMPLING_INTERVAL` -- a warning is printed at runtime (once per `cpu_hardware_sampler` instance) | ||
| if this is the case. | ||
|
|
||
| - `HWS_ENABLE_PYTHON_BINDINGS=ON|OFF` (default: `ON`): enable Python bindings | ||
|
|
||
| - `HWS_ENABLE_MPI_SUPPORT=ON|OFF|AUTO` (default: `AUTO`): | ||
|
|
@@ -227,7 +239,7 @@ current clock frequencies, temperatures, or memory consumption. | |
| | sample | sample type | CPUs | NVIDIA GPUs | AMD GPUs | Intel GPUs | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this table should also be updated. |
||
| |:------------------------|:-----------:|:----:|:-----------:|:--------:|:----------:| | ||
| | num_fans | fixed | - | int | int | int | | ||
| | fan_speed_min | fixed | - | % | - | - | | ||
| | fan_speed_min | fixed | - | % | - | - | | ||
| | fan_speed_max | fixed | - | % | RPM | RPM | | ||
| | temperature_min | fixed | - | - | °C | - | | ||
| | temperature_max | fixed | - | °C | °C | °C | | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /** | ||
| * @author Alexander Van Craen | ||
| * @copyright 2024-today All Rights Reserved | ||
| * @license This file is released under the MIT license. | ||
| * See the LICENSE.md file in the project root for full license information. | ||
| */ | ||
|
|
||
| #include "hws/cray_pm_counters/hardware_sampler.hpp" // hws::cray_pm_counters_hardware_sampler | ||
| #include "hws/cray_pm_counters/pm_counters_samples.hpp" // hws::{cray_pm_counters_general_samples, cray_pm_counters_power_samples} | ||
| #include "hws/hardware_sampler.hpp" // hws::hardware_sampler | ||
| #include "hws/sample_category.hpp" // hws::sample_category | ||
|
|
||
| #include "fmt/format.h" // fmt::format | ||
| #include "pybind11/chrono.h" // automatic bindings for std::chrono::milliseconds | ||
| #include "pybind11/pybind11.h" // py::module_ | ||
| #include "pybind11/stl.h" // bind STL types | ||
|
|
||
| #include <chrono> // std::chrono::milliseconds | ||
|
|
||
| namespace py = pybind11; | ||
|
|
||
| void init_cray_pm_counters_hardware_sampler(py::module_ &m) { | ||
| // bind the general samples | ||
| py::class_<hws::cray_pm_counters_general_samples>(m, "CrayPmCountersGeneralSamples") | ||
| .def("has_samples", &hws::cray_pm_counters_general_samples::has_samples, "true if any sample is available, false otherwise") | ||
| .def("get_metadata", &hws::cray_pm_counters_general_samples::get_metadata, "the dynamically discovered, non-energy, non-power pm_counters metadata entries (e.g. version, generation, raw_scan_hz, freshness), keyed by file name") | ||
| .def("__repr__", [](const hws::cray_pm_counters_general_samples &self) { | ||
| return fmt::format("<HardwareSampling.CrayPmCountersGeneralSamples with\n{}\n>", self); | ||
| }); | ||
|
|
||
| // bind the power samples | ||
| py::class_<hws::cray_pm_counters_power_samples>(m, "CrayPmCountersPowerSamples") | ||
| .def("has_samples", &hws::cray_pm_counters_power_samples::has_samples, "true if any sample is available, false otherwise") | ||
| .def("get_energy_counters", &hws::cray_pm_counters_power_samples::get_energy_counters, "the dynamically discovered measured energy counters in J (cumulative), keyed by file name, e.g. 'energy' (whole node) or 'accel0_energy' (per accelerator)") | ||
| .def("get_power_counters", &hws::cray_pm_counters_power_samples::get_power_counters, "the dynamically discovered measured power counters in W (instantaneous), keyed by file name, e.g. 'power' (whole node) or 'accel0_power' (per accelerator)") | ||
| .def("get_energy_timestamps_us", &hws::cray_pm_counters_power_samples::get_energy_timestamps_us, "per-sample HSS latch timestamp for the energy counters, in us (PM counters v3+ only)") | ||
| .def("get_power_timestamps_us", &hws::cray_pm_counters_power_samples::get_power_timestamps_us, "per-sample HSS latch timestamp for the power counters, in us (PM counters v3+ only)") | ||
| .def("__repr__", [](const hws::cray_pm_counters_power_samples &self) { | ||
| return fmt::format("<HardwareSampling.CrayPmCountersPowerSamples with\n{}\n>", self); | ||
| }); | ||
|
|
||
| // bind the Cray pm_counters hardware sampler class | ||
| py::class_<hws::cray_pm_counters_hardware_sampler, hws::hardware_sampler>(m, "CrayPmCountersHardwareSampler") | ||
| .def(py::init<>(), "construct a new Cray pm_counters hardware sampler with the default sampling interval") | ||
| .def(py::init<hws::sample_category>(), "construct a new Cray pm_counters hardware sampler with the default sampling interval sampling only the provided sample_category samples") | ||
| .def(py::init<std::chrono::milliseconds>(), "construct a new Cray pm_counters hardware sampler with the specified sampling interval") | ||
| .def(py::init<std::chrono::milliseconds, hws::sample_category>(), "construct a new Cray pm_counters hardware sampler with the specified sampling interval sampling only the provided sample_category samples") | ||
| .def("general_samples", &hws::cray_pm_counters_hardware_sampler::general_samples, "get all general samples") | ||
| .def("power_samples", &hws::cray_pm_counters_hardware_sampler::power_samples, "get all power related samples") | ||
| .def("discovered_accel_indices", &hws::cray_pm_counters_hardware_sampler::discovered_accel_indices, "the accelerator indices pm_counters actually exposed on this node, derived from the already-sampled accel<N>_energy counter keys") | ||
| .def("samples_only_as_yaml_string", &hws::cray_pm_counters_hardware_sampler::samples_only_as_yaml_string, "return all hardware samples as YAML string") | ||
| .def("__repr__", [](const hws::cray_pm_counters_hardware_sampler &self) { | ||
| return fmt::format("<HardwareSampling.CrayPmCountersHardwareSampler with\n{}\n>", self); | ||
| }); | ||
| } |
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
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
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
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
Oops, something went wrong.
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.
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.
Please document new dependency.