|
| 1 | +# PyOptiX |
| 2 | + |
| 3 | +Python bindings for OptiX 7. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +### OptiX SDK |
| 8 | + |
| 9 | +Install the [OptiX 7.2.0 |
| 10 | +SDK](https://developer.nvidia.com/optix/downloads/7.2.0/linux64). |
| 11 | + |
| 12 | + |
| 13 | +### Conda environment |
| 14 | + |
| 15 | +Create an environment containing pre-requisites: |
| 16 | + |
| 17 | +``` |
| 18 | +conda create -n pyoptix python numpy conda-forge::cupy pybind11 pillow cmake |
| 19 | +``` |
| 20 | + |
| 21 | +Activate the environment: |
| 22 | + |
| 23 | +``` |
| 24 | +conda activate pyoptix |
| 25 | +``` |
| 26 | + |
| 27 | +### PyOptiX installation |
| 28 | + |
| 29 | +Build and install PyOptiX into the environment with: |
| 30 | + |
| 31 | +``` |
| 32 | +export PYOPTIX_CMAKE_ARGS="-DOptiX_INSTALL_DIR=<optix install dir>" |
| 33 | +pip3 install --global-option build --global-option --debug . |
| 34 | +``` |
| 35 | + |
| 36 | +`<optix install dir>` should be the OptiX 7.2.0 install location - for example, |
| 37 | +`/home/gmarkall/numbadev/NVIDIA-OptiX-SDK-7.2.0-linux64-x86_64`. |
| 38 | + |
| 39 | + |
| 40 | +## Running the example |
| 41 | + |
| 42 | +The example can be run from the root of the repository with: |
| 43 | + |
| 44 | +``` |
| 45 | +python examples/hello.py |
| 46 | +``` |
| 47 | + |
| 48 | +It may be necessary to modify the include path used by nvrtc to find the OptiX |
| 49 | +headers at their actualy installed location. For example: |
| 50 | + |
| 51 | +```diff |
| 52 | +diff --git a/examples/hello.py b/examples/hello.py |
| 53 | +index 16a153e..317cc37 100755 |
| 54 | +--- a/examples/hello.py |
| 55 | ++++ b/examples/hello.py |
| 56 | +@@ -73,7 +73,7 @@ def compile_cuda( cuda_file ): |
| 57 | + #'-IC:\\ProgramData\\NVIDIA Corporation\OptiX SDK 7.2.0\include', |
| 58 | + #'-IC:\\Program Files\\NVIDIA GPU Computing Toolkit\CUDA\\v11.1\include' |
| 59 | + '-I/usr/local/cuda/include', |
| 60 | +- '-I/home/kmorley/Code/support/NVIDIA-OptiX-SDK-7.2.0-linux64-x86_64/include/' |
| 61 | ++ '-I/home/gmarkall/numbadev/NVIDIA-OptiX-SDK-7.2.0-linux64-x86_64/include/' |
| 62 | + ] ) |
| 63 | + return ptx |
| 64 | + |
| 65 | +``` |
| 66 | + |
| 67 | +If the example runs successfully, a green square will be rendered. |
0 commit comments