Repository navigation
Make statistics a mandatory arg for statistics providers #1017
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
Changes from 5 commits
9445b50
2d93022
a6803e6
891af67
2ce411f
36cd37a
2eca536
9ae3d1c
9f0c309
5659dc0
4e0d47c
bdda47a
37ff748
78d8a04
ab50f50
30df058
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,7 +324,8 @@ int main(int argc, char** argv) { | |
|
|
||
| // Initialize configuration options from environment variables. | ||
| rapidsmpf::config::Options options{rapidsmpf::config::get_environment_variables()}; | ||
| auto progress_thread = std::make_shared<rapidsmpf::ProgressThread>(); | ||
| auto stats = rapidsmpf::Statistics::from_options(options); | ||
| auto progress_thread = std::make_shared<rapidsmpf::ProgressThread>(stats); | ||
|
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. This changes the existing behavior, I think unintentionally, from statistics being enabled by default to disabled by default. As is, users now require specifying
Contributor
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 think all benchmarks should have enabled statistics. So yes, I think you should |
||
|
|
||
| std::shared_ptr<rapidsmpf::Communicator> comm; | ||
| if (args.comm_type == "mpi") { | ||
|
|
@@ -364,20 +365,11 @@ int main(int argc, char** argv) { | |
| memory_limits[rapidsmpf::MemoryType::DEVICE] = args.device_mem_limit_mb << 20; | ||
| } | ||
|
|
||
| auto stats = rapidsmpf::Statistics::create(); | ||
|
|
||
| auto pinned_mr = args.pinned_mem_disable | ||
| ? rapidsmpf::PinnedMemoryResource::Disabled | ||
| : rapidsmpf::PinnedMemoryResource::make_if_available(); | ||
| auto br = std::make_shared<rapidsmpf::BufferResource>( | ||
| stat_enabled_mr, | ||
| pinned_mr, | ||
| std::move(memory_limits), | ||
| std::nullopt, | ||
| std::make_shared<rmm::cuda_stream_pool>( | ||
| 16, rmm::cuda_stream::flags::non_blocking | ||
| ), | ||
| stats | ||
| stats, stat_enabled_mr, pinned_mr, std::move(memory_limits) | ||
|
nirandaperera marked this conversation as resolved.
Resolved
|
||
| ); | ||
|
|
||
| auto& log = *comm->logger(); | ||
|
|
@@ -411,7 +403,7 @@ int main(int argc, char** argv) { | |
| for (std::uint64_t i = 0; i < total_num_runs; ++i) { | ||
| // Clear statistics before the last run so only the final run is reported. | ||
| if (i == total_num_runs - 1) { | ||
| ctx->statistics()->clear(); | ||
| stats->clear(); | ||
| } | ||
|
Contributor
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. Does the
Contributor
Author
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. It does, but its the same as |
||
| double const elapsed = run(ctx, comm, args, stream).count(); | ||
| std::stringstream ss; | ||
|
|
@@ -460,13 +452,13 @@ int main(int argc, char** argv) { | |
|
|
||
| auto statistics = ctx->statistics(); | ||
|
nirandaperera marked this conversation as resolved.
Resolved
|
||
| if (args.enable_memory_profiler) { | ||
| log.print(statistics->report({ | ||
| log.print(stats->report({ | ||
| .mr = stat_enabled_mr, | ||
| .pinned_mr = pinned_mr, | ||
| .header = "Statistics (of the last run):", | ||
| })); | ||
| } else { | ||
| log.print(statistics->report({.header = "Statistics (of the last run):"})); | ||
| log.print(stats->report({.header = "Statistics (of the last run):"})); | ||
| } | ||
|
|
||
| if (!use_bootstrap) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,24 @@ class Statistics : public std::enable_shared_from_this<Statistics> { | |
| */ | ||
| static std::shared_ptr<Statistics> from_options(config::Options options); | ||
|
|
||
| /** | ||
| * @brief Resets the current state of this instance based on @p new_options. | ||
| * | ||
| * @warning Live `MemoryRecorder` instances (constructed before this call | ||
| * but not yet destroyed) are *not* tracked. Their destructors will run | ||
| * after the reset and publish their scope into the freshly cleared | ||
| * `memory_records_` map, mixing pre-reset measurements into the new | ||
| * session. Likewise, a `StreamOrderedTiming` whose stop callback is | ||
| * already mid-execution at reset time may still record one stale stat | ||
| * (its global-map entry was extracted before `cancel_inflight_timings` | ||
| * could remove it). Callers that need clean boundaries must quiesce | ||
| * recorders and synchronise the relevant CUDA streams before calling. | ||
| * | ||
| * @param new_options Configuration options whose `"statistics"` field | ||
| * controls the new enabled state. | ||
| */ | ||
| void reset_from_options(config::Options new_options); | ||
|
|
||
|
Contributor
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. What do you need this for?
Contributor
Author
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. @wence- In cudf-polars engines, there is a
Contributor
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. But why do we need to reset the statistics in this setup? When is What do we actually need to achieve here? It seems like we want to zero the statistics object that we have around no?
Contributor
Author
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 was looking into two options.
I think 1. is the safer option.
Contributor
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. That is the mechanism for how to reset stats. I am asking a different question: why do we want to reset stats?
Contributor
Author
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 think this stems from
Contributor
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. OK, I think we have enough rope with
Contributor
Author
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. okay. Let's do that.
Contributor
Author
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 felt
Contributor
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. ah, but that problem can be fixed (separately) by clearing memory records |
||
| ~Statistics() noexcept; | ||
|
|
||
| // `Statistics` is owned exclusively through `std::shared_ptr`. Use | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.