Skip to content

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Nov 7, 2025

This PR is a redo of pixi environment setup that combines cuda-core and
cuda-bindings into a single PR.

I am not trying to capture every possible environment combination of CUDA and
Python right now, just enough to get a minimal development environment working
for both of these projects on linux-64. What's in these pixi.toml files is
the scope I intended.

The biggest thing that isn't working yet, but that isn't a blocker is the
ability of cuda-core to depend on cuda-bindings in the repo. During the
cuda-core build phase, cuda/bindings.pyx isn't found and that causes the
build to fail. I haven't yet investigated that.

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Nov 7, 2025

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@cpcloud cpcloud force-pushed the pixi-for-cuda-core branch from fb9b67c to e3f2aa2 Compare November 7, 2025 21:30
@cpcloud
Copy link
Contributor Author

cpcloud commented Nov 7, 2025

/ok to test

@github-actions

This comment has been minimized.

@cpcloud
Copy link
Contributor Author

cpcloud commented Nov 10, 2025

/ok to test

1 similar comment
@cpcloud
Copy link
Contributor Author

cpcloud commented Nov 10, 2025

/ok to test

@cpcloud cpcloud requested a review from kkraus14 November 10, 2025 15:31
@cpcloud
Copy link
Contributor Author

cpcloud commented Nov 10, 2025

/ok to test

@cpcloud cpcloud requested a review from leofang November 10, 2025 15:47
@cpcloud
Copy link
Contributor Author

cpcloud commented Nov 10, 2025

/ok to test

@leofang
Copy link
Member

leofang commented Nov 10, 2025

Now that we have pixi support, how about adding CI pipelines? (#280) 😉

@cpcloud
Copy link
Contributor Author

cpcloud commented Nov 10, 2025

Now that we have pixi support, how about adding CI pipelines? (#280) 😉

Something I will look into for sure. I would like to get docs building first (or maybe as a parallel work stream).

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Nov 11, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

cuda-version = "13.*"

[environments]
cu13 = { features = ["cu13", "test", "cython-tests"], solve-group = "cu13" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit unhappy having to pass -e cu13 explicitly for every pixi operation. In the next PR we should think about if this is avoidable.

depends-on = [{ task = "build-cython-tests" }]

[target.linux.tasks.test]
cmd = ["pytest", "$PIXI_PROJECT_ROOT/tests"]
Copy link
Member

@leofang leofang Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I am not sure why, but without adding the tests subdir to the path I hit an error:

(...)
tests/cython/test_cython.py .                                                                                                                                      [100%]

=========================================================================== 1 passed in 0.75s ============================================================================
                                                                                                                                                                          
✨ Pixi task (test in cu13): pytest $PIXI_PROJECT_ROOT                                                                                                                    import cupy as cp
from cuda.core.experimental import Device
from cuda.core.experimental import LaunchConfig, launch
from cuda.core.experimental import Program, ProgramOptions

dev = Device(0)
dev.set_current()
code = r"""
extern "C" __global__ void arange(int* a, const int N) {
    const unsigned int tid = threadIdx.x + blockIdx.x * blockDim.x;
    for (auto x=tid; x<N; x+=blockDim.x*gridDim.x) { a[x] = x; }
}
"""
prog = Program(code,
               code_type="c++",
               options=ProgramOptions(std="c++17"))
mod = prog.compile("cubin")
ker = mod.get_kernel("arange")

s = dev.create_stream()
length = 64
data_type = cp.int32
dtype = cp.dtype(data_type)
buf = dev.memory_resource.allocate(length * dtype.itemsize, s) 
config = LaunchConfig(grid=1, block=(32,), stream=s)
launch(ker, config, buf, data_type(length))
s.sync()

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/_pytest/main.py", line 314, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~^^
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/_pytest/config/__init__.py", line 1128, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/pluggy/_hooks.py", line 534, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     raise exception
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/site-packages/_pytest/debugging.py", line 66, in pytest_configure
INTERNALERROR>     import pdb
INTERNALERROR>   File "/local/home/leof/dev/cuda-python/cuda_core/.pixi/envs/cu13/lib/python3.14/pdb.py", line 299, in <module>
INTERNALERROR>     class _PdbInteractiveConsole(code.InteractiveConsole):
INTERNALERROR>                                  ^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> AttributeError: module 'code' has no attribute 'InteractiveConsole'


[target.linux.tasks.test]
cmd = ["pytest", "$PIXI_PROJECT_ROOT/tests"]
#env = { PYTHONPATH = "$PIXI_PROJECT_ROOT/../cuda_python_test_helpers" }
Copy link
Member

@leofang leofang Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem necessary...? (I commented it out.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running tests from $PIXI_PROJECT_ROOT doesn't work for me without this. That's where we should run the tests from.

This was an intentional choice that I made so that pixi run -e cu13 pytest "just works".

leofang
leofang previously approved these changes Nov 11, 2025
Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok to test cc83541

@leofang
Copy link
Member

leofang commented Nov 11, 2025

weird, GitHub response is so slow, and the previous CI trigger did nothing

@leofang
Copy link
Member

leofang commented Nov 11, 2025

/ok to test b1834b1

@cpcloud cpcloud merged commit 3e0d883 into NVIDIA:main Nov 12, 2025
109 of 111 checks passed
@cpcloud cpcloud deleted the pixi-for-cuda-core branch November 12, 2025 18:11
@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

[target.linux.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.sh"]

[target.linux.tasks.run-cython-tests]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a point to the complexity of creating a separate task just to run the cython tests and then making that a dependency of the test task?

Why not just run pytest $PIXI_PROJECT_ROOT? If that doesn't work for some reason (e.g., it can't discover the cython tests) then we should pass it on the command line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, Cython tests aren't auto-discoverable from the project root. We added a rule to exclude them. Feel free to simplify the task dependency. I only wanted to make sure it runs as intended, and thought adding 3 lines of code was not too bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants