File size: 1,588 Bytes
1f88cea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/usr/bin/env python3
"""Report core OneScience/DTK and BoltzGen dependency versions."""
from __future__ import annotations
import importlib
import sys
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "model"))
def package_version(distribution: str) -> str:
try:
return version(distribution)
except PackageNotFoundError:
return "NOT INSTALLED"
def main() -> int:
print("python:", sys.version.split()[0])
try:
import torch
print("torch:", torch.__version__)
print("HIP:", torch.version.hip)
print("DCU available:", torch.cuda.is_available())
print("device count:", torch.cuda.device_count())
if torch.cuda.is_available() and torch.cuda.device_count():
print("device 0:", torch.cuda.get_device_name(0))
except Exception as exc: # noqa: BLE001
print("torch check failed:", repr(exc))
return 1
for distribution in (
"pytorch-lightning", "torchmetrics", "hydra-core", "omegaconf",
"biotite", "gemmi", "mashumaro", "einx", "hydride", "pydssp",
"logomaker", "frozendict",
):
print(f"{distribution}:", package_version(distribution))
try:
importlib.import_module("boltzgen.cli.boltzgen")
print("boltzgen import: OK")
except Exception as exc: # noqa: BLE001
print("boltzgen import failed:", repr(exc))
return 1
return 0
if __name__ == "__main__":
raise SystemExit(main())
|