-
Notifications
You must be signed in to change notification settings - Fork 434
[STF] Add python bindings #5315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
caugonnet
wants to merge
637
commits into
NVIDIA:main
Choose a base branch
from
caugonnet:stf_c_api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 250 commits
Commits
Show all changes
637 commits
Select commit
Hold shift + click to select a range
1457893
Reject non-contiguous buffers in logical_data
caugonnet cf7753f
Normalize and validate shape in logical_data.init_by_shape
caugonnet 1f80e6a
pre-commit hooks
caugonnet 1e29a51
Guard CuPy imports in example_potri and example_cholesky
caugonnet fb5dddf
Add finiteness assertions and clean up FDTD tests
caugonnet 76c7bae
pre-commit hooks
caugonnet 9e95107
Add host_launch to Python STF bindings
caugonnet 8fe3c16
Add stf_fence binding to Python STF context
caugonnet c9cee96
Expose task.set_symbol() and ctx.task(symbol=) in Python STF bindings
caugonnet 224eba1
Add cuda_kernel bindings to Python STF for efficient CUDA kernel laun…
caugonnet 3cbbdd5
Fix cuda_kernel.launch() to keep all ParamHolder args alive for multi…
caugonnet f3ef1cd
Harden Python STF bindings with NULL checks and safe __dealloc__
caugonnet 34e7139
Add exec_place_grid, composite data places, and FFI-safe partition_fn_t
caugonnet 21ae4ec
Add task grid introspection: get_grid_dims, get_stream_at_index, get_…
caugonnet e19673d
Fix unused variable lint warnings in test_composite_places.py
caugonnet be2552b
Apply ruff-format to test_cuda_kernel.py
caugonnet 3c77d25
Add STF + cuda.compute integration examples (reduce, scan, transform)
caugonnet 0dc2d03
Add ctx.wait(), fix logical_data GC bug, numba_task helper, and simpl…
caugonnet cbbcc2f
Add task-free place support: exec_place_scope, pick_stream, get_place…
caugonnet cb05626
Expose data_place::allocate/deallocate through C API, Python bindings…
caugonnet 49ddbe9
Merge branch 'main' into stf_c_api
caugonnet cab9f71
Merge branch 'main' into stf_c_api
caugonnet 64d5848
Merge branch 'main' into stf_c_api
caugonnet 486ca13
Add exec_place._handle_int property for FFI/ctypes interop
caugonnet 6ed1987
Add STF green context bindings for Python.
caugonnet bb67603
[STF] Move stream pools to per-handle exec_place_resources registry
caugonnet 7f72b99
[STF] Thread exec_place_resources through stream lookup call sites
caugonnet dab73bd
[STF] Add C++ tests and docs for explicit exec_place_resources stream…
caugonnet 11b8b8b
[STF] Add C API and Python bindings for stackable contexts and exec_p…
caugonnet c0fd7d7
[STF] Add stackable-context Python test suite
caugonnet d547abc
pre-commit hooks
caugonnet 3993bf4
[STF] Port linear algebra examples to nvmath-python + STF workspaces
caugonnet 689c531
[STF] Add no_export empty stackable logical data in C API + Python
caugonnet 93ecafd
[STF] Add explicit push() on stackable logical data in C API + Python
caugonnet 17a2bf7
[STF] Expose async_resources_handle and caller-stream context in Python
caugonnet faf493b
[STF] Split stackable_ctx::pop() into pop_prologue/pop_epilogue
caugonnet c283065
[STF] Add C API and Python bindings for launchable stackable pop
caugonnet 829268f
[STF] Make stream_ctx capture-safe and chain across back-to-back cont…
caugonnet 6e857a9
[STF] Add shared-ownership launchable_graph for stackable_ctx
caugonnet 2ae0272
[STF] C API for shared-ownership launchable_graph
caugonnet 7c5b72f
[STF] Python bindings for shared-ownership launchable_graph
caugonnet 32ddf6d
[STF] Add wp_stf Warp adapter and mixed Warp+PyTorch DAG tests
caugonnet d484e62
[STF] Fix C-facade dispatch for stackable tokens
caugonnet 817bb50
[STF] Make graph_task and stream_task move-only
caugonnet 947d0d2
[STF] Apply pre-commit hook reformatting
caugonnet f8b7fdd
Use an appropriate description of the DAG which is not a diamond shape
caugonnet 5691af8
Merge main into STF Python bindings
andralex 5f97c52
Merge remote-tracking branch 'caugonnet/stf_c_api' into work/pr-5315-…
andralex 1e7c033
Merge remote-tracking branch 'origin/main' into work/pr-5315-merge-fix
andralex b3e6867
[STF] Fix CI after main merge
andralex 81ca39a
[STF] Capture directly into ctx_graph on CTK 12.3+ via cudaStreamBegi…
caugonnet 4492a10
[STF] Fix cudaErrorStreamCaptureIsolation on token().read() in capture
caugonnet e6965a9
[STF] Forward graph_scope finalize_prereqs into parent context
caugonnet 4f2fb3c
Merge branch 'main' into stf_c_api
caugonnet 04ec9ad
Remove Warp utility
caugonnet 160396c
Warp/STF related wrappers are in Warp now
caugonnet 66aba5b
Expose logical data initializers on stackable STF contexts
caugonnet c71b509
Test stackable logical data initializers
caugonnet 98e3af5
pre-commit hooks
caugonnet c1f3eed
Merge branch 'main' into stf_c_api
caugonnet 55f34c9
Merge branch 'main' into stf_c_api
caugonnet fae0627
This test would belong to Warp
caugonnet 9a54c5a
Remove eager Burger PyTorch reference
caugonnet ee49ef6
Add branch while stackable graph example
caugonnet 0b5262d
Add Python STF task graph helper
caugonnet cd232da
Merge remote-tracking branch 'upstream/main' into stf_c_api
caugonnet b5939a5
Merge origin/main into stf_c_api
caugonnet 243062a
pre-commit hooks
caugonnet 4459823
Use vector in STF places test buffer
caugonnet 87ce7c8
Merge branch 'main' into stf_c_api
caugonnet 438acb7
Merge branch 'main' into stf_c_api
andralex 4e91f5d
Merge branch 'main' into stf_c_api
caugonnet 12b4129
Merge branch 'main' into stf_c_api
caugonnet 551d760
Document STF FHE composability examples
caugonnet 08ce080
Merge branch 'main' into stf_c_api
caugonnet 2d00b94
[STF] Port stream context capture fixes
caugonnet 2b6d021
[STF] Use cuda.bindings for runtime calls
caugonnet cec4ac4
pre-commit hooks
caugonnet 209e1f6
[STF] Skip Numba tests when Numba is unavailable
caugonnet c4de5c5
Merge branch 'main' into stf_c_api
caugonnet ce80f97
Merge branch 'main' into stf_c_api
caugonnet 327bc18
Fix ruff import-order checks in STF tests
caugonnet 4e1d024
[STF] ci: schedule base cuda.cccl wheel build for py3.13
andralex 35c405d
Merge cuda-cccl-experimental into cuda-cccl as cuda.stf._experimental
caugonnet e3c3316
pre-commit hooks
caugonnet ded36ad
Remove STF debug probes and ad-hoc benchmark scripts
caugonnet 545179b
Remove stray graphviz artifacts from repo root
caugonnet 14d7f81
ci: drop ghost `python_experimental` project after STF merger
caugonnet f241555
Merge branch 'main' into stf_c_api
caugonnet 364fee9
Merge branch 'main' into stf_c_api
caugonnet 3fd17d3
[STF] Remove experimental LLM and MLP demos
caugonnet 0e014b7
[STF] Remove experimental Warp simulation mockup
caugonnet ad7bb2e
[STF] Reorganize Python STF tests and promote interop adapters
caugonnet b470925
Merge branch 'main' into stf_c_api
caugonnet 294b486
Merge branch 'main' into stf_c_api
caugonnet 8ea81e9
pre-commit hooks
caugonnet efbcad3
Merge branch 'main' into stf_c_api
caugonnet edb3c43
Merge branch 'main' into stf_c_api
caugonnet e42c596
[STF] Use local extern C guards in C API header
caugonnet efc47ce
Merge branch 'main' into stf_c_api
caugonnet 89dc425
Merge branch 'main' into stf_c_api
caugonnet 01f0bf4
Merge branch 'main' into stf_c_api
caugonnet 10568d5
do not touch this doc
caugonnet 4fa8dc7
We don't use cccl/c/extern_c.h anymore
caugonnet f353320
revert useless change
caugonnet 29ba25d
Merge branch 'main' into stf_c_api
caugonnet d96ced9
Update c2h_dependency inspect_changes fixture for python dep
caugonnet eb87418
[STF] Remove stackable_token_push_prologue debug probe
caugonnet d08b214
[STF] Remove duplicated stackable_ctx relaunch tests
caugonnet 035a30a
[STF] Reframe stackable token push test comments as regression coverage
caugonnet 6110331
[STF] Document Python interop adapters and fix stale doc links
caugonnet 49df167
[STF] Guard optional torch/warp imports in Python STF tests
caugonnet a07cae1
[STF] Add missing license headers and fix set_exec_place in Python STF
caugonnet bbddedc
[STF] Slim and split Python Neural ODE examples
caugonnet dbee3d8
[STF] Reframe lifecycle test docstrings as regression coverage
caugonnet e65d392
Fix unified_task::get_stream(place_index) type check
caugonnet 849f388
[STF] Skip cudax tests/examples in Python package build
caugonnet a1575f5
[STF] Use keyword args for cuda.compute calls in STF tests
caugonnet 6928491
[STF] Fix broken imports and gate torch tests in STF tests
caugonnet eea8693
[STF] Unpack cuda-python error tuples in DeviceArray memcpy
caugonnet 572eff3
[STF] Ship STF dev headers in cuda-cccl wheel + path discovery helpers
caugonnet 6207eb7
[STF] Harden cuda-cccl path discovery for build isolation
caugonnet 1aee7be
[STF] Add exec_place/data_place.from_handle and ExecPlaceLike duck-ty…
caugonnet 10b4fb2
[STF] Test green-context places C API
caugonnet c238595
[STF] Avoid CuPy for zero logical data fills
caugonnet 56818a9
[STF] Guard stf_machine_init at the C boundary
caugonnet 908f59b
Merge branch 'main' into stf_c_api
caugonnet ca3c399
Merge branch 'main' into stf_c_api
caugonnet c71fa7e
Merge branch 'main' into stf_c_api
caugonnet 13d88ee
[STF] Resolve graph instantiate conflict markers
caugonnet 75b2a8c
Merge branch 'main' into stf_c_api
caugonnet 836a023
[STF] Harden Python dep typing and path resolution
caugonnet cd0f0c0
[STF] Switch Burger examples to BiCGSTAB solver
caugonnet 6f0ecf9
[STF] Skip nvmath-dependent examples when unavailable
caugonnet eabf767
[STF] Remove duplicate graph instantiation call
caugonnet 2a15440
[STF] Clarify numba.jit context inference failures
caugonnet 9af49af
[STF] Tighten numba interop error and exec_place validation
caugonnet 3342fd1
pre-commit hooks
caugonnet a89c8b1
[STF] Fix stackable host_launch test and v2 build toggles
caugonnet 07d55cf
Merge branch 'main' into stf_c_api
caugonnet 8d6cc27
Merge branch 'main' into stf_c_api
caugonnet 685ab5b
Update c2h inspect_changes expected lite output.
caugonnet 82d20ce
Merge branch 'main' into stf_c_api
caugonnet c893ca9
[STF] Skip Python STF tests when compiled bindings are unavailable
caugonnet 37c960c
Merge branch 'main' into stf_c_api
caugonnet 8c05e60
pre-commit hooks
caugonnet f18ac6c
[STF] Remove duplicate host_launch C tests
caugonnet 40540d5
[STF] Fix numba_task to end the STF task on setup failure
caugonnet 677c381
[STF] Document that cross-context deps are rejected by the core
caugonnet 20f730b
[STF] Fix and expand cuda.stf._experimental Python docs
caugonnet 384102b
Merge branch 'main' into stf_c_api
caugonnet 5f3e210
[STF] Use a realistic axpy chain as the Python intro example
caugonnet 59d8620
[STF] Stabilize unfinalized context warning test
caugonnet 4b066f7
[STF] Guard fill utils tests on bindings availability
caugonnet bd825ea
[STF] Scope Numba warning config in tests
caugonnet 076fe32
[STF] Validate cuda_cccl wheel lookup in CI
caugonnet e32d9f3
[STF] Align lite Python STF CI version
caugonnet 3fa91d2
[STF] Align BiCGSTAB test iteration count
caugonnet 50188fb
[STF] Fail on unsupported PDSYMM side
caugonnet 82194f3
[STF] Clarify stream ID handling during capture
caugonnet 687aefb
[STF] Stabilize Warp stream cache key
caugonnet 16ebcd5
[STF] Match Numba test sizes to launches
caugonnet 2da1c87
Merge branch 'main' into stf_c_api
caugonnet d74bdd9
pre-commit hooks
caugonnet 659a8e3
[STF] Preserve diffusion boundary values
caugonnet 980a2e8
[STF] Remove standalone main blocks from tests
caugonnet 34188f6
[STF] Require matplotlib for FDTD diagnostics
caugonnet 44f8384
[STF] Validate DeviceArray inputs
caugonnet 308ccc7
[STF] Make task graph reset cleanup-safe
caugonnet f6bba0c
Merge branch 'main' into stf_c_api
caugonnet b06e62d
[STF] Address Burger review nitpicks
caugonnet 4600142
Merge branch 'main' into stf_c_api
caugonnet ade7c92
[STF] Address CodeRabbit follow-up review
caugonnet e892da6
pre-commit hooks
caugonnet 05d90f0
[STF] Clarify Burger reference docstring
caugonnet 4f93f06
Merge branch 'main' into stf_c_api
caugonnet b48b384
Remove stream pool changes from STF C API branch
caugonnet 7a729d6
Restore merged stream pool comments
caugonnet 1a08dde
Merge branch 'main' into stf_c_api
caugonnet bf1d107
Clarify task graph factory docs
caugonnet e4d533d
Merge branch 'main' into stf_c_api
caugonnet 0f40e7a
Merge branch 'main' into stf_c_api
caugonnet a4917ad
stf: implement mem_create for green_ctx data place + name it by handle
caugonnet 8cdae5e
Merge branch 'main' into stf_c_api
caugonnet f568c81
Merge branch 'main' into stf_c_api
caugonnet f2670d6
[STF] Accept CUDA stream protocol objects
caugonnet 21d2ea7
[STF] Preserve structured CAI metadata
caugonnet 5724d1a
[STF] Release borrowed place resources handles
caugonnet 11f2e8a
[STF] Reject cross-context Python deps
caugonnet 4c3c49d
Merge branch 'main' into stf_c_api
caugonnet 9529906
pre-commit hooks
caugonnet 5eddfed
[STF] Add multi-GPU Python CI coverage
caugonnet de030ef
Pin numba below 0.66 for Python CUDA extras
caugonnet 649efcf
Merge branch 'main' into stf_c_api
caugonnet e8aa706
[STF] Split cuda.stf into a standalone cuda-stf package
caugonnet 6402287
[STF] Make cuda-stf standalone; drop hard cuda-cccl dependency
caugonnet 6191f45
Merge branch 'main' into stf_c_api
caugonnet bf3f3cd
pre-commit hooks
caugonnet ee08ce0
Merge branch 'main' into stf_c_api
caugonnet 2bf929e
Fix use of `reduce_policy`
davebayer 60f9329
[STF] Revert leftover cuda-cccl changes from the STF split
caugonnet cd181aa
Merge branch 'main' into stf_c_api
caugonnet 9a015d4
Merge branch 'main' into stf_c_api
caugonnet 3f46ed3
[STF] Reject cross-context waits in Python
caugonnet 3862573
[STF] Reject noncontiguous CAI inputs
caugonnet a0bfbf7
Apply suggestion from @Jacobfaib
caugonnet f0f5504
[STF] Fix standalone Python documentation
caugonnet 79f8817
Merge branch 'main' into stf_c_api
caugonnet be563bf
[STF] Add exec places from externally-owned CUDA contexts
caugonnet b19c931
[STF] Python: exec_place.from_context and cuda.core-backed green_plac…
caugonnet 9a78a9f
[STF] Reject a null CUcontext in exec_place::cuda_context
caugonnet 82c264f
[STF] Remove PR reference from CODEOWNERS comment
caugonnet 8ceb5bb
Merge branch 'main' into stf_c_api
caugonnet 77b1239
Merge branch 'main' into stf_c_api
caugonnet 9ee10c4
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] f136e94
Merge branch 'main' into stf_c_api
caugonnet c5add2b
[cuda.stf] Simplify Python CMake configuration
caugonnet 5e2f4d5
Merge branch 'main' into stf_c_api
caugonnet 8eca120
[cuda.stf] Remove historical package commentary
caugonnet d10c312
Merge branch 'main' into stf_c_api
caugonnet dd39a9b
cudax/stf (python): resolve PR 5315 review findings
caugonnet a773057
cudax/stf (python): defer async_resources release for caller-stream c…
caugonnet 13ef970
cudax/stf (python): reject imported CAI buffers that carry a producer…
caugonnet f101d43
cudax/stf (python): update tests for CAI stream=None and driver-based…
caugonnet accc384
cudax/stf (python): address CodeRabbit review findings
caugonnet 407e646
Merge branch 'main' into stf_c_api
caugonnet b9b1254
Merge branch 'main' into stf_c_api
caugonnet be61301
[STF] Support compound while-loop conditions in the C API and Python …
caugonnet 1b291c4
[STF] Use compound while conditions in the Python examples
caugonnet 126896b
[STF] Document compound while conditions in the Python API reference
caugonnet f32ff62
[STF] Add a device-side loops section to the Python STF guide
caugonnet 0bbdd60
[STF] Be honest about cond_handle usability from Python
caugonnet 1a7d3a4
[STF] Harden stackable logical_data registration from Python buffers
caugonnet 2f41158
[STF] Preserve body-exception precedence in numba_task cleanup
caugonnet 4610a32
[STF] Validate results by default in the cholesky and potri examples
caugonnet e739557
[STF] Synchronize the CAI producer stream at registration
caugonnet 61e7d3f
[STF] Note that the cuda_kernel doc snippet is an excerpt
caugonnet 93918dc
[STF] Note that the numba_task doc snippet is an excerpt
caugonnet cbceed3
[STF] Apply review nitpicks in Python tests
caugonnet b8ea935
[STF] Apply review nitpicks in Python examples and bindings
caugonnet 23d1b57
[STF] Resolve the stream pointer before pinning primary contexts
caugonnet 9ef5687
[STF] Point pytorch_task and jit doc snippets at their complete tests
caugonnet 64db026
[STF] Point the while_loop doc snippet at the complete cg.py solver
caugonnet 3e8b3fa
Merge branch 'main' into stf_c_api
caugonnet a4032b0
Merge branch 'main' into stf_c_api
caugonnet 8dc1432
[STF] Fix stale docstring in graph_scope while_loop test
caugonnet 4e3d6f4
[STF] Preload cudart before importing the compiled bindings
caugonnet 60cd8e5
[STF] Route the CAI producer-stream sync through cuda.bindings
caugonnet de7befe
[STF] Drop PR-history references from binding comments
caugonnet c0b8626
Merge branch 'main' into stf_c_api
caugonnet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| ci_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
|
||
| usage="Usage: $0 -py-version <python_version> [additional options...]" | ||
|
|
||
| # shellcheck source=ci/util/python/common_arg_parser.sh | ||
| source "$ci_dir/util/python/common_arg_parser.sh" | ||
| parse_python_args "$@" | ||
|
|
||
| # Check if py_version was provided (this script requires it) | ||
| require_py_version "$usage" || exit 1 | ||
|
|
||
| echo "Docker socket: " "$(ls /var/run/docker.sock)" | ||
|
|
||
| if [[ -n "${GITHUB_ACTIONS:-}" ]]; then | ||
| # Prepare mount points etc for getting artifacts in/out of the container. | ||
| # shellcheck source=ci/util/artifacts/common.sh | ||
| source "$ci_dir/util/artifacts/common.sh" | ||
| # Note that these mounts use the runner (not the devcontainer) filesystem for | ||
| # source directories because of docker-out-of-docker quirks. | ||
| # The workflow-job GH actions make sure that they exist before running any | ||
| # scripts. | ||
| action_mounts=( | ||
| --mount "type=bind,source=${ARTIFACT_ARCHIVES},target=${ARTIFACT_ARCHIVES}" | ||
| --mount "type=bind,source=${ARTIFACT_UPLOAD_STAGE},target=${ARTIFACT_UPLOAD_STAGE}" | ||
| ) | ||
| else | ||
| # If not running in GitHub Actions, we don't need to set up artifact mounts. | ||
| action_mounts=() | ||
| fi | ||
|
|
||
| # cuda_stf must be built in a container that can produce manylinux wheels, and | ||
| # has the CUDA toolkit installed. We use the rapidsai/ci-wheel image for this. | ||
| # We build separate wheels using separate containers for each CUDA version, | ||
| # then merge them into a single wheel. CUDASTF is Linux-only. | ||
|
|
||
| readonly cuda12_version=12.9.1 | ||
| readonly cuda13_version=13.1.1 | ||
| readonly devcontainer_version=26.04 | ||
| readonly devcontainer_distro=rockylinux8 | ||
| # Use a baseline Python tag for the rapidsai ci-wheel image. The requested | ||
| # py_version is installed inside the container by setup_python_env (uv). | ||
| readonly devcontainer_python_version=3.10 | ||
|
|
||
| if [[ "$(uname -m)" == "aarch64" ]]; then | ||
| cuda12_image="rapidsai/ci-wheel:${devcontainer_version}-cuda${cuda12_version}-${devcontainer_distro}-py${devcontainer_python_version}-arm64" | ||
| cuda13_image="rapidsai/ci-wheel:${devcontainer_version}-cuda${cuda13_version}-${devcontainer_distro}-py${devcontainer_python_version}-arm64" | ||
| else | ||
| cuda12_image="rapidsai/ci-wheel:${devcontainer_version}-cuda${cuda12_version}-${devcontainer_distro}-py${devcontainer_python_version}" | ||
| cuda13_image="rapidsai/ci-wheel:${devcontainer_version}-cuda${cuda13_version}-${devcontainer_distro}-py${devcontainer_python_version}" | ||
| fi | ||
| # shellcheck disable=SC2034 | ||
| readonly cuda12_image | ||
| # shellcheck disable=SC2034 | ||
| readonly cuda13_image | ||
|
|
||
| mkdir -p wheelhouse | ||
|
|
||
| # Shared caches across the cu12 + cu13 wheel builds. Both jobs compile an | ||
| # identical LLVM/clang tree (LLVM has no CUDA dep), so a shared ccache cuts | ||
| # the second build's LLVM phase substantially; a shared CPM source cache skips | ||
| # the second LLVM git clone entirely. | ||
| mkdir -p ./.ccache ./.cpm-cache | ||
| host_ccache_dir="${HOST_WORKSPACE:?}/.ccache" | ||
| host_cpm_cache_dir="${HOST_WORKSPACE:?}/.cpm-cache" | ||
|
|
||
| for ctk in 12 13; do | ||
| image="cuda${ctk}_image" | ||
| image="${!image}" | ||
| echo "::group::⚒️ Building CUDA $ctk cuda-stf wheel on $image" | ||
| ( | ||
| set -x | ||
| docker pull "$image" | ||
| docker run --rm -i \ | ||
| --workdir /workspace/python/cuda_stf \ | ||
| --mount "type=bind,source=${HOST_WORKSPACE:?},target=/workspace/" \ | ||
| --mount "type=bind,source=${host_ccache_dir},target=/root/.ccache" \ | ||
| --mount "type=bind,source=${host_cpm_cache_dir},target=/root/.cpm-cache" \ | ||
| "${action_mounts[@]}" \ | ||
| --env "py_version=${py_version}" \ | ||
| --env "GITHUB_ACTIONS=${GITHUB_ACTIONS:-}" \ | ||
| --env "GITHUB_RUN_ID=${GITHUB_RUN_ID:-}" \ | ||
| --env "JOB_ID=${JOB_ID:-}" \ | ||
| --env "CCACHE_DIR=/root/.ccache" \ | ||
| --env "CPM_SOURCE_CACHE=/root/.cpm-cache" \ | ||
| "$image" \ | ||
| /workspace/ci/build_cuda_stf_wheel.sh | ||
| # Prevent GHA runners from exhausting available storage with leftover images: | ||
| if [[ -n "${GITHUB_ACTIONS:-}" ]]; then | ||
| docker rmi -f "$image" | ||
| fi | ||
| ) | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| echo "Merging CUDA wheels..." | ||
|
|
||
| # Set up a Python environment for the merge/repair steps. | ||
| source "$ci_dir/pyenv_helper.sh" | ||
| setup_python_env "${py_version}" | ||
|
|
||
| # Needed for unpacking and repacking wheels. | ||
| python -m pip install wheel | ||
|
|
||
| # Find the built wheels | ||
| cu12_wheel=$(find wheelhouse -name "cuda_stf-*cu12*.whl" | head -1) | ||
| cu13_wheel=$(find wheelhouse -name "cuda_stf-*cu13*.whl" | head -1) | ||
|
|
||
| if [[ -z "$cu12_wheel" ]]; then | ||
| echo "Error: CUDA 12 cuda-stf wheel not found in wheelhouse/" | ||
| ls -la wheelhouse/ | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ -z "$cu13_wheel" ]]; then | ||
| echo "Error: CUDA 13 cuda-stf wheel not found in wheelhouse/" | ||
| ls -la wheelhouse/ | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found CUDA 12 wheel: $cu12_wheel" | ||
| echo "Found CUDA 13 wheel: $cu13_wheel" | ||
|
|
||
| # Merge the wheels | ||
| python python/cuda_stf/merge_cuda_wheels.py "$cu12_wheel" "$cu13_wheel" --output-dir wheelhouse_merged | ||
|
|
||
| # Install auditwheel and repair the merged wheel | ||
| python -m pip install patchelf auditwheel | ||
| for wheel in wheelhouse_merged/cuda_stf-*.whl; do | ||
| echo "Repairing merged wheel: $wheel" | ||
| python -m auditwheel repair \ | ||
| --exclude 'libnvrtc.so.12' \ | ||
| --exclude 'libnvrtc.so.13' \ | ||
| --exclude 'libnvJitLink.so.12' \ | ||
| --exclude 'libnvJitLink.so.13' \ | ||
| --exclude 'libcudart.so.12' \ | ||
| --exclude 'libcudart.so.13' \ | ||
| --exclude 'libcuda.so.1' \ | ||
| "$wheel" \ | ||
| --wheel-dir wheelhouse_final | ||
| done | ||
|
|
||
| # Clean up intermediate files and move only the final merged wheel to wheelhouse | ||
| rm -rf wheelhouse/* # Clean existing wheelhouse | ||
| mkdir -p wheelhouse | ||
|
|
||
| # Move only the final repaired merged wheel | ||
| if ls wheelhouse_final/cuda_stf-*.whl 1> /dev/null 2>&1; then | ||
| mv wheelhouse_final/cuda_stf-*.whl wheelhouse/ | ||
| echo "Final merged wheel moved to wheelhouse" | ||
| else | ||
| echo "No final repaired wheel found, moving unrepaired merged wheel" | ||
| mv wheelhouse_merged/cuda_stf-*.whl wheelhouse/ | ||
| fi | ||
|
|
||
| # Clean up temporary directories | ||
| rm -rf wheelhouse_merged wheelhouse_final | ||
|
|
||
| echo "Final wheels in wheelhouse:" | ||
| ls -la wheelhouse/ | ||
|
|
||
| if [[ -n "${GITHUB_ACTIONS:-}" ]]; then | ||
| # Upload under a distinct artifact name so it does not clobber the cuda-cccl | ||
| # wheel (both build jobs run in project 'python'). | ||
| wheel_artifact_name="$(CCCL_WHEEL_KIND=stf ci/util/workflow/get_wheel_artifact_name.sh)" | ||
| ci/util/artifacts/upload.sh "$wheel_artifact_name" 'wheelhouse/.*' | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Target script for `docker run` command in build_cuda_stf_python.sh | ||
| # The /workspace pathnames are hard-wired here. | ||
|
|
||
| # Install GCC 13 toolset (needed for the build) and ccache (shared between | ||
| # cu12 and cu13 builds via /root/.ccache bind-mount from the host). | ||
| /workspace/ci/util/retry.sh 5 30 dnf -y install \ | ||
| gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ ccache | ||
|
|
||
| # When the caller bind-mounts a ccache dir, wire it through to CMake. This | ||
| # transparently caches every compile, so the second wheel build (cu13 after | ||
| # cu12, or vice versa) reuses the entire LLVM/clang object tree. | ||
| if [[ -n "${CCACHE_DIR:-}" ]]; then | ||
| export CMAKE_C_COMPILER_LAUNCHER=ccache | ||
| export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| export CMAKE_CUDA_COMPILER_LAUNCHER=ccache | ||
| echo "ccache enabled: CCACHE_DIR=${CCACHE_DIR}" | ||
| ccache --version 2>&1 | head -1 || true | ||
| ccache --show-stats 2>&1 | head -5 || true | ||
| fi | ||
| echo -e "#!/usr/bin/env bash\nsource /opt/rh/gcc-toolset-13/enable" >/etc/profile.d/enable_devtools.sh | ||
| # shellcheck disable=SC1091 | ||
| source /etc/profile.d/enable_devtools.sh | ||
|
|
||
| # Check what's available | ||
| command -v gcc | ||
| gcc --version | ||
| command -v nvcc | ||
| nvcc --version | ||
|
|
||
| # Set up Python environment | ||
| # shellcheck source=ci/pyenv_helper.sh | ||
| source /workspace/ci/pyenv_helper.sh | ||
| # shellcheck disable=SC2154 | ||
| setup_python_env "${py_version}" | ||
| command -v python | ||
| python --version | ||
| echo "Done setting up python env" | ||
|
|
||
| # Figure out the version to use for the package, we need repo history | ||
| if "$(git rev-parse --is-shallow-repository)"; then | ||
| git fetch --unshallow | ||
| fi | ||
| # Match the cuda-cccl version prefix so cuda-stf and cuda-cccl stay in lockstep. | ||
| export PACKAGE_VERSION_PREFIX="0.1." | ||
| package_version=$(/workspace/ci/generate_version.sh) | ||
| echo "Using package version ${package_version}" | ||
| # Override the version used by setuptools_scm to the custom version | ||
| export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CUDA_STF="${package_version}" | ||
|
|
||
| cd /workspace/python/cuda_stf | ||
|
|
||
| # Determine CUDA version from nvcc | ||
| cuda_version=$(nvcc --version | grep -oP 'release \K[0-9]+\.[0-9]+' | cut -d. -f1) | ||
| echo "Detected CUDA version: ${cuda_version}" | ||
|
|
||
| # Configure compilers: | ||
| CXX="$(command -v g++)" | ||
| export CXX | ||
| CUDACXX="$(command -v nvcc)" | ||
| export CUDACXX | ||
| CUDAHOSTCXX="$(command -v g++)" | ||
| export CUDAHOSTCXX | ||
|
|
||
| # Build the wheel | ||
| python -m pip wheel --no-deps --verbose --wheel-dir dist . | ||
|
|
||
| # Rename wheel to include CUDA version suffix | ||
| for wheel in dist/cuda_stf-*.whl; do | ||
| if [[ -f "$wheel" ]]; then | ||
| base_name=$(basename "$wheel" .whl) | ||
| new_name="${base_name}.cu${cuda_version}.whl" | ||
| mv "$wheel" "dist/${new_name}" | ||
| echo "Renamed wheel to: ${new_name}" | ||
| fi | ||
| done | ||
|
|
||
| # Move wheel to output directory | ||
| mkdir -p /workspace/wheelhouse | ||
| mv dist/cuda_stf-*.cu*.whl /workspace/wheelhouse/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| FULL_BUILD=tidy | ||
| LITE_BUILD=libcudacxx cub cudax cccl_c_parallel cccl_c_parallel_v2 python_v2 cccl_c_stf packaging | ||
| LITE_BUILD=libcudacxx cub cudax cccl_c_parallel cccl_c_parallel_v2 python_v2 cccl_c_stf python packaging | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.