Skip to content

Commit f9c1e91

Browse files
authored
Merge pull request #24 from makepath/get-recipe-working-on-windows
added conda bld.bat for windows
2 parents 0bd1131 + 49798af commit f9c1e91

File tree

4 files changed

+123
-14
lines changed

4 files changed

+123
-14
lines changed

conda-recipe/README.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,38 @@
22

33
This conda recipe builds rtxpy with all required dependencies including OptiX and CUDA support.
44

5+
## Supported Platforms
6+
7+
- **Linux** (x86_64)
8+
- **Windows** (x86_64)
9+
510
## Prerequisites
611

7-
- NVIDIA GPU with compute capability 5.2+ (Maxwell or newer)
12+
- NVIDIA GPU with compute capability 7.5+ (Turing or newer, for CUDA 12+)
813
- NVIDIA driver 530.41+ (for OptiX 7.7 compatibility)
914
- conda-build installed
1015

16+
## Python and NumPy Compatibility
17+
18+
| Python Version | NumPy Version |
19+
|----------------|---------------|
20+
| 3.10, 3.11, 3.12 | >=1.21, <3 |
21+
| 3.13+ | >=2.0, <3 |
22+
1123
## Building the Package
1224

13-
### Basic build (auto-detect GPU architecture):
25+
### Linux - Basic build (auto-detect GPU architecture):
1426

1527
```bash
1628
conda build conda-recipe
1729
```
1830

31+
### Windows - Basic build:
32+
33+
```cmd
34+
conda build conda-recipe
35+
```
36+
1937
### Build for a specific GPU architecture:
2038

2139
```bash
@@ -58,10 +76,10 @@ conda install --use-local rtxpy
5876

5977
## GPU Architecture Reference
6078

79+
**Note:** CUDA 12+ requires compute capability 7.5+ (Turing or newer).
80+
6181
| GPU Series | Architecture | Compute Capability |
6282
|------------|--------------|-------------------|
63-
| GTX 900, Tesla M | Maxwell | sm_52 |
64-
| GTX 1000, Tesla P | Pascal | sm_60, sm_61 |
6583
| RTX 2000, Tesla T4 | Turing | sm_75 |
6684
| RTX 3000, A100 | Ampere | sm_80, sm_86 |
6785
| RTX 4000, L40 | Ada Lovelace | sm_89 |
@@ -87,7 +105,21 @@ Your driver is too old for the OptiX version. Either:
87105

88106
### "Invalid target architecture" error
89107
The PTX was compiled for a different GPU. Rebuild with your GPU's architecture:
108+
109+
**Linux:**
90110
```bash
91111
GPU_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | tr -d '.')
92112
conda build conda-recipe
93113
```
114+
115+
**Windows:**
116+
```cmd
117+
for /f "tokens=*" %a in ('nvidia-smi --query-gpu^=compute_cap --format^=csv^,noheader') do set GPU_ARCH=%a
118+
set GPU_ARCH=%GPU_ARCH:.=%
119+
conda build conda-recipe
120+
```
121+
122+
### NumPy version conflicts
123+
If you see errors about numpy version incompatibility:
124+
- Python 3.13+ requires numpy 2.0 or later
125+
- The recipe handles this automatically with conditional dependencies

conda-recipe/bld.bat

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
@echo off
2+
setlocal EnableDelayedExpansion
3+
4+
echo === RTXpy Conda Build (Windows) ===
5+
6+
REM ---------------------------------------------------------------------------
7+
REM Step 1: Install OptiX SDK headers
8+
REM ---------------------------------------------------------------------------
9+
if "%OPTIX_VERSION%"=="" set OPTIX_VERSION=7.7.0
10+
set OPTIX_DIR=%SRC_DIR%\optix-sdk
11+
12+
echo === Installing OptiX SDK headers (v%OPTIX_VERSION%) ===
13+
git clone --depth 1 --branch "v%OPTIX_VERSION%" https://github.com/NVIDIA/optix-dev.git "%OPTIX_DIR%"
14+
if errorlevel 1 exit /b 1
15+
16+
if not exist "%OPTIX_DIR%\include\optix.h" (
17+
echo ERROR: OptiX headers not found after clone
18+
exit /b 1
19+
)
20+
21+
set OptiX_INSTALL_DIR=%OPTIX_DIR%
22+
echo OptiX headers installed at: %OptiX_INSTALL_DIR%
23+
24+
REM ---------------------------------------------------------------------------
25+
REM Step 2: Detect GPU architecture and compile PTX
26+
REM ---------------------------------------------------------------------------
27+
echo === Compiling PTX kernel ===
28+
29+
REM Try to detect GPU architecture, fall back to a compatible default
30+
if "%GPU_ARCH%"=="" (
31+
for /f "tokens=*" %%a in ('nvidia-smi --query-gpu^=compute_cap --format^=csv^,noheader 2^>nul') do (
32+
set GPU_ARCH_RAW=%%a
33+
set GPU_ARCH=!GPU_ARCH_RAW:.=!
34+
goto :arch_found
35+
)
36+
)
37+
:arch_found
38+
39+
REM Default to sm_75 (Turing) - minimum supported by CUDA 12+
40+
REM PTX is forward-compatible, so this will JIT-compile on newer GPUs
41+
if "%GPU_ARCH%"=="" set GPU_ARCH=75
42+
43+
echo Target GPU architecture: sm_%GPU_ARCH%
44+
45+
nvcc -ptx ^
46+
-arch="sm_%GPU_ARCH%" ^
47+
-I"%OptiX_INSTALL_DIR%\include" ^
48+
-I"%SRC_DIR%\cuda" ^
49+
--use_fast_math ^
50+
-o "%SRC_DIR%\rtxpy\kernel.ptx" ^
51+
"%SRC_DIR%\cuda\kernel.cu"
52+
if errorlevel 1 exit /b 1
53+
54+
echo PTX compiled successfully
55+
56+
REM ---------------------------------------------------------------------------
57+
REM Step 3: Install otk-pyoptix from source
58+
REM ---------------------------------------------------------------------------
59+
echo === Installing otk-pyoptix ===
60+
set OTK_PYOPTIX_DIR=%SRC_DIR%\otk-pyoptix
61+
62+
git clone --depth 1 https://github.com/NVIDIA/otk-pyoptix.git "%OTK_PYOPTIX_DIR%"
63+
if errorlevel 1 exit /b 1
64+
65+
cd /d "%OTK_PYOPTIX_DIR%\optix"
66+
"%PYTHON%" -m pip install . --no-deps --no-build-isolation -vv
67+
if errorlevel 1 exit /b 1
68+
69+
REM ---------------------------------------------------------------------------
70+
REM Step 4: Install rtxpy
71+
REM ---------------------------------------------------------------------------
72+
echo === Installing rtxpy ===
73+
cd /d "%SRC_DIR%"
74+
75+
"%PYTHON%" -m pip install . --no-deps --no-build-isolation -vv
76+
if errorlevel 1 exit /b 1
77+
78+
echo === RTXpy build complete ===

conda-recipe/conda_build_config.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ cuda_compiler_version:
44

55
# Python versions to support
66
python:
7+
- "3.10"
8+
- "3.11"
79
- "3.12"
810
- "3.13"
911

10-
# Pin numpy for ABI compatibility
11-
numpy:
12-
- "1.26"
13-
14-
# Zip keys to create version combinations
15-
zip_keys:
16-
- - python
12+
# NumPy version handling:
13+
# - Python 3.10-3.12: numpy 1.26 (last 1.x series)
14+
# - Python 3.13+: numpy 2.1 (required for Python 3.13 support)
15+
# Note: numpy pins are set conditionally in meta.yaml based on Python version

conda-recipe/meta.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ source:
1010

1111
build:
1212
number: 0
13-
skip: true # [not linux]
1413
skip: true # [py<310]
1514
script_env:
1615
- OPTIX_VERSION=7.7.0
@@ -38,10 +37,11 @@ requirements:
3837

3938
run:
4039
- python >=3.10
41-
- numpy >=1.21
40+
- numpy >=1.21,<3 # [py<313]
41+
- numpy >=2.0,<3 # [py>=313]
4242
- cupy >=12.0
4343
- cuda-version >=12
44-
- __cuda
44+
- __cuda # [linux]
4545

4646
test:
4747
imports:

0 commit comments

Comments
 (0)