PAOFLOW.sparse.log#
Dedicated log file for the sparse backend.
Sparse diagnostics — bond-list statistics, truncation bounds, solver
dispatch (including whether a k-point solve is routed to the dense
branch), memory projections and progress — are written to sparse.log
in the PAOFLOW output directory rather than to stdout. That keeps the
standard output of a sparse run identical in kind to a dense one (module
timings and warnings only), while giving the sparse-specific numbers more
room than a single line each.
Only rank 0 writes; every other rank gets a no-op object, so call sites need no rank guard.
Classes#
Append-only text log for one sparse run. |
Functions#
|
Return the run's log, creating (and truncating) it on first use. |
Module Contents#
- class PAOFLOW.sparse.log.SparseLog(path)[source]#
Append-only text log for one sparse run.
- Parameters:
path (str) – Destination file. It is truncated on construction, so one
SparseLogcorresponds to one run.- Variables:
path (str) – The file being appended to.
Notes
The file is reopened and closed around every write rather than held open for the lifetime of the run. A sparse run is long (hours of k-point loops) and its most interesting failure mode — an out-of-memory kill during doubling — gives no opportunity to flush buffers, so the log has to be complete and readable at every instant. Writes are rare (a handful per property, plus progress lines every few percent of the k-loop), so the cost of reopening is negligible next to a single eigensolve.
- PAOFLOW.sparse.log.get_sparse_log(data_controller, fname='sparse.log')[source]#
Return the run’s log, creating (and truncating) it on first use.
- Parameters:
data_controller (DataController) – Run state; supplies the output directory and the MPI rank, and carries the cached log object.
fname (str, optional) – Log file name inside the output directory.
- Returns:
The shared logger on rank 0, a silent stand-in elsewhere.
- Return type:
SparseLog or _NullLog
Notes
The logger is cached as an attribute of the
data_controller, which is the one object every sparse stage already holds, so all stages of a run append to a single file instead of each truncating its own. The caching also makes the truncation happen exactly once: the first caller of the run creates the file, every later caller gets the same handle.