Skip to content

NVIDIA/otk-pyoptix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyOptiX

Python bindings for OptiX 7.

Installation

Dependencies

OptiX SDK

Install OptiX SDK version 7.6 or newer.

CUDA SDK

Install CUDA SDK version 12.6 or newer required for examples, otherwise as required by your OptiX SDK.

Build system requirements:

Code sample dependencies

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

  • pytest
  • cupy
  • numpy
  • Pillow
  • cuda-python

Virtual Environment

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

venv Virtual Environment

Create and activate a new virtual environment:

python3 -m venv env
source env/bin/activate

Install all dependencies:

pip install -r requirements.txt

Conda Environment

Create an environment containing pre-requisites:

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

Activate the environment:

conda activate pyoptix

The pynvrtc dependency, necessary for running the examples, needs to be installed via pip:

pip install pynvrtc

Building and installing the optix Python module

Point setuptools/CMake to Optix by setting the following environment variable.

Linux:

export PYOPTIX_CMAKE_ARGS="-DOptiX_INSTALL_DIR=<optix install dir>"

Windows:

set PYOPTIX_CMAKE_ARGS=-DOptiX_INSTALL_DIR=C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.0.0

Build and install using pip and setuptools.py:

cd optix
pip install .

When compiling against an Optix 7.0 SDK an additional environment variable needs to be set containing a path to the system's stddef.h location. E.g.

export PYOPTIX_STDDEF_DIR="/usr/include/linux"

Running the Examples

Run the hello sample:

cd 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

About

Complete Python bindings for the OptiX host API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •