#!/usr/bin/env python3
"""Print runtime environment info for reproducibility."""

import sys


def main():
    print(f"python: {sys.executable}")
    print(f"python_version: {sys.version.split()[0]}")

    try:
        import torch

        print(f"torch: {torch.__version__}")
        print(f"cuda_available: {torch.cuda.is_available()}")
        print(f"gpu_count: {torch.cuda.device_count()}")
        if torch.cuda.is_available():
            for i in range(torch.cuda.device_count()):
                mem = torch.cuda.get_device_properties(i).total_memory / (1024**3)
                print(f"gpu_{i}: {torch.cuda.get_device_name(i)} ({mem:.0f} GB)")
    except ImportError:
        print("torch: NOT INSTALLED")

    try:
        import nemo

        print(f"nemo: {nemo.__version__}")
    except ImportError:
        print("nemo: NOT INSTALLED")


if __name__ == "__main__":
    main()
