diff --git a/conda-recipe/README.md b/conda-recipe/README.md index c8937cf..2858b34 100644 --- a/conda-recipe/README.md +++ b/conda-recipe/README.md @@ -2,20 +2,38 @@ This conda recipe builds rtxpy with all required dependencies including OptiX and CUDA support. +## Supported Platforms + +- **Linux** (x86_64) +- **Windows** (x86_64) + ## Prerequisites -- NVIDIA GPU with compute capability 5.2+ (Maxwell or newer) +- NVIDIA GPU with compute capability 7.5+ (Turing or newer, for CUDA 12+) - NVIDIA driver 530.41+ (for OptiX 7.7 compatibility) - conda-build installed +## Python and NumPy Compatibility + +| Python Version | NumPy Version | +|----------------|---------------| +| 3.10, 3.11, 3.12 | >=1.21, <3 | +| 3.13+ | >=2.0, <3 | + ## Building the Package -### Basic build (auto-detect GPU architecture): +### Linux - Basic build (auto-detect GPU architecture): ```bash conda build conda-recipe ``` +### Windows - Basic build: + +```cmd +conda build conda-recipe +``` + ### Build for a specific GPU architecture: ```bash @@ -58,10 +76,10 @@ conda install --use-local rtxpy ## GPU Architecture Reference +**Note:** CUDA 12+ requires compute capability 7.5+ (Turing or newer). + | GPU Series | Architecture | Compute Capability | |------------|--------------|-------------------| -| GTX 900, Tesla M | Maxwell | sm_52 | -| GTX 1000, Tesla P | Pascal | sm_60, sm_61 | | RTX 2000, Tesla T4 | Turing | sm_75 | | RTX 3000, A100 | Ampere | sm_80, sm_86 | | RTX 4000, L40 | Ada Lovelace | sm_89 | @@ -87,7 +105,21 @@ Your driver is too old for the OptiX version. Either: ### "Invalid target architecture" error The PTX was compiled for a different GPU. Rebuild with your GPU's architecture: + +**Linux:** ```bash GPU_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | tr -d '.') conda build conda-recipe ``` + +**Windows:** +```cmd +for /f "tokens=*" %a in ('nvidia-smi --query-gpu^=compute_cap --format^=csv^,noheader') do set GPU_ARCH=%a +set GPU_ARCH=%GPU_ARCH:.=% +conda build conda-recipe +``` + +### NumPy version conflicts +If you see errors about numpy version incompatibility: +- Python 3.13+ requires numpy 2.0 or later +- The recipe handles this automatically with conditional dependencies diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat new file mode 100644 index 0000000..8b413f1 --- /dev/null +++ b/conda-recipe/bld.bat @@ -0,0 +1,78 @@ +@echo off +setlocal EnableDelayedExpansion + +echo === RTXpy Conda Build (Windows) === + +REM --------------------------------------------------------------------------- +REM Step 1: Install OptiX SDK headers +REM --------------------------------------------------------------------------- +if "%OPTIX_VERSION%"=="" set OPTIX_VERSION=7.7.0 +set OPTIX_DIR=%SRC_DIR%\optix-sdk + +echo === Installing OptiX SDK headers (v%OPTIX_VERSION%) === +git clone --depth 1 --branch "v%OPTIX_VERSION%" https://github.com/NVIDIA/optix-dev.git "%OPTIX_DIR%" +if errorlevel 1 exit /b 1 + +if not exist "%OPTIX_DIR%\include\optix.h" ( + echo ERROR: OptiX headers not found after clone + exit /b 1 +) + +set OptiX_INSTALL_DIR=%OPTIX_DIR% +echo OptiX headers installed at: %OptiX_INSTALL_DIR% + +REM --------------------------------------------------------------------------- +REM Step 2: Detect GPU architecture and compile PTX +REM --------------------------------------------------------------------------- +echo === Compiling PTX kernel === + +REM Try to detect GPU architecture, fall back to a compatible default +if "%GPU_ARCH%"=="" ( + for /f "tokens=*" %%a in ('nvidia-smi --query-gpu^=compute_cap --format^=csv^,noheader 2^>nul') do ( + set GPU_ARCH_RAW=%%a + set GPU_ARCH=!GPU_ARCH_RAW:.=! + goto :arch_found + ) +) +:arch_found + +REM Default to sm_75 (Turing) - minimum supported by CUDA 12+ +REM PTX is forward-compatible, so this will JIT-compile on newer GPUs +if "%GPU_ARCH%"=="" set GPU_ARCH=75 + +echo Target GPU architecture: sm_%GPU_ARCH% + +nvcc -ptx ^ + -arch="sm_%GPU_ARCH%" ^ + -I"%OptiX_INSTALL_DIR%\include" ^ + -I"%SRC_DIR%\cuda" ^ + --use_fast_math ^ + -o "%SRC_DIR%\rtxpy\kernel.ptx" ^ + "%SRC_DIR%\cuda\kernel.cu" +if errorlevel 1 exit /b 1 + +echo PTX compiled successfully + +REM --------------------------------------------------------------------------- +REM Step 3: Install otk-pyoptix from source +REM --------------------------------------------------------------------------- +echo === Installing otk-pyoptix === +set OTK_PYOPTIX_DIR=%SRC_DIR%\otk-pyoptix + +git clone --depth 1 https://github.com/NVIDIA/otk-pyoptix.git "%OTK_PYOPTIX_DIR%" +if errorlevel 1 exit /b 1 + +cd /d "%OTK_PYOPTIX_DIR%\optix" +"%PYTHON%" -m pip install . --no-deps --no-build-isolation -vv +if errorlevel 1 exit /b 1 + +REM --------------------------------------------------------------------------- +REM Step 4: Install rtxpy +REM --------------------------------------------------------------------------- +echo === Installing rtxpy === +cd /d "%SRC_DIR%" + +"%PYTHON%" -m pip install . --no-deps --no-build-isolation -vv +if errorlevel 1 exit /b 1 + +echo === RTXpy build complete === diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml index 61f6258..4f3c872 100644 --- a/conda-recipe/conda_build_config.yaml +++ b/conda-recipe/conda_build_config.yaml @@ -4,13 +4,12 @@ cuda_compiler_version: # Python versions to support python: + - "3.10" + - "3.11" - "3.12" - "3.13" -# Pin numpy for ABI compatibility -numpy: - - "1.26" - -# Zip keys to create version combinations -zip_keys: - - - python +# NumPy version handling: +# - Python 3.10-3.12: numpy 1.26 (last 1.x series) +# - Python 3.13+: numpy 2.1 (required for Python 3.13 support) +# Note: numpy pins are set conditionally in meta.yaml based on Python version diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index a03df75..026dccc 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -10,7 +10,6 @@ source: build: number: 0 - skip: true # [not linux] skip: true # [py<310] script_env: - OPTIX_VERSION=7.7.0 @@ -38,10 +37,11 @@ requirements: run: - python >=3.10 - - numpy >=1.21 + - numpy >=1.21,<3 # [py<313] + - numpy >=2.0,<3 # [py>=313] - cupy >=12.0 - cuda-version >=12 - - __cuda + - __cuda # [linux] test: imports: