Skip to content

Commit b041f32

Browse files
authored
Merge branch 'main' into multi-gpu
2 parents fde06d5 + 527f137 commit b041f32

File tree

10 files changed

+230
-28
lines changed

10 files changed

+230
-28
lines changed

.github/workflows/gh-build-and-test.yml renamed to .github/workflows/build-and-test.yml

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
on: workflow_call
1+
name: "CI: Build and test"
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{
5+
github.ref_name == 'main' && format('ci-main-build-test-{0}', github.run_id) ||
6+
format('ci-pr-build-test-on-{0}-against-branch-{1}', github.event_name, github.ref_name)
7+
}}
8+
cancel-in-progress: true
9+
10+
on:
11+
push:
12+
branches:
13+
- "pull-request/[0-9]+"
14+
- "main"
215

316
jobs:
417
build:
@@ -192,7 +205,7 @@ jobs:
192205
runner: H100
193206
name: Test (${{ matrix.host-platform }}, Python ${{ matrix.python-version }}, CUDA ${{ matrix.cuda-version }}, Runner ${{ matrix.runner }})
194207
# The build stage could fail but we want the CI to keep moving.
195-
if: ${{ (github.repository_owner == 'nvidia') && always() }}
208+
if: ${{ github.repository_owner == 'nvidia' && always() }}
196209
permissions:
197210
id-token: write # This is required for configure-aws-credentials
198211
contents: read # This is required for actions/checkout
@@ -209,7 +222,7 @@ jobs:
209222
needs:
210223
- build
211224
steps:
212-
- name: Run nvidia-smi to make sure GPU is working
225+
- name: Ensure GPU is working
213226
shell: bash --noprofile --norc -xeuo pipefail {0}
214227
run: nvidia-smi
215228

@@ -319,3 +332,18 @@ jobs:
319332
pip install -r "tests/requirements-cu${TEST_CUDA_MAJOR}.txt"
320333
pytest -rxXs tests/
321334
popd
335+
336+
doc:
337+
# The build stage could fail but we want the CI to keep moving.
338+
if: ${{ github.repository_owner == 'nvidia' && always() }}
339+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
340+
permissions:
341+
id-token: write
342+
contents: write
343+
needs:
344+
- build
345+
secrets: inherit
346+
uses:
347+
./.github/workflows/build-docs.yml
348+
with:
349+
build_ctk_ver: ${{ needs.build.outputs.BUILD_CTK_VER }}

.github/workflows/build-docs.yml

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: "CI: Build and update docs"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build_ctk_ver:
7+
type: string
8+
required: true
9+
10+
jobs:
11+
build:
12+
name: Build docs
13+
# The build stage could fail but we want the CI to keep moving.
14+
if: ${{ github.repository_owner == 'nvidia' && always() }}
15+
# WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327)
16+
runs-on: linux-amd64-gpu-t4-latest-1-testing
17+
#runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
shell: bash -el {0}
21+
steps:
22+
# WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327)
23+
- name: Ensure GPU is working
24+
run: nvidia-smi
25+
26+
- name: Checkout ${{ github.event.repository.name }}
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
# TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267
32+
# is resolved
33+
34+
- name: Set up miniforge
35+
uses: conda-incubator/setup-miniconda@v3
36+
with:
37+
activate-environment: cuda-python-docs
38+
environment-file: ./cuda_python/docs/environment-docs.yml
39+
miniforge-version: latest
40+
conda-remove-defaults: "true"
41+
python-version: 3.12
42+
43+
- name: Check conda env
44+
run: |
45+
conda info
46+
conda list
47+
conda config --show-sources
48+
conda config --show
49+
50+
# WAR: Building the doc currently requires CTK installed (NVIDIA/cuda-python#326,327)
51+
- name: Set up mini CTK
52+
uses: ./.github/actions/fetch_ctk
53+
continue-on-error: false
54+
with:
55+
host-platform: linux-64
56+
cuda-version: ${{ inputs.build_ctk_ver }}
57+
58+
- name: Set environment variables
59+
run: |
60+
PYTHON_VERSION_FORMATTED="312" # see above
61+
REPO_DIR=$(pwd)
62+
63+
# make outputs from the previous job as env vars
64+
echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64-${{ github.sha }}" >> $GITHUB_ENV
65+
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
66+
echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build_ctk_ver }}-linux-64-${{ github.sha }}" >> $GITHUB_ENV
67+
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
68+
69+
- name: Download cuda.bindings build artifacts
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
73+
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
74+
75+
- name: Display structure of downloaded cuda.bindings artifacts
76+
run: |
77+
pwd
78+
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
79+
80+
- name: Download cuda.core build artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
84+
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
85+
86+
- name: Display structure of downloaded cuda.core build artifacts
87+
run: |
88+
pwd
89+
ls -lahR $CUDA_CORE_ARTIFACTS_DIR
90+
91+
- name: Install all packages
92+
run: |
93+
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
94+
pip install *.whl
95+
popd
96+
97+
pushd "${CUDA_CORE_ARTIFACTS_DIR}"
98+
pip install *.whl
99+
popd
100+
101+
- name: Build all (latest) docs
102+
id: build
103+
run: |
104+
pushd cuda_python/docs/
105+
./build_all_docs.sh latest-only
106+
ls -l build
107+
popd
108+
109+
mkdir -p artifacts/docs
110+
mv cuda_python/docs/build/html/* artifacts/docs/
111+
112+
# Note: currently this is only for manual inspection. This step will become
113+
# required once we switch to use GHA for doc deployment (see the bottom).
114+
- name: Upload doc artifacts
115+
uses: actions/upload-pages-artifact@v3
116+
with:
117+
path: artifacts/
118+
retention-days: 3
119+
120+
# The step below is not executed unless when building on main.
121+
- name: Deploy doc update
122+
if: ${{ github.ref_name == 'main' && success() }}
123+
uses: JamesIves/github-pages-deploy-action@v4
124+
with:
125+
folder: artifacts/docs/
126+
git-config-name: cuda-python-bot
127+
target-folder: docs/
128+
commit-message: "Deploy latest docs: ${{ github.sha }}"
129+
clean: false

.github/workflows/ci-gh.yml

-17
This file was deleted.

cuda_bindings/docs/build_docs.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
set -ex
44

5+
if [[ "$#" == "0" ]]; then
6+
LATEST_ONLY="0"
7+
elif [[ "$#" == "1" && "$1" == "latest-only" ]]; then
8+
LATEST_ONLY="1"
9+
else
10+
echo "usage: ./build_docs.sh [latest-only]"
11+
exit 1
12+
fi
13+
514
# SPHINX_CUDA_BINDINGS_VER is used to create a subdir under build/html
615
# (the Makefile file for sphinx-build also honors it if defined).
716
# If there's a post release (ex: .post1) we don't want it to show up in the
@@ -28,7 +37,11 @@ cp ./versions.json build/html
2837
cp source/_templates/main.html build/html/index.html
2938

3039
# ensure that the latest docs is the one we built
31-
cp -r build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest
40+
if [[ $LATEST_ONLY == "0" ]]; then
41+
cp -r build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest
42+
else
43+
mv build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest
44+
fi
3245

3346
# ensure that the Sphinx reference uses the latest docs
3447
cp build/html/latest/objects.inv build/html

cuda_core/cuda/core/experimental/_linker.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
import ctypes
6+
import warnings
67
import weakref
78
from contextlib import contextmanager
89
from dataclasses import dataclass
@@ -42,6 +43,12 @@ def _decide_nvjitlink_or_driver():
4243
_nvjitlink = None
4344

4445
if _nvjitlink is None:
46+
warnings.warn(
47+
"nvJitLink is not installed or too old (<12.3). Therefore it is not usable "
48+
"and the culink APIs will be used instead.",
49+
stacklevel=3,
50+
category=RuntimeWarning,
51+
)
4552
_driver = cuda
4653
return True
4754
else:
@@ -80,7 +87,8 @@ class LinkerOptions:
8087
"""Customizable :obj:`Linker` options.
8188
8289
Since the linker would choose to use nvJitLink or the driver APIs as the linking backed,
83-
not all options are applicable.
90+
not all options are applicable. When the system's installed nvJitLink is too old (<12.3),
91+
or not installed, the driver APIs (cuLink) will be used instead.
8492
8593
Attributes
8694
----------

cuda_core/docs/build_docs.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
set -ex
44

5+
if [[ "$#" == "0" ]]; then
6+
LATEST_ONLY="0"
7+
elif [[ "$#" == "1" && "$1" == "latest-only" ]]; then
8+
LATEST_ONLY="1"
9+
else
10+
echo "usage: ./build_docs.sh [latest-only]"
11+
exit 1
12+
fi
13+
514
# SPHINX_CUDA_CORE_VER is used to create a subdir under build/html
615
# (the Makefile file for sphinx-build also honors it if defined)
716
if [[ -z "${SPHINX_CUDA_CORE_VER}" ]]; then
@@ -24,7 +33,11 @@ cp ./versions.json build/html
2433
cp source/_templates/main.html build/html/index.html
2534

2635
# ensure that the latest docs is the one we built
27-
cp -r build/html/${SPHINX_CUDA_CORE_VER} build/html/latest
36+
if [[ $LATEST_ONLY == "0" ]]; then
37+
cp -r build/html/${SPHINX_CUDA_CORE_VER} build/html/latest
38+
else
39+
mv build/html/${SPHINX_CUDA_CORE_VER} build/html/latest
40+
fi
2841

2942
# ensure that the Sphinx reference uses the latest docs
3043
cp build/html/latest/objects.inv build/html

cuda_core/docs/source/install.md

+15
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ and likewise use `[cu11]` for CUDA 11.
2525
Note that using `cuda.core` with NVRTC or nvJitLink installed from PyPI via `pip install` is currently
2626
not supported. This will be fixed in a future release.
2727

28+
## Installing from Conda (conda-forge)
29+
30+
Same as above, `cuda.core` can be installed in a CUDA 11 or 12 environment. For example with CUDA 12:
31+
```console
32+
$ conda install -c conda-forge cuda-core cuda-version=12
33+
```
34+
and likewise use `cuda-version=11` for CUDA 11.
35+
36+
Note that to use `cuda.core` with nvJitLink installed from conda-forge currently requires it to
37+
be separately installed:
38+
```console
39+
$ conda install -c conda-forge libnvjitlink
40+
```
41+
(can be combined with the command above). This extra step will be removed in a future release.
42+
2843
## Installing from Source
2944

3045
```console

cuda_core/docs/source/release/0.1.1-notes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Released on Dec 20, 2024
1616
- Add a `cuda.core.experimental.system` module for querying system- or process- wide information.
1717
- Add `LaunchConfig.cluster` to support thread block clusters on Hopper GPUs.
1818

19-
## Enchancements
19+
## Enhancements
2020

2121
- The internal handle held by `ObjectCode` is now lazily initialized upon first touch.
2222
- Support TCC devices with a default synchronous memory resource to avoid the use of memory pools.

cuda_python/docs/build_all_docs.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ set -ex
44

55
# build cuda-python docs
66
rm -rf build
7-
./build_docs.sh
7+
./build_docs.sh $@
88

99
# build cuda-bindings docs
1010
CUDA_BINDINGS_PATH=build/html/cuda-bindings
1111
mkdir -p $CUDA_BINDINGS_PATH
1212
pushd .
1313
cd ../../cuda_bindings/docs
1414
rm -rf build
15-
./build_docs.sh
15+
./build_docs.sh $@
1616
cp -r build/html/* "$(dirs -l +1)"/$CUDA_BINDINGS_PATH
1717
popd
1818

@@ -22,6 +22,6 @@ mkdir -p $CUDA_CORE_PATH
2222
pushd .
2323
cd ../../cuda_core/docs
2424
rm -rf build
25-
./build_docs.sh
25+
./build_docs.sh $@
2626
cp -r build/html/* "$(dirs -l +1)"/$CUDA_CORE_PATH
2727
popd

cuda_python/docs/build_docs.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
set -ex
44

5+
if [[ "$#" == "0" ]]; then
6+
LATEST_ONLY="0"
7+
elif [[ "$#" == "1" && "$1" == "latest-only" ]]; then
8+
LATEST_ONLY="1"
9+
else
10+
echo "usage: ./build_docs.sh [latest-only]"
11+
exit 1
12+
fi
13+
514
# SPHINX_CUDA_PYTHON_VER is used to create a subdir under build/html
615
# (the Makefile file for sphinx-build also honors it if defined).
716
# If there's a post release (ex: .post1) we don't want it to show up in the
@@ -28,7 +37,11 @@ cp ./versions.json build/html
2837
cp source/_templates/main.html build/html/index.html
2938

3039
# ensure that the latest docs is the one we built
31-
cp -r build/html/${SPHINX_CUDA_PYTHON_VER} build/html/latest
40+
if [[ $LATEST_ONLY == "0" ]]; then
41+
cp -r build/html/${SPHINX_CUDA_PYTHON_VER} build/html/latest
42+
else
43+
mv build/html/${SPHINX_CUDA_PYTHON_VER} build/html/latest
44+
fi
3245

3346
# ensure that the Sphinx reference uses the latest docs
3447
cp build/html/latest/objects.inv build/html

0 commit comments

Comments
 (0)