#include <counters.hpp>
Classes | |
| struct | DavidsonTimingAccumulator |
Public Member Functions | |
| void | log_resident_checkpoint (const std::string &label) |
| void | log_resident_checkpoint_debug (const std::string &label) |
| std::uint64_t | peak_resident_bytes_now () |
| void | print_memory_summary () |
| Print the peak resident set, omitted when no platform source could be read. | |
| ResidentMemorySample | record_resident_memory () |
| void | release_unused_heap (const std::string &label) |
| void | reset () |
Static Public Member Functions | |
| static ProfilingCounters & | instance () |
Public Attributes | |
| std::atomic< long long > | davidson_iteration_count {0} |
| DavidsonTimingAccumulator | davidson_timing {} |
| std::atomic< long long > | fft_call_count {0} |
| std::atomic< long long > | hamiltonian_application_count {0} |
| std::atomic< std::uint64_t > | peak_resident_bytes {0} |
Definition at line 21 of file counters.hpp.
|
inlinestatic |
Definition at line 220 of file counters.hpp.
Referenced by q3::SerialFFTGrid::execute_forward_on_buffers(), q3::SerialPocketFFTGrid::execute_forward_on_buffers(), q3::SerialFFTGrid::execute_forward_on_slot(), q3::SerialFFTGrid::execute_inverse_raw_on_buffers(), q3::SerialPocketFFTGrid::execute_inverse_raw_on_buffers(), q3::SerialFFTGrid::execute_inverse_raw_on_slot(), q3::execution::PlanewaveExecutionPolicy::execution_record(), q3::SerialFFTGrid::forward(), q3::SerialPocketFFTGrid::forward(), q3::PlanewaveKohnShamSCFIterator::initialize_representation(), q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_single_particle_states(), q3::SerialFFTGrid::inverse(), q3::SerialPocketFFTGrid::inverse(), q3::SerialFFTGrid::inverse_raw(), q3::SerialPocketFFTGrid::inverse_raw(), q3::SerialFFTGrid::inverse_raw_on_slot(), main(), q3::KohnShamSCFIterator::perform_iteration(), q3::PlanewaveKohnShamSCFIterator::release_scf_workspace(), q3::PlanewaveKohnShamSCFIterator::report_convergence_details(), q3::SelfConsistentFieldFlavor::run_calculation(), q3::cli::run_gpu_entry_point(), q3::bindings::run_nscf(), q3::bindings::run_scf(), q3::bindings::SCFSolver::solve(), and q3::PlanewaveDavidsonDiagonalizer::solve().
|
inline |
Record a reading and log it against a phase label.
One line per allocating phase, at info, so that a run's own output says where its footprint came from. Phases that allocate nothing are not worth a probe; phases inside the Davidson loop log at debug instead, because there are as many of them as there are iterations.
Definition at line 152 of file counters.hpp.
References q3::ResidentMemorySample::available, q3::ResidentMemorySample::current_bytes, q3::ResidentMemorySample::format_gibibytes(), q3::log::info(), q3::ResidentMemorySample::peak_bytes, and record_resident_memory().
Referenced by q3::PlanewaveKohnShamSCFIterator::initialize_representation(), and q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_single_particle_states().
|
inline |
The same reading at debug level, for probes that fire per SCF iteration or per Davidson restart. The console sink is pinned at info, so these reach a –log-file and nothing else.
Definition at line 187 of file counters.hpp.
References q3::ResidentMemorySample::available, q3::ResidentMemorySample::current_bytes, q3::log::debug(), q3::ResidentMemorySample::format_gibibytes(), q3::ResidentMemorySample::peak_bytes, and record_resident_memory().
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_single_particle_states(), and q3::KohnShamSCFIterator::perform_iteration().
|
inline |
The peak so far, after one more reading. The counter only advances when something samples it, and the kernel's high-water mark is folded in at each sample, so a reader that wants the run's true peak – rather than the peak as of the last probe, which may predate the forces and stress – takes a fresh sample first. This is what the end-of-run reports use.
Definition at line 205 of file counters.hpp.
References peak_resident_bytes, and record_resident_memory().
Referenced by q3::execution::PlanewaveExecutionPolicy::execution_record(), main(), and print_memory_summary().
|
inline |
Print the peak resident set, omitted when no platform source could be read.
Definition at line 211 of file counters.hpp.
References q3::ResidentMemorySample::format_gibibytes(), q3::log::info(), and peak_resident_bytes_now().
|
inline |
Take a resident-memory reading and keep it if it is the largest so far.
Returns the sample so a caller that wants to log the current value does not have to read the platform source twice.
Definition at line 132 of file counters.hpp.
References q3::ResidentMemorySample::available, q3::ResidentMemorySample::current_bytes, q3::ResidentMemorySample::peak_bytes, peak_resident_bytes, and q3::ResidentMemorySample::sample().
Referenced by log_resident_checkpoint(), log_resident_checkpoint_debug(), peak_resident_bytes_now(), and release_unused_heap().
|
inline |
Return freed heap to the operating system and record the reading after it, at debug level. Placed at phase boundaries: the peak recorded before the release stands, the current figure afterwards is what the next phase builds on.
Definition at line 169 of file counters.hpp.
References q3::ResidentMemorySample::available, q3::ResidentMemorySample::current_bytes, q3::log::debug(), q3::ResidentMemorySample::format_gibibytes(), q3::ResidentMemorySample::peak_bytes, record_resident_memory(), and q3::release_unused_heap().
Referenced by q3::PlanewavePseudopotentialKohnShamSCFIterator::initialize_single_particle_states(), q3::KohnShamSCFIterator::perform_iteration(), and q3::PlanewaveKohnShamSCFIterator::release_scf_workspace().
|
inline |
Reset all profiling counters to zero.
Must be called by the nanobind module between successive in-process invocations (Mode B) to prevent counter accumulation across calls. Subprocess runs (Mode A) each get a fresh process, so reset() is unnecessary there.
Definition at line 233 of file counters.hpp.
References davidson_iteration_count, davidson_timing, fft_call_count, hamiltonian_application_count, peak_resident_bytes, and q3::ProfilingCounters::DavidsonTimingAccumulator::reset().
Referenced by q3::bindings::run_nscf(), q3::bindings::run_scf(), and q3::bindings::SCFSolver::solve().
| std::atomic<long long> q3::ProfilingCounters::davidson_iteration_count {0} |
Definition at line 23 of file counters.hpp.
Referenced by main(), reset(), and q3::PlanewaveDavidsonDiagonalizer::solve().
| DavidsonTimingAccumulator q3::ProfilingCounters::davidson_timing {} |
Definition at line 124 of file counters.hpp.
Referenced by main(), reset(), and q3::PlanewaveDavidsonDiagonalizer::solve().
| std::atomic<long long> q3::ProfilingCounters::fft_call_count {0} |
Definition at line 22 of file counters.hpp.
Referenced by q3::SerialFFTGrid::execute_forward_on_buffers(), q3::SerialPocketFFTGrid::execute_forward_on_buffers(), q3::SerialFFTGrid::execute_forward_on_slot(), q3::SerialFFTGrid::execute_inverse_raw_on_buffers(), q3::SerialPocketFFTGrid::execute_inverse_raw_on_buffers(), q3::SerialFFTGrid::execute_inverse_raw_on_slot(), q3::SerialFFTGrid::forward(), q3::SerialPocketFFTGrid::forward(), q3::SerialFFTGrid::inverse(), q3::SerialPocketFFTGrid::inverse(), q3::SerialFFTGrid::inverse_raw(), q3::SerialPocketFFTGrid::inverse_raw(), q3::SerialFFTGrid::inverse_raw_on_slot(), main(), and reset().
| std::atomic<long long> q3::ProfilingCounters::hamiltonian_application_count {0} |
Definition at line 24 of file counters.hpp.
| std::atomic<std::uint64_t> q3::ProfilingCounters::peak_resident_bytes {0} |
High-water mark of this rank's resident set, in bytes.
Sampled at the phase boundaries that allocate, so that the reported peak covers the setup spike and the first Davidson restart rather than whichever moment the run happened to end on.
Definition at line 33 of file counters.hpp.
Referenced by peak_resident_bytes_now(), record_resident_memory(), and reset().