• This repository has been archived on 30/Jun/2024
  • Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    Python
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python 3 Bindings for the NVIDIA Management Library
======
pyNVML
======

***
Patched to support Python 3 (and Python 2)
***

------------------------------------------------
Python bindings to the NVIDIA Management Library
------------------------------------------------

Provides a Python interface to GPU management and monitoring functions.

This is a wrapper around the NVML library.
For information about the NVML library, see the NVML developer page
http://developer.nvidia.com/nvidia-management-library-nvml

Download the latest package from:
https://pypi.python.org/pypi/nvidia-ml-py3

Note this file can be run with 'python -m doctest -v README.txt'
although the results are system dependent

REQUIRES
--------
Python 2.5, or an earlier version with the ctypes module.

INSTALLATION
------------

    sudo python setup.py install

or

    pip install nvidia-ml-py3

USAGE
-----

    >>> from pynvml import *
    >>> nvmlInit()
    >>> print "Driver Version:", nvmlSystemGetDriverVersion()
    Driver Version: 352.00
    >>> deviceCount = nvmlDeviceGetCount()
    >>> for i in range(deviceCount):
    ...     handle = nvmlDeviceGetHandleByIndex(i)
    ...     print "Device", i, ":", nvmlDeviceGetName(handle)
    ...
    Device 0 : Tesla K40c

    >>> nvmlShutdown()

Additionally, see nvidia_smi.py.  A sample application.

FUNCTIONS
---------
Python methods wrap NVML functions, implemented in a C shared library.
Each function's use is the same with the following exceptions:

- Instead of returning error codes, failing error codes are raised as
  Python exceptions.

    >>> try:
    ...     nvmlDeviceGetCount()
    ... except NVMLError as error:
    ...     print error
    ...
    Uninitialized

- C function output parameters are returned from the corresponding
  Python function left to right.

::

    nvmlReturn_t nvmlDeviceGetEccMode(nvmlDevice_t device,
                                      nvmlEnableState_t *current,
                                      nvmlEnableState_t *pending);

    >>> nvmlInit()
    >>> handle = nvmlDeviceGetHandleByIndex(0)
    >>> (current, pending) = nvmlDeviceGetEccMode(handle)

- C structs are converted into Python classes.

::

    nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo(nvmlDevice_t device,
                                                 nvmlMemory_t *memory);
    typedef struct nvmlMemory_st {
        unsigned long long total;
        unsigned long long free;
        unsigned long long used;
    } nvmlMemory_t;

    >>> info = nvmlDeviceGetMemoryInfo(handle)
    >>> print "Total memory:", info.total
    Total memory: 5636292608
    >>> print "Free memory:", info.free
    Free memory: 5578420224
    >>> print "Used memory:", info.used
    Used memory: 57872384

- Python handles string buffer creation.

::

    nvmlReturn_t nvmlSystemGetDriverVersion(char* version,
                                            unsigned int length);

    >>> version = nvmlSystemGetDriverVersion();
    >>> nvmlShutdown()

For usage information see the NVML documentation.

VARIABLES
---------
All meaningful NVML constants and enums are exposed in Python.

The NVML_VALUE_NOT_AVAILABLE constant is not used.  Instead None is mapped to the field.

RELEASE NOTES
-------------
Version 2.285.0
- Added new functions for NVML 2.285.  See NVML documentation for more information.
- Ported to support Python 3.0 and Python 2.0 syntax.
- Added nvidia_smi.py tool as a sample app.
Version 3.295.0
- Added new functions for NVML 3.295.  See NVML documentation for more information.
- Updated nvidia_smi.py tool
  - Includes additional error handling
Version 4.304.0
- Added new functions for NVML 4.304.  See NVML documentation for more information.
- Updated nvidia_smi.py tool
Version 4.304.3
- Fixing nvmlUnitGetDeviceCount bug
Version 5.319.0
- Added new functions for NVML 5.319.  See NVML documentation for more information.
Version 6.340.0
- Added new functions for NVML 6.340.  See NVML documentation for more information.
Version 7.346.0
- Added new functions for NVML 7.346.  See NVML documentation for more information.
Version 7.352.0
- Added new functions for NVML 7.352.  See NVML documentation for more information.

COPYRIGHT
---------
Copyright (c) 2011-2015, NVIDIA Corporation.  All rights reserved.

LICENSE
-------
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

- Neither the name of the NVIDIA Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

More Repositories

1

glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
Python
26,632
star
2

docker-influxdb-grafana

Docker-compose files for a simple InfluxDB + Grafana stack
Shell
397
star
3

varnish-nginx-wordpress

A "simple" Varnish ang NGinx configuration for a Wordpress blog
VCL
307
star
4

ubuntupostinstall

Mon script de post installation d'Ubuntu Desktop
Python
117
star
5

debianpostinstall

Script pour automatiser l'installation de machine sous Debian
Shell
80
star
6

glancesautoinstall

Glances Auto Install script
Shell
59
star
7

chromium-on-mac

Install/Update Chromium on Mac OS X
Shell
48
star
8

gstpipelinearena

GStreamer pipeline arena
Shell
42
star
9

sxxexx

A command line tool to search (and download) series from the Piracy Bay.
Python
31
star
10

pyadl

A Python wrapper for the AMD/ATI ADL library
Python
25
star
11

openvpnscripts

Shell scripts to control an OpenVPN server
Shell
24
star
12

witsub

Where Is The Subtitle
Python
23
star
13

vnstat.js

A Node.js Web based interface for VnStat
CSS
23
star
14

batinfo

A Python lib to grab batteries' informations on Linux operating system
Python
21
star
15

nagiosautoinstall

Installation automatique de Nagios depuis les sources
Shell
20
star
16

shinkenautoinstall

Script d'installation automatique de Shinken/Thruk
Shell
18
star
17

nagisk

Nagisk is a simple tool to monitor Asterisk from a Nagios server.
Perl
17
star
18

loicinstaller

This script installs, updates and runs LOIC on Linux.
Shell
16
star
19

checkglances

CheckGlances, a Nagios|Shinken plugin for Glances
Python
14
star
20

pymdstat

A pythonic library to parse /proc/mdstat file
Python
12
star
21

dotfiles

My "dotfiles" for Bash, Vim...
Lua
10
star
22

docker-influxdb2-grafana-glances

A sandbox with InfluxDB2 + Grafana + Glances
10
star
23

myscreencast

Shell script based on GStreamer to build screencast in H.264/AAC, WebM and Vorbis/Theora format)
Shell
10
star
24

fail2banarena

My configuration files for Fail2Ban
8
star
25

simulwan

WAN simulator script for Linux kernel
Shell
8
star
26

sjitter

Sjitter is a command line client/server to measure jitter (based on RFC 1889), one way UDP delay and bandwidth.
Shell
8
star
27

pythonarena

Python repos for my test
Jupyter Notebook
8
star
28

winks

A Glances server with minimal footprint
Go
7
star
29

ciscosteeringwheel

Some stupids Shell Script to talk with Cisco equipment
Perl
6
star
30

muninplugins

Munin Plugins
6
star
31

isittor

IsItTor is a script to check if an IP address is a Tor exit node
Python
6
star
32

nodeautoinstall

NodeJS and NPM auto installation script for Debian Stable
Python
6
star
33

tcptweak

A TCP tweak shell script for GNU/Linux
Perl
5
star
34

yagits

Yet Another GIT Sheet
5
star
35

fedorapostinstall

A tiny Fedora post install Script
Shell
5
star
36

pydecom

Python
4
star
37

cactiplug

Integrate Cacti in the Nagios GUI
PHP
4
star
38

dockersfiles

My own and almost private dockers files
4
star
39

iperfit

Automaticaly run Iperf on both server and client
Perl
4
star
40

scriptit

A simple Python skeleton to speed up "post installation" script development
Python
3
star
41

showtuxperf

Show Linux performance
Shell
3
star
42

pycket

Extract data from packet of bits
Python
3
star
43

glances-webui

Glances WebUI
3
star
44

rtpshow

Perl script showing RTP packets
Perl
3
star
45

testvideo

Test video Quality using QPSNR (compare 2 videos)
Shell
3
star
46

hing

A pure Python HTTP ping
3
star
47

glancesautopkg

Glances autopackage builder
Shell
3
star
48

pythoncliskeleton

Skeleton for Python CLI oriented module
Python
3
star
49

glancesarena

A sandbox for Glances
Python
2
star
50

kissetl

A keep it simple stupid ETL (Extract, Transform and Load)
2
star
51

Aptana-Install-Script

Automatically Installs Aptana Studio 3 on Ubuntu 12.04 Precise Pangolin
Shell
2
star
52

pygpustats

A Python wrapper to grab GPU's stats
2
star
53

springarena

Spring testbed
Shell
2
star
54

gazes

Gazes on your system
2
star
55

geolocip

Automatically exported from code.google.com/p/geolocip
2
star
56

puppet

My Puppet Master configuration files
Puppet
2
star
57

docker-graphite-grafana

Shell
2
star
58

diagramsarana

A place for my diagrams.net
2
star
59

mandelbrot

Python Mandelbrot image generator
Python
2
star
60

systemintegrity

A very simple system integrity script based on SHA-2
Python
2
star
61

klances

Glances for Kubernetes
Python
2
star
62

grafanaarena

Sandbox for Grafana
2
star
63

pysat

Satellite protocol stack implementation in Python
2
star
64

blogostat

Quelques scripts pour obtenir des stats sur la blogosphère FR
Shell
1
star
65

rustarena

Rust sandbox
Rust
1
star
66

twitpicit

Script to send image to Twitpic
Perl
1
star