espnet3.utils.logging_utils.log_env_metadata
espnet3.utils.logging_utils.log_env_metadata
espnet3.utils.logging_utils.log_env_metadata(logger: Logger, cluster_prefixes: Iterable[str] | None = None, runtime_prefixes: Iterable[str] | None = None, runtime_keys: Iterable[str] | None = None) → None
Log selected cluster and runtime environment variables.
The output includes two blocks: : - Cluster environment variables (scheduler/runtime IDs).
- Runtime environment variables (CUDA/NCCL/OMP/PATH, etc.).
Environment variables collected by default:
Cluster prefixes: | Prefix | Purpose |
|-----------|——————————————————| | SLURM_ | Slurm job/step metadata (job id, task id, node info) | | PBS_ | PBS/Torque job metadata | | LSF_ | LSF job metadata | | SGE_ | SGE job metadata | | COBALT_ | Cobalt job metadata | | OMPI_ | Open MPI runtime metadata | | PMI_ | PMI (Process Management Interface) metadata | | MPI_ | MPI runtime metadata (generic prefix) |
Runtime prefixes: | Prefix | Purpose |
|-------------|————————————-| | NCCL_ | NCCL configuration (multi-GPU comms)| | CUDA_ | CUDA runtime configuration | | ROCM_ | ROCm runtime configuration | | OMP_ | OpenMP threading configuration | | MKL_ | Intel MKL configuration | | OPENBLAS_ | OpenBLAS configuration | | UCX_ | UCX communication configuration | | NVIDIA_ | NVIDIA runtime configuration |
Explicit runtime keys: | Key | Purpose |
|-----------------------|———————————-| | PATH | Executable search path | | PYTHONPATH | Python module search path | | LD_LIBRARY_PATH | Shared library search path | | CUDA_VISIBLE_DEVICES`| GPU visibility mask | | `RANK | Global rank (distributed) | | LOCAL_RANK | Local rank on node | | NODE_RANK | Node rank in job | | WORLD_SIZE | Total process count | | MASTER_ADDR | Distributed master address | | MASTER_PORT | Distributed master port |
Example usage: : ``` ``
<br/>`
<br/>
python
from pathlib import Path
from espnet3.utils.logging_utils import configure_logging, log_env_metadata
<br/>
logger = configure_logging(log_dir=Path(“exp/run1”))
log_env_metadata(logger)
<br/>``
<br/>`
Example log output:
: ```
``<br/> ` [hostname] 2026-02-11 03:57:17 EST (run.py:256) INFO: [train] Cluster env: <br/>
SLURM_JOB_ID=6335268 <br/> [hostname] 2026-02-11 03:57:17 EST (run.py:256) INFO: [train] Runtime env: : CUDA_VISIBLE_DEVICES=0 NCCL_DEBUG=INFO PATH=/usr/local/bin:/usr/bin:… <br/>
``<br/>
`- Parameters:
- logger (logging.Logger) – Logger used to emit metadata.
- cluster_prefixes (Iterable *[*str ] | None) – Prefixes for cluster variables.
- runtime_prefixes (Iterable *[*str ] | None) – Prefixes for runtime variables.
- runtime_keys (Iterable *[*str ] | None) – Explicit runtime keys to include.
- Returns: None
Example
>>> import logging
>>> log_env_metadata(logging.getLogger("espnet3"))