Skip to main content

Python bindings for NVIDIA OptiX ray tracing SDK

Project description

PyOptiX

Python bindings for NVIDIA OptiX ray tracing SDK.

PyOptiX provides high-performance Python bindings for NVIDIA OptiX, enabling GPU-accelerated ray tracing in Python applications. OptiX is a high-performance ray tracing API designed for optimal performance on NVIDIA GPUs.


Quick Installation

Installation of the OptiX 9.1 Python bindings can be performed directly via pip.

pip install pyoptix

Source Installation

For a local build and installation from source, including building against legacy OptiX releases, first clone this repository. Then follow instructions below.

git clone https://github.com/NVIDIA/otk-pyoptix

Dependencies

Python

Python versions 3.9+ are supported.

CUDA Toolkit

Install CUDA Toolkit version 10.0 or newer.

Note: OptiX headers are automatically fetched during build. You do NOT need to install the OptiX SDK separately to build the optix Python module. However, the SDK will need to be installed to run the examples.

Build system requirements:

Building PyOptiX from source

Once the otk-pyoptix repository has been cloned and all dependencies satisfied:

cd otk-pyoptix
pip install .

Advanced Options:

  • Additional CMake arguments can be passed via PYOPTIX_CMAKE_ARGS environment variable

Examples programs

Several example programs are included in the github repository to allow testing of the API and a starting point for user applications.

Dependencies

To run the PyOptiX examples or tests, the python modules specified in otk-pyoptix/requirements.txt must be installed:

  • pytest
  • cupy
  • numpy
  • Pillow
  • cuda-python (12.0 or newer recommended for OptiX 9.1)

In addition, the OptiX SDK must be installed to allow JIT compilation of the example shaders.

Virtual Environment

In most cases, it makes sense to setup a python environment. Below are examples of how to setup your environment with required example dependencies via eitherConda or venv.

venv Virtual Environment

Create and activate a new virtual environment, then install pre-requisites:

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

Conda Environment

Create and activate an environment containing pre-requisites:

conda create -n pyoptix python pytest conda-forge::cupy numpy pillow cuda-python
conda activate pyoptix

Running the example programs

Run the hello sample:

cd otk-pyoptix/examples
python hello.py

If the example runs successfully, a green square will be rendered.


Running the Test Suite

Test tests are using pytest and can be run from the test directory like this:

cd test
python -m pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyoptix-9.1.0.tar.gz (8.9 MB view details)

Uploaded Source

File details

Details for the file pyoptix-9.1.0.tar.gz.

File metadata

  • Download URL: pyoptix-9.1.0.tar.gz
  • Upload date:
  • Size: 8.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pyoptix-9.1.0.tar.gz
Algorithm Hash digest
SHA256 224f7fa2993240a67cd36cebe386e3c1be4a57f3bb5ace4c8532587950abacdc
MD5 8d0da4b68a2bea1b58e91b67bac65781
BLAKE2b-256 f60105023d5a6e333c52353a6e31e493ec0afae53a0f5b0c6a833f7d7ee5afd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page