MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / collect_env_info

Function collect_env_info

tensorpack/tfutils/collect_env.py:39–119  ·  view source on GitHub ↗

Returns: str - a table contains important information about the environment

()

Source from the content-addressed store, hash-verified

37
38
39def collect_env_info():
40 """
41 Returns:
42 str - a table contains important information about the environment
43 """
44 data = []
45 data.append(("sys.platform", sys.platform))
46 data.append(("Python", sys.version.replace("\n", "")))
47 data.append(("Tensorpack", __git_version__ + " @" + os.path.dirname(tensorpack.__file__)))
48 data.append(("Numpy", np.__version__))
49
50 data.append(("TensorFlow", tfv1.VERSION + "/" + tfv1.GIT_VERSION + " @" + os.path.dirname(tf.__file__)))
51 data.append(("TF Compiler Version", tfv1.COMPILER_VERSION))
52 has_cuda = tf.test.is_built_with_cuda()
53 data.append(("TF CUDA support", has_cuda))
54
55 try:
56 from tensorflow.python.framework import test_util
57 data.append(("TF MKL support", test_util.IsMklEnabled()))
58 except Exception:
59 pass
60
61 try:
62 from tensorflow.python.framework import test_util
63 data.append(("TF XLA support", test_util.is_xla_enabled()))
64 except Exception:
65 pass
66
67 if has_cuda:
68 data.append(("Nvidia Driver", find_library("nvidia-ml")))
69 data.append(("CUDA libs", find_library("cudart")))
70 data.append(("CUDNN libs", find_library("cudnn")))
71 for k, v in parse_TF_build_info().items():
72 data.append((k, v))
73 data.append(("NCCL libs", find_library("nccl")))
74
75 # List devices with NVML
76 data.append(
77 ("CUDA_VISIBLE_DEVICES",
78 os.environ.get("CUDA_VISIBLE_DEVICES", "Unspecified")))
79 try:
80 devs = defaultdict(list)
81 with NVMLContext() as ctx:
82 for idx, dev in enumerate(ctx.devices()):
83 devs[dev.name()].append(str(idx))
84
85 for devname, devids in devs.items():
86 data.append(
87 ("GPU " + ",".join(devids), devname))
88 except Exception:
89 data.append(("GPU", "Not found with NVML"))
90
91 vram = psutil.virtual_memory()
92 data.append(("Free RAM", "{:.2f}/{:.2f} GB".format(vram.available / 1024**3, vram.total / 1024**3)))
93 data.append(("CPU Count", psutil.cpu_count()))
94
95 # Other important dependencies:
96 try:

Callers 2

train.pyFile · 0.90
collect_env.pyFile · 0.85

Calls 8

parse_TF_build_infoFunction · 0.85
NVMLContextClass · 0.85
appendMethod · 0.80
devicesMethod · 0.80
joinMethod · 0.80
formatMethod · 0.80
getMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…