gigantum
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: gigantum | ||
| Version: 1.3.2 | ||
| Version: 1.3.4 | ||
| Summary: CLI for the Gigantum Client | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/gigantum/gigantum-cli |
| # Gigantum CLI Version | ||
| __version__ = "1.3.2" | ||
| __version__ = "1.3.4" |
@@ -17,3 +17,3 @@ import platform | ||
| from gigantumcli.config import ConfigOverrideFile | ||
| from gigantumcli.utilities import ask_question, is_running_as_admin, get_nvidia_driver_version | ||
| from gigantumcli.utilities import ask_question, is_running_as_admin, get_nvidia_gpu_info, get_nvidia_smi_path | ||
@@ -190,5 +190,16 @@ # We can disable this because requests is just being used to verify API connectivity | ||
| # For anything else, just use default mode. | ||
| driver_version, num_gpus = get_nvidia_gpu_info() | ||
| environment_mapping = {'HOST_WORK_DIR': working_dir, | ||
| 'LOCAL_USER_ID': os.getuid(), | ||
| 'NVIDIA_DRIVER_VERSION': get_nvidia_driver_version()} | ||
| 'NVIDIA_DRIVER_VERSION': driver_version} | ||
| if driver_version: | ||
| print(f"Detected {num_gpus} GPU(s) available for use.") | ||
| environment_mapping['NVIDIA_NUM_GPUS'] = num_gpus | ||
| # Mount nvidia-smi as read-only if present | ||
| smi_path = get_nvidia_smi_path() | ||
| if smi_path: | ||
| environment_mapping['NVIDIA_SMI_PATH'] = smi_path | ||
| volume_mapping[working_dir] = {'bind': '/mnt/gigantum', 'mode': 'rw'} | ||
@@ -195,0 +206,0 @@ |
| from __future__ import print_function | ||
| from six.moves import input | ||
| from typing import Optional | ||
| from typing import Optional, Tuple | ||
| import ctypes | ||
@@ -8,2 +8,3 @@ import os | ||
| import subprocess | ||
| import shlex | ||
| import re | ||
@@ -51,4 +52,14 @@ import click | ||
| def get_nvidia_driver_version() -> Optional[str]: | ||
| def get_nvidia_gpu_info() -> Tuple[Optional[str], int]: | ||
| """Method to get the driver version and number of GPUs available | ||
| Notes: | ||
| - If drivers aren't installed, the driver version is set to None | ||
| - If the driver version has major.minor.revision, only major.minor is returned | ||
| Returns: | ||
| driver version, number of GPUs | ||
| """ | ||
| driver_version = None | ||
| num_gpus = 0 | ||
| if platform.system() == 'Linux': | ||
@@ -60,5 +71,5 @@ try: | ||
| if not error: | ||
| m = re.match(r"([\d.]+)", output.decode()) | ||
| m = re.findall(r"([\d.]+)", output.decode()) | ||
| if m: | ||
| driver_version = m.group(0) | ||
| driver_version = m[0] | ||
@@ -80,3 +91,3 @@ if driver_version is None: | ||
| click.echo() | ||
| return driver_version | ||
| return driver_version, num_gpus | ||
@@ -86,5 +97,31 @@ # If driver has a build version, strip it because we don't match on that. | ||
| driver_version = f"{parts[0]}.{parts[1]}" | ||
| num_gpus = len(m) | ||
| except FileNotFoundError: | ||
| pass | ||
| return driver_version | ||
| return driver_version, num_gpus | ||
| def get_nvidia_smi_path() -> Optional[str]: | ||
| """Function to look for the nvidia-smi binary | ||
| This is then provided to the Client and is used when launching GPU enabled projects with the "new" Docker | ||
| launch configuration that does not use the nvidia runtime. | ||
| Returns: | ||
| absolute path to the nvidia-smi binary if it exists. | ||
| """ | ||
| nvidia_smi_path = None | ||
| if platform.system() == 'Linux': | ||
| try: | ||
| process = subprocess.Popen(['which', 'nvidia-smi'], stdout=subprocess.PIPE) | ||
| output, error = process.communicate() | ||
| if not error: | ||
| result = output.decode().strip() | ||
| if result.endswith('nvidia-smi'): | ||
| nvidia_smi_path = result | ||
| except: | ||
| # If we can't find nvidia-smi just continue on | ||
| pass | ||
| return nvidia_smi_path |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: gigantum | ||
| Version: 1.3.2 | ||
| Version: 1.3.4 | ||
| Summary: CLI for the Gigantum Client | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/gigantum/gigantum-cli |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
128327
1.31%1858
2.09%