Skip to content

Commit e3bc343

Browse files
authored
Merge pull request #138 from NVIDIA/11.8.x-new-layout
Patch 11.8.4
2 parents 64cc9ae + 13fed95 commit e3bc343

File tree

112 files changed

+38860
-26284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+38860
-26284
lines changed

.gitignore

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,32 @@ __pycache__/
1111
.pytest_cache/
1212
.benchmarks/
1313
*.cpp
14-
!cuda/_lib/param_packer.cpp
15-
!cuda/_cuda/loader.cpp
14+
!cuda/cuda/bindings/_lib/param_packer.cpp
15+
!cuda/cuda/bindings/_bindings/loader.cpp
1616

1717
# CUDA Python specific (auto-generated)
18-
cuda/_cuda/ccuda.pxd
19-
cuda/_cuda/ccuda.pyx
20-
cuda/_cuda/cnvrtc.pxd
21-
cuda/_cuda/cnvrtc.pyx
22-
cuda/_lib/ccudart/ccudart.pxd
23-
cuda/_lib/ccudart/ccudart.pyx
24-
cuda/_lib/ccudart/utils.pxd
25-
cuda/_lib/ccudart/utils.pyx
26-
cuda/_lib/utils.pxd
27-
cuda/_lib/utils.pyx
28-
cuda/ccuda.pxd
29-
cuda/ccuda.pyx
30-
cuda/ccudart.pxd
31-
cuda/ccudart.pyx
32-
cuda/cnvrtc.pxd
33-
cuda/cnvrtc.pyx
34-
cuda/cuda.pxd
35-
cuda/cuda.pyx
36-
cuda/cudart.pxd
37-
cuda/cudart.pyx
38-
cuda/nvrtc.pxd
39-
cuda/nvrtc.pyx
18+
cuda/cuda/bindings/_bindings/cydriver.pxd
19+
cuda/cuda/bindings/_bindings/cydriver.pyx
20+
cuda/cuda/bindings/_bindings/cynvrtc.pxd
21+
cuda/cuda/bindings/_bindings/cynvrtc.pyx
22+
cuda/cuda/bindings/_lib/cyruntime/cyruntime.pxd
23+
cuda/cuda/bindings/_lib/cyruntime/cyruntime.pyx
24+
cuda/cuda/bindings/_lib/cyruntime/utils.pxd
25+
cuda/cuda/bindings/_lib/cyruntime/utils.pyx
26+
cuda/cuda/bindings/_lib/utils.pxd
27+
cuda/cuda/bindings/_lib/utils.pyx
28+
cuda/cuda/bindings/cydriver.pxd
29+
cuda/cuda/bindings/cydriver.pyx
30+
cuda/cuda/bindings/cyruntime.pxd
31+
cuda/cuda/bindings/cyruntime.pyx
32+
cuda/cuda/bindings/cynvrtc.pxd
33+
cuda/cuda/bindings/cynvrtc.pyx
34+
cuda/cuda/bindings/driver.pxd
35+
cuda/cuda/bindings/driver.pyx
36+
cuda/cuda/bindings/runtime.pxd
37+
cuda/cuda/bindings/runtime.pyx
38+
cuda/cuda/bindings/nvrtc.pxd
39+
cuda/cuda/bindings/nvrtc.pyx
4040

4141
# Distribution / packaging
4242
.Python
@@ -168,3 +168,6 @@ dmypy.json
168168

169169
# Cython debug symbols
170170
cython_debug/
171+
172+
# Dont ignore
173+
!.github/actions/build/

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: cuda_python
2+
channels:
3+
- defaults
4+
dependencies:
5+
- python>=3.10
6+
- cython>=3.0.0
7+
- pytest>=6.2.4
8+
- numpy>=1.21.1
9+
- setuptools
10+
- wheel
11+
- pip
12+
- cuda-version=12.6
13+
- cuda-cudart-static
14+
- cuda-driver-dev
15+
- cuda-cudart-dev
16+
- cuda-profiler-api
17+
- cuda-nvrtc-dev
18+
- cuda-nvcc
19+
- pip:
20+
- pytest-benchmark>=3.4.1
21+
- pyclibrary>=0.1.7
22+
- versioneer==0.29
23+
- tomli; python_version < "3.11"
24+
- pywin32; sys_platform == 'win32'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "packages" : {} }

continuous_integration/scripts/build

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
build_ci() {
4+
set -xeou pipefail
5+
6+
cd "${REPO_DIR}"
7+
8+
export CUDA_HOME="${CONDA_PREFIX}/targets/x86_64-linux"
9+
export PARALLEL_LEVEL=$(nproc --ignore 1)
10+
11+
python setup.py bdist_wheel
12+
}
13+
14+
build_project() {
15+
set -xeou pipefail
16+
17+
export PYTHONUNBUFFERED=1
18+
19+
. setup-utils;
20+
init_build_env "$@";
21+
22+
git config --global --add safe.directory "$REPO_DIR/.git"
23+
24+
case "${BUILD_TYPE}" in
25+
ci) build_ci;;
26+
*) return 1;;
27+
esac
28+
}
29+
30+
(build_project "$@");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
activate_conda_env() {
4+
set +xu
5+
eval "$(conda shell.bash hook)"
6+
conda activate "${CONDA_ENV}";
7+
set -xu
8+
: ${PYTHON_VERSION:=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")}
9+
export PYTHON_VERSION
10+
}
11+
12+
conda_info() {
13+
set +x
14+
conda info
15+
set -x
16+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set_initial_env() {
4+
set -xeuo pipefail
5+
6+
export PATH="${PATH}:${REPO_DIR}/continuous_integration/scripts"
7+
}
8+
9+
entrypoint() {
10+
set -xeuo pipefail
11+
set_initial_env;
12+
13+
git config --global --add safe.directory "$REPO_DIR/.git"
14+
15+
cd "${REPO_DIR}"
16+
17+
exec "$@";
18+
}
19+
20+
entrypoint "$@";
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
make_ci_env() {
6+
mamba env create -n "${CONDA_ENV}" -f "${REPO_DIR}/continuous_integration/environment.yml"
7+
}
8+
9+
make_test_env() {
10+
. conda-utils
11+
12+
mamba env create -n "${CONDA_ENV}" -f "${REPO_DIR}/continuous_integration/environment.yml"
13+
14+
activate_conda_env
15+
16+
pip install "${ARTIFACTS_DIR}"/*.whl
17+
18+
}
19+
20+
make_conda_env() {
21+
set -xeuo pipefail
22+
23+
. setup-utils;
24+
set_base_defs;
25+
26+
case "$1" in
27+
ci) make_ci_env;;
28+
test) make_test_env;;
29+
*) return 1;;
30+
esac
31+
32+
return 0;
33+
}
34+
35+
(make_conda_env "$@");
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import json
5+
from jinja2 import Environment, FileSystemLoader
6+
import os
7+
import re
8+
9+
# TODO: make this work for arbitrary context. ie. implement replace_using_context()
10+
def replace_placeholder(source_str, variable_name, variable_value):
11+
# Escaping any regex special characters in variable_name
12+
variable_name_escaped = re.escape(variable_name)
13+
14+
# Using regular expression to replace ${variable_name} with actual variable_value
15+
# \s* means any amount of whitespace (including none)
16+
# pattern = rf'\$\{{\s*\{{\s*{variable_name_escaped}\s*\}}\s*\}}'
17+
pattern = rf'<<\s*{variable_name_escaped}\s*>>'
18+
return re.sub(pattern, variable_value.strip(), source_str)
19+
20+
# Setup command-line argument parsing
21+
parser = argparse.ArgumentParser(description='Render a Jinja2 template using a JSON context.')
22+
parser.add_argument('template_file', type=str, help='Path to the Jinja2 template file (with .j2 extension).')
23+
parser.add_argument('json_file', type=str, help='Path to the JSON file to use as the rendering context.')
24+
parser.add_argument('output_file', type=str, help='Path to the output file.')
25+
26+
args = parser.parse_args()
27+
28+
# Load JSON file as the rendering context
29+
with open(args.json_file, 'r') as file:
30+
context = json.load(file)
31+
32+
# Setup Jinja2 environment and load the template
33+
env = Environment(
34+
loader=FileSystemLoader(searchpath='./'),
35+
variable_start_string='<<',
36+
variable_end_string='>>',
37+
block_start_string='<%',
38+
block_end_string='%>',
39+
comment_start_string='<#',
40+
comment_end_string='#>')
41+
env.filters['replace_placeholder'] = replace_placeholder
42+
43+
template = env.get_template(args.template_file)
44+
45+
# Render the template with the context
46+
rendered_content = template.render(context)
47+
# print(rendered_content)
48+
49+
with open(args.output_file, 'w') as file:
50+
file.write(rendered_content)
51+
52+
print(f'Template rendered successfully. Output saved to {args.output_file}')

0 commit comments

Comments
 (0)