1132719438 / pynvx

Python bindings for NVIDIA CUDA APIs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

██████╗ ██╗   ██╗███╗   ██╗██╗   ██╗██╗  ██╗
██╔══██╗╚██╗ ██╔╝████╗  ██║██║   ██║╚██╗██╔╝
██████╔╝ ╚████╔╝ ██╔██╗ ██║██║   ██║ ╚███╔╝
██╔═══╝   ╚██╔╝  ██║╚██╗██║╚██╗ ██╔╝ ██╔██╗
██║        ██║   ██║ ╚████║ ╚████╔╝ ██╔╝ ██╗
╚═╝        ╚═╝   ╚═╝  ╚═══╝  ╚═══╝  ╚═╝  ╚═╝


Python bindings for NVIDIA CUDA APIs.

PyPI Build Status Build status Release Version

A Python interface to get GPU information, built with pybind11. The main purpose of this project is providing a solution for managing GPU information on OS X, because there is no NVML library on OS X.

You can use pynvx as:

  • standalone API: pynvx.cuda*
  • pyNVML wrapper: pynvml.nvml*, API call will be invoked to pyNVML on Linux and Windows, or pynvx on OS X.

Table of Contents



You should set up CUDA before installation.

2. Compiler

Used When installing from source

On Unix (Linux, OS X)

  • A compiler with C++11 support
  • CMake >= 2.8.12

On Windows

  • Visual Studio 2015 (required for all Python versions, see notes below)
  • CMake >= 3.1


1. Install by pip (recommended)

pip install pynvx

2. Install from offline wheel file

Download wheel file in Release page, then install with pip:

pip install pynvx-*.whl

3. Install from source

Please install CUDA and set environment variables first.

See FindCUDA.cmake:548 (message): Specify CUDA_TOOLKIT_ROOT_DIR in TROUBLESHOOTING.

Just clone this repository and pip install. Note the --recursive option which is needed for the pybind11 submodule:

git clone --recursive https://github.com/1132719438/pynvx.git
pip install ./pynvx

With the setup.py file included in this project, the pip install command will invoke CMake and build the pybind11 module as specified in CMakeLists.txt.


  • standalone API

    See API

  • pyNVML wrapper

    Please install pyNVML when use pynvx as pyNVML wrapper:
    Python 3: pip install nvidia-ml-py3
    Python 2: pip install nvidia-ml-py


Special notes for Windows

Compiler requirements

Pybind11 requires a C++11 compliant compiler, i.e Visual Studio 2015 on Windows. This applies to all Python versions, including 2.7. Unlike regular C extension modules, it's perfectly fine to compile a pybind11 module with a VS version newer than the target Python's VS version. See the FAQ for more details.

Runtime requirements

The Visual C++ 2015 redistributable packages are a runtime requirement for this project. It can be found here. If you use the Anaconda Python distribution, you can add vs2015_runtime as a platform-dependent runtime requirement for you package: see the conda.recipe/meta.yaml file in this example.


pynvx is provided under MIT License, see LICENSE file.


If you have problem while installing pynvx, see TROUBLESHOOTING before opening an issue.

Test & Example

Special Thanks

  • Thanks stas00 for the idea of pyNVML wrapper and helping to test.


Python bindings for NVIDIA CUDA APIs.

License:MIT License


Language:Python 39.4%Language:C++ 37.1%Language:Shell 16.1%Language:Batchfile 6.4%Language:CMake 1.0%