imate.info#
- imate.info(print_only=True)#
Provides general information about hardware device, package version, and memory usage.
- Parameters:
- print_onlybool, default=True
It True, it prints the output. If False, it returns the output as a dictionary.
- Returns:
- info_dictdict
(Only if
print_onlyis False). A dictionary with the following keys:imate_version: str, the version of the imate package in the format"major_version.minor_version.patch_number".processor: str, the model name of the CPU processor.num_threads, int, number of CPU threads that are available and allocated to the user.gpu_name: str, model name of the GPU devices.num_gpu_devices: int, number of GPU devices in multi-GPU platforms.cuda_version: str, the version of CUDA Toolkit installed on the machine in the format"major_version.minor_version.patch_number".nvidia_driver: str, the version of NVIDIA graphic driver.mem_used: int, resident memory usage for the current Python process.mem_unit, str, the unit in whichmem_usedis reported. This can be"b"for Byte,"KB"for Kilo-Byte,"MB"for Mega-Byte,"GB"for Giga-Byte, and"TB"for Tera-Byte.
See also
Notes
CUDA Version:
In order to find CUDA Toolkit information properly, either of the environment variables
CUDA_HOME,CUDA_ROOT, orCUDA_PATHshould be set to the directory where CUDA Toolkit is installed. Usually on UNIX operating systems, this path is/usr/local/cuda. In this case, setCUDA_HOME(or any of the other variables mentioned in the above) as follows:export CUDA_HOME=/usr/local/cuda
To permanently set this variable, place the above line in
profilefile, such as in~/.bashrc, or~/.profile, and source this file, for instance bysource ~/.bashrc
If no CUDA Toolkit is installed, then the key
cuda_versionshows not found.Note
It is possible that the CUDA Toolkit is installed on the machine, but
cuda_versionkey shows not found. This is because the user did not set the environment variables mentioned in the above.GPU Devices:
If the key
gpu_nameshows not found, this is because eitherNo GPU device is detected on the machine.
GPU device exists, but NVIDIA graphic driver is not installed. See Install NVIDIA Graphic Driver for further details.
NVIDIA graphic driver is installed, but the executable
nvidia-smiis not available on the PATH`. To fix this, set the location of thenvidia-smiexecutable on thePATHvariable.
Memory:
The key
mem_usedshows the resident set size memory (RSS) on RAM hardware. The unit of the reported memory size can be found inmem_unit, which can bebfor Bytes,KBfor Kilo-Bytes,MBfor Mega-Bytes, and so on.Examples
Print information:
>>> from imate import info >>> info() imate version : 0.13.0 processor : Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz num threads : 8 gpu device : 'GeForce GTX 1080 Ti' num gpu devices : 4 cuda version : 11.2.0 nvidia driver : 460.84 process memory : 1.7 (Gb)
Return information as a dictionary:
>>> from imate import info >>> info_dict = info(print_only=False) >>> # Neatly print dictionary using pprint >>> from pprint import pprint >>> pprint(info_dict) { 'imate version': 0.13.0, 'processor': Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz, 'num threads': 8, 'gpu device': 'GeForce GTX 1080 Ti', 'num gpu devices': 4, 'cuda version': 11.2.0, 'nvidia driver': 460.84, 'process memory': 1.7 (Gb) }