"""Verbosity utilities for scimba_torch."""importtorchfromscimba_common.versionimport__version__SCIMBA_IS_VERBOSE=False
[docs]defprint_torch_setting()->None:"""Print torch device and default floating point format."""print(f"torch device: {torch.get_default_device()}")print(f"torch floating point format: {torch.get_default_dtype()}")iftorch.cuda.is_available():print(f"cuda devices: {torch.cuda.device_count()}")print(f"cuda current device: {torch.cuda.current_device()}")print(f"cuda device name: {torch.cuda.get_device_name(0)}")
[docs]defget_verbosity()->bool:"""Get the verbosity level of scimba. Returns: the current verbosity. """returnSCIMBA_IS_VERBOSE
[docs]defset_verbosity(verbose:bool)->None:"""Set the verbosity level of scimba. Args: verbose: the wanted verbosity """globalSCIMBA_IS_VERBOSESCIMBA_IS_VERBOSE=verbose# DEPRECATED: this was to avoid a circular import which does no happen# now that __version__ has been moved in scimba_common/version# init_path = Path(__file__).parent.parent.parent / "scimba_common/version.py"# version = _get_version_from_init(init_path)ifSCIMBA_IS_VERBOSE:print(f"\n/////////////// Scimba {__version__} ////////////////")print_torch_setting()print("\n")