Skip to content

Commit 5c5ea23

Browse files
committed
cuda-core: add pixi examples env and fix example run regressions
Add a dedicated Pixi `examples` environment with the optional runtime dependencies needed by the example suite and CUDA include-path activation. Also fix two runnable examples so they execute correctly under the new env. Made-with: Cursor
1 parent 6def020 commit 5c5ea23

4 files changed

Lines changed: 3700 additions & 16 deletions

File tree

cuda_core/examples/jit_lto_fractal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(self):
7676

7777
# Setup the launch configuration such that each thread will be generating one pixel, and subdivide
7878
# the problem into 16x16 chunks.
79-
self.grid = (self.width / 16, self.height / 16, 1.0)
79+
self.grid = (self.width // 16, self.height // 16, 1)
8080
self.block = (16, 16, 1)
8181
self.config = LaunchConfig(grid=self.grid, block=self.block)
8282

cuda_core/examples/strided_memory_view_cpu.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def my_func(arr):
8080

8181

8282
def run():
83-
global my_func
83+
global my_func, cpu_func, cpu_prog
8484
# Here is a concrete (very naive!) implementation on CPU:
8585
cpu_code = string.Template(r"""
8686
extern "C"
@@ -102,6 +102,7 @@ def run():
102102
extra_compile_args=["-std=c++11"],
103103
)
104104
temp_dir = tempfile.mkdtemp()
105+
cpu_func = None
105106
saved_sys_path = sys.path.copy()
106107
try:
107108
cpu_prog.compile(tmpdir=temp_dir)
@@ -123,7 +124,9 @@ def run():
123124
sys.path = saved_sys_path
124125
# to allow FFI module to unload, we delete references to
125126
# to cpu_func
126-
del cpu_func, my_func
127+
if cpu_func is not None:
128+
del cpu_func
129+
del cpu_prog, my_func
127130
# clean up temp directory
128131
shutil.rmtree(temp_dir)
129132

0 commit comments

Comments
 (0)