()
| 5 | |
| 6 | |
| 7 | def collect_env(): |
| 8 | print("\n======== FedML (https://fedml.ai) ========") |
| 9 | print("FedML version: " + str(fedml.__version__)) |
| 10 | env_version = fedml.get_env_version() |
| 11 | print("FedML ENV version: " + str(env_version)) |
| 12 | |
| 13 | print("Execution path:" + str(os.path.abspath(fedml.__file__))) |
| 14 | |
| 15 | print("\n======== Running Environment ========") |
| 16 | import platform |
| 17 | |
| 18 | print("OS: " + platform.platform()) |
| 19 | print("Hardware: " + platform.machine()) |
| 20 | |
| 21 | import sys |
| 22 | |
| 23 | print("Python version: " + sys.version) |
| 24 | |
| 25 | try: |
| 26 | import torch |
| 27 | print("PyTorch version: " + torch.__version__) |
| 28 | except: |
| 29 | print("PyTorch is not installed properly") |
| 30 | |
| 31 | try: |
| 32 | from mpi4py import MPI |
| 33 | |
| 34 | print("MPI4py is installed") |
| 35 | except: |
| 36 | print("MPI4py is NOT installed") |
| 37 | |
| 38 | print("\n======== CPU Configuration ========") |
| 39 | |
| 40 | try: |
| 41 | import psutil |
| 42 | |
| 43 | # Getting loadover15 minutes |
| 44 | load1, load5, load15 = psutil.getloadavg() |
| 45 | cpu_usage = (load15 / os.cpu_count()) * 100 |
| 46 | |
| 47 | print("The CPU usage is : {:.0f}%".format(cpu_usage)) |
| 48 | print( |
| 49 | "Available CPU Memory: {:.1f} G / {}G".format( |
| 50 | psutil.virtual_memory().available / 1024 / 1024 / 1024, |
| 51 | psutil.virtual_memory().total / 1024 / 1024 / 1024, |
| 52 | ) |
| 53 | ) |
| 54 | except: |
| 55 | print("\n") |
| 56 | |
| 57 | try: |
| 58 | print("\n======== GPU Configuration ========") |
| 59 | import nvidia_smi |
| 60 | |
| 61 | nvidia_smi.nvmlInit() |
| 62 | handle = nvidia_smi.nvmlDeviceGetHandleByIndex(0) |
| 63 | info = nvidia_smi.nvmlDeviceGetMemoryInfo(handle) |
| 64 | print("NVIDIA GPU Info: " + str(handle)) |
no test coverage detected