Skip to content

Commit

Permalink
Merge branch 'main' into update-readme-conda
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice authored Mar 7, 2024
2 parents db592cf + ace1a0c commit b0a3939
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

CONDA_PREFIX = os.environ["CONDA_PREFIX"]
NVJITLINK_DIR = Path(__file__).parent
VER = sys.version_info
PYTHON_INCLUDE_NAME = "python3.10" # Not ideal
PYTHON_VERSION = sys.version_info
PYTHON_INCLUDE_NAME = "python%d.%d" % PYTHON_VERSION

CONDA_INCLUDE_DIR = Path(CONDA_PREFIX, "include")
PYTHON_INCLUDE_DIR = Path(CONDA_INCLUDE_DIR, PYTHON_INCLUDE_NAME)
NVJITLINK_INCLUDE_DIR = Path(NVJITLINK_DIR, "include")
CUDA_INCLUDE_DIR = "/usr/local/cuda-12.0/include"
CUDA_INCLUDE_DIR = "/usr/local/cuda/include"

flags = [
"--cuda-gpu-arch=sm_50",
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

project(
pynvjitlink
VERSION 0.1.12
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX CUDA
)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# <div align="left"><img src="https://rapids.ai/assets/images/rapids_logo.png" width="90px"/>&nbsp;pynvjitlink</div>

The [RAPIDS](https://rapids.ai) pynvjitlink library provides a Python binding for the
[nvJitLink library](https://docs.nvidia.com/cuda/nvJitLink/index.html).
[nvJitLink library](https://docs.nvidia.com/cuda/nvjitlink/index.html).

## Installation with pip

Expand Down
2 changes: 1 addition & 1 deletion ci/install_latest_cuda_toolkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ else
exit 1
fi

yum install -y cuda-toolkit-12-3
yum install -y cuda-toolkit-12-4
2 changes: 0 additions & 2 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ function sed_runner() {

# Centralized version file update
echo "${NEXT_FULL_TAG}" > pynvjitlink/VERSION
sed_runner 's/'"^ VERSION [0-9\.]*"'/'" VERSION ${NEXT_FULL_TAG}"'/g' CMakeLists.txt
sed_runner 's/^version = "[0-9\.]*"/version = "'${NEXT_FULL_TAG}'"/g' pyproject.toml
13 changes: 10 additions & 3 deletions ci/test_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ set -euo pipefail

. /opt/conda/etc/profile.d/conda.sh

rapids-logger "Generate testing dependencies"
rapids-logger "Install testing dependencies"
# TODO: Replace with rapids-dependency-file-generator
rapids-mamba-retry create -n test \
c-compiler \
cxx-compiler \
cuda-nvcc \
cuda-nvrtc \
cuda-version=${RAPIDS_CUDA_VERSION%.*} \
"numba>=0.58" \
make \
psutil \
pytest \
python=${RAPIDS_PY_VERSION}

Expand All @@ -40,15 +42,20 @@ popd
rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "Show Numba system info"
python -m numba --sysinfo

EXITCODE=0
trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest pynvjitlink"
pytest \
rapids-logger "Run Tests"
pushd pynvjitlink/tests
python -m pytest \
--cache-clear \
--junitxml="${RAPIDS_TESTS_DIR}/junit-pynvjitlink.xml" \
-v
popd

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
8 changes: 6 additions & 2 deletions ci/test_patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ set -euo pipefail

. /opt/conda/etc/profile.d/conda.sh

rapids-logger "Generate testing dependencies"
rapids-logger "Install testing dependencies"
# TODO: Replace with rapids-dependency-file-generator
rapids-mamba-retry create -n test \
cuda-nvcc-impl \
cuda-nvcc \
cuda-nvrtc \
cuda-version=${RAPIDS_CUDA_VERSION%.*} \
"numba>=0.58" \
psutil \
python=${RAPIDS_PY_VERSION}

# Temporarily allow unbound variables for conda activation.
Expand All @@ -30,6 +31,9 @@ rapids-mamba-retry install \
rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "Show Numba system info"
python -m numba --sysinfo

EXITCODE=0
trap "EXITCODE=1" ERR
set +e
Expand Down
28 changes: 22 additions & 6 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,38 @@

set -euo pipefail

rapids-logger "Install testing dependencies"
# TODO: Replace with rapids-dependency-file-generator
python -m pip install \
"numba>=0.58" \
psutil \
pytest

rapids-logger "Download Wheel"
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
RAPIDS_PY_WHEEL_NAME="pynvjitlink_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist/

# This is the version of the suffix with a preceding hyphen. It's used
# everywhere except in the final wheel name.
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"
RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"}/
mkdir -p "${RAPIDS_TESTS_DIR}"

rapids-logger "Install wheel"
pip install --find-links ./dist pynvjitlink${PACKAGE_CUDA_SUFFIX}
python -m pip install $(echo ./dist/pynvjitlink_${RAPIDS_PY_CUDA_SUFFIX}*.whl)

rapids-logger "Build Tests"
pushd test_binary_generation
make
popd

rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "Show Numba system info"
python -m numba --sysinfo

rapids-logger "Run Tests"
pip install pytest
pytest pynvjitlink/tests
pushd pynvjitlink/tests
python -m pytest \
--cache-clear \
--junitxml="${RAPIDS_TESTS_DIR}/junit-pynvjitlink.xml" \
-v
popd
2 changes: 1 addition & 1 deletion conda/recipes/pynvjitlink/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ cuda_compiler:
- cuda-nvcc

cuda_compiler_version:
- 12.2
- 12.4
6 changes: 5 additions & 1 deletion conda/recipes/pynvjitlink/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Copyright (c) 2018-2024, NVIDIA CORPORATION.

{% set data = load_file_data("pyproject.toml") %}
{% set version = load_file_regex(
load_file="pynvjitlink/VERSION",
regex_pattern="(?P<value>.*)"
)[0] %}
{% set project_data = data.get("project") %}
{% set project_urls = project_data["urls"] %}

package:
name: pynvjitlink
version: {{ project_data["version"] }}
version: {{ version }}

source:
path: ../../..
Expand Down
2 changes: 1 addition & 1 deletion pynvjitlink/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.12
0.1.13
2 changes: 1 addition & 1 deletion pynvjitlink/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def add_file(self, path, kind):
elif kind == FILE_EXTENSION_MAP["fatbin"]:
fn = self._linker.add_fatbin
elif kind == FILE_EXTENSION_MAP["a"]:
raise LinkerError("Don't know how to link archives")
fn = self._linker.add_library
elif kind == FILE_EXTENSION_MAP["ptx"]:
return self.add_ptx(data, name)
elif kind == FILE_EXTENSION_MAP["o"]:
Expand Down
5 changes: 0 additions & 5 deletions pynvjitlink/tests/test_pynvjitlink_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ def test_add_cubin_with_fatbin_error(device_functions_fatbin):
nvjitlinker.add_cubin(device_functions_fatbin, name)


@pytest.mark.xfail(
reason="Fails in conda due to using CUDA 12.2u2. This should be fixed "
"when requiring CUDA 12.3 nvjitlink library. See: "
"https://github.com/rapidsai/pynvjitlink/pull/33#issuecomment-1885182905"
)
def test_add_fatbin_with_cubin_error(device_functions_cubin):
nvjitlinker = NvJitLinker("-arch=sm_75")
name = "test_device_functions.cubin"
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "pynvjitlink"
version = "0.1.12"
dynamic = ["version"]
description = "nvJitLink Python binding"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
Expand All @@ -29,5 +29,7 @@ License = "https://github.com/rapidsai/pynvjitlink/blob/main/LICENSE"
[tool.setuptools]
license-files = ["LICENSE"]

[tool.setuptools.dynamic]
version = {file = "pynvjitlink/VERSION"}
[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
input = "pynvjitlink/VERSION"
regex = "(?P<value>.*)"

0 comments on commit b0a3939

Please sign in to comment.