scope_profiler.metadata
Collects descriptive metadata about the environment a profiling run executed in.
Metadata is gathered on every rank but only rank 0’s copy is persisted (see
ProfileManager.finalize), so it describes the run as a whole. Per-task
values such as SLURM_PROCID therefore reflect rank 0.
Attributes
| Name | Description |
|---|---|
METADATA_DETAILS | No description. |
MetadataValue | No description. |
Functions
| Name | Description |
|---|---|
check_metadata_detail | Return detail if it is a known level, else raise ValueError. |
collect_metadata | Gather metadata describing the current run's environment. |
count_nodes | Number of distinct hosts the ranks of comm run on. |
METADATA_DETAILSattributemodule attribute#
METADATA_DETAILS = ('minimal', 'full')MetadataValueattributemodule attribute#
MetadataValue = str | int | list[str]check_metadata_detailfunction#
def check_metadata_detail(detail: str) -> strReturn detail if it is a known level, else raise ValueError.
collect_metadatafunction#
def collect_metadata(mpi_size: int = 1, detail: str = 'minimal') -> dict[str, MetadataValue]Gather metadata describing the current run’s environment.
Parameters
mpi_size : int, optional
Number of MPI ranks the run was launched with (default: 1). Used to
derive total_cores (mpi_size * omp_num_threads), a single
combined parallelism value useful as a scaling-plot x-axis.
detail : {“minimal”, “full”}, optional
"minimal" (default) records only timestamp, platform,
chip_information, python_version, scope_profiler_version,
omp_num_threads, mpi_size, total_cores and, for a
single-process run, num_nodes (1): no user name,
host name (also part of uname), working directory, loaded
modules, environment variables or SLURM_* variables. "full"
records everything below.
Returns
dict
Mapping of metadata field name to a str, int or list-of-str value,
suitable for storing as HDF5 attributes. Derived fields use
lower-case names; captured environment variables keep their own
upper-case names (PATH, SLURM_JOB_ID, …) and are only
present when set.
count_nodesfunction#
def count_nodes(comm) -> intNumber of distinct hosts the ranks of comm run on.
Collective: every rank of comm must call it, and every rank gets the
same count back. One small allgather of host names, run once per
run, never per event.