|
| 1 | +import platform |
| 2 | +import os |
| 3 | +import subprocess |
| 4 | + |
| 5 | + |
| 6 | +def parse_nvidia_smi(): |
| 7 | + sp = subprocess.Popen( |
| 8 | + ["nvidia-smi", "-q"], stdout=subprocess.PIPE, stderr=subprocess.PIPE |
| 9 | + ) |
| 10 | + out_dict = dict() |
| 11 | + for item in sp.communicate()[0].decode("utf-8").split("\n"): |
| 12 | + if item.count(":") == 1: |
| 13 | + key, val = [i.strip() for i in item.split(":")] |
| 14 | + out_dict[key] = val |
| 15 | + return out_dict |
| 16 | + |
| 17 | + |
| 18 | +def print_diagnostics(): |
| 19 | + print("==========System==========") |
| 20 | + print(platform.platform()) |
| 21 | + os.system("cat /etc/lsb-release") |
| 22 | + |
| 23 | + print("==========Pytorch==========") |
| 24 | + try: |
| 25 | + import torch |
| 26 | + |
| 27 | + print(torch.__version__) |
| 28 | + print(f"torch.cuda.is_available(): {torch.cuda.is_available()}") |
| 29 | + except ImportError: |
| 30 | + print("torch not installed") |
| 31 | + |
| 32 | + print("==========NVIDIA-SMI==========") |
| 33 | + os.system("which nvidia-smi") |
| 34 | + for k, v in parse_nvidia_smi().items(): |
| 35 | + if "version" in k.lower(): |
| 36 | + print(k, v) |
| 37 | + |
| 38 | + print("==========NVCC==========") |
| 39 | + os.system("which nvcc") |
| 40 | + os.system("nvcc --version") |
| 41 | + |
| 42 | + print("==========CC==========") |
| 43 | + CC = "c++" |
| 44 | + if "CC" in os.environ or "CXX" in os.environ: |
| 45 | + # distutils only checks CC not CXX |
| 46 | + if "CXX" in os.environ: |
| 47 | + os.environ["CC"] = os.environ["CXX"] |
| 48 | + CC = os.environ["CXX"] |
| 49 | + else: |
| 50 | + CC = os.environ["CC"] |
| 51 | + print(f"CC={CC}") |
| 52 | + os.system(f"which {CC}") |
| 53 | + os.system(f"{CC} --version") |
| 54 | + |
| 55 | + print("==========MinkowskiEngine==========") |
| 56 | + try: |
| 57 | + import MinkowskiEngine as ME |
| 58 | + |
| 59 | + print(ME.__version__) |
| 60 | + print(f"MinkowskiEngine compiled with CUDA Support: {ME.is_cuda_available()}") |
| 61 | + print(f"NVCC version MinkowskiEngine is compiled: {ME.cuda_version()}") |
| 62 | + except ImportError: |
| 63 | + print("MinkowskiEngine not installed") |
| 64 | + |
| 65 | + |
| 66 | +if __name__ == "__main__": |
| 67 | + print_diagnostics() |
0 commit comments