Skip to content

Commit

Permalink
Merge remote-tracking branch 'rapidsai/main' into ltoir-reqs
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarkall committed Nov 20, 2023
2 parents e49ad49 + 0b5df09 commit f41ddf6
Show file tree
Hide file tree
Showing 17 changed files with 199 additions and 84 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
name: pr

on:
push:
branches:
- "pull-request/[0-9]+"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pr-builder:
needs:
- checks
- wheel-build-amd64
- wheel-build-arm64
- wheel-test-amd64
- wheel-test-arm64
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/pr-builder.yaml@branch-23.12
checks:
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/checks.yaml@branch-23.12
with:
enable_check_generated_files: false
wheel-build-amd64:
runs-on: linux-amd64-cpu4
strategy:
matrix:
python-version: ["3.9", "3.10"]
container:
image: "rapidsai/ci-wheel:cuda12.0.1-centos7-py${{ matrix.python-version }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get PR Info
id: get-pr-info
uses: rapidsai/shared-actions/get-pr-info@main
- name: Run build_wheel.sh
run: ci/build_wheel.sh
- name: Upload Python Wheel
uses: actions/upload-artifact@v2
with:
path: ./wheel-build
wheel-build-arm64:
runs-on: linux-arm64-cpu4
strategy:
matrix:
python-version: ["3.9", "3.10"]
container:
image: "rapidsai/ci-wheel:cuda12.0.1-rockylinux8-py${{ matrix.python-version }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get PR Info
id: get-pr-info
uses: rapidsai/shared-actions/get-pr-info@main
- name: Run build_wheel.sh
run: ci/build_wheel.sh
- name: Upload Python Wheel
uses: actions/upload-artifact@v2
with:
path: ./wheel-build
wheel-test-amd64:
needs:
- wheel-build-amd64
runs-on: linux-amd64-gpu-v100-latest-1
strategy:
matrix:
python-version: ["3.9", "3.10"]
linux-version: ["ubuntu20.04", "ubuntu18.04"]
container:
image: "rapidsai/citestwheel:cuda12.0.1-${{ matrix.linux-version }}-py${{ matrix.python-version }}"
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get PR Info
id: get-pr-info
uses: rapidsai/shared-actions/get-pr-info@main
- name: Download Python Wheel
uses: actions/download-artifact@v2
with:
path: ./
- name: Run test_wheel.sh
run: ci/test_wheel.sh
wheel-test-arm64:
needs:
- wheel-build-arm64
runs-on: linux-arm64-gpu-a100-latest-1
strategy:
matrix:
python-version: ["3.9", "3.10"]
container:
image: "rapidsai/citestwheel:cuda12.0.1-ubuntu20.04-py${{ matrix.python-version }}"
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get PR Info
id: get-pr-info
uses: rapidsai/shared-actions/get-pr-info@main
- name: Download Python Wheel
uses: actions/download-artifact@v2
with:
path: ./
- name: run test_wheel.sh
run: ci/test_wheel.sh
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ build
*.so
*.egg-info
.*.swp

# compiled test files
pynvjitlink/tests/test_device_functions.*
pynvjitlink/tests/undefined_extern.cubin
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)
project(
pynvjitlink
VERSION 0.1.0
LANGUAGES CXX
LANGUAGES CXX CUDA
)

find_package(Python COMPONENTS Interpreter Development REQUIRED)
Expand All @@ -17,4 +17,6 @@ target_link_libraries(_nvjitlinklib PRIVATE CUDA::nvJitLink_static CUDA::nvptxco

target_compile_options(_nvjitlinklib PRIVATE -Werror -Wall)

target_compile_features(_nvjitlinklib PRIVATE cxx_std_11)

install(TARGETS _nvjitlinklib LIBRARY DESTINATION pynvjitlink)
17 changes: 17 additions & 0 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION


rapids-logger "Install CUDA Toolkit"
yum update
yum install -y epel-release
yum install -y nvidia-driver-latest-dkms
yum install -y cuda-toolkit-12-3

rapids-logger "Check conda environment"
conda list

rapids-logger "Build wheel"
export SCCACHE_S3_NO_CREDENTIALS=1
mkdir -p ./wheel-build
pip wheel . --wheel-dir=./wheel-build -vvv
9 changes: 9 additions & 0 deletions ci/check_style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION

set -euo pipefail

pip install pre-commit

# Run pre-commit checks
pre-commit run --all-files --show-diff-on-failure
18 changes: 18 additions & 0 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION

set -e

rapids-logger "Search artifact directory"
ls ./artifact

rapids-logger "Install wheel"
pip install --find-links ./artifact pynvjitlink

rapids-logger "Build Tests"
cd test_binary_generation && make

rapids-logger "Run Tests"
cd ..
pip install pytest
pytest pynvjitlink/tests
1 change: 1 addition & 0 deletions pynvjitlink/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
Binary file removed pynvjitlink/tests/test_device_functions.a
Binary file not shown.
Binary file removed pynvjitlink/tests/test_device_functions.cubin
Binary file not shown.
Binary file removed pynvjitlink/tests/test_device_functions.fatbin
Binary file not shown.
Binary file removed pynvjitlink/tests/test_device_functions.ltoir
Binary file not shown.
Binary file removed pynvjitlink/tests/test_device_functions.o
Binary file not shown.
57 changes: 0 additions & 57 deletions pynvjitlink/tests/test_device_functions.ptx

This file was deleted.

22 changes: 8 additions & 14 deletions pynvjitlink/tests/test_pynvjitlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,27 @@ def device_functions_ptx():
def undefined_extern_cubin():
return read_test_file('undefined_extern.cubin')

@pytest.mark.skip

def test_create_no_arch_error():
# nvjitlink expects at least the architecture to be specified.
with pytest.raises(RuntimeError,
match='NVJITLINK_ERROR_MISSING_ARCH error'):
_nvjitlinklib.create()


@pytest.mark.skip('Causes fatal error and exit(1)')
def test_invalid_arch_error():
# sm_XX is not a valid architecture
with pytest.raises(RuntimeError,
match='NVJITLINK_ERROR_UNRECOGNIZED_OPTION error'):
_nvjitlinklib.create('-arch=sm_XX')

@pytest.mark.skip

def test_unrecognized_option_error():
with pytest.raises(RuntimeError,
match='NVJITLINK_ERROR_UNRECOGNIZED_OPTION error'):
_nvjitlinklib.create('-fictitious_option')

@pytest.mark.skip

def test_invalid_option_type_error():
with pytest.raises(TypeError,
match='Expecting only strings'):
Expand Down Expand Up @@ -97,9 +96,7 @@ def test_complete_empty():
marks=pytest.mark.xfail),
('device_functions_ptx', InputType.PTX),
('device_functions_object', InputType.OBJECT),
# XXX: Archive type needs debugging - results in a segfault.
pytest.param('device_functions_archive', InputType.LIBRARY,
marks=pytest.mark.skip),
('device_functions_archive', InputType.LIBRARY),
])
def test_add_file(input_file, input_type, request):
filename, data = request.getfixturevalue(input_file)
Expand All @@ -108,7 +105,7 @@ def test_add_file(input_file, input_type, request):
_nvjitlinklib.add_data(handle, input_type.value, data, filename)
_nvjitlinklib.destroy(handle)

@pytest.mark.skip

def test_get_error_log(undefined_extern_cubin):
handle = _nvjitlinklib.create('-arch=sm_75')
filename, data = undefined_extern_cubin
Expand All @@ -118,11 +115,8 @@ def test_get_error_log(undefined_extern_cubin):
_nvjitlinklib.complete(handle)
error_log = _nvjitlinklib.get_error_log(handle)
_nvjitlinklib.destroy(handle)
# XXX: The error message in the log is strange. The actual expected error
# message appears on the terminal:
# error : Undefined reference to '_Z5undefff' in
# 'undefined_extern.cubin'
assert "ERROR 9: finish" in error_log
assert "Undefined reference to '_Z5undefff' " \
"in 'undefined_extern.cubin'" in error_log


def test_get_info_log(device_functions_cubin):
Expand Down Expand Up @@ -188,7 +182,7 @@ def test_get_linked_ptx_from_lto(device_functions_ltoir):
handle = _nvjitlinklib.create('-arch=sm_75', '-lto', '-ptx')
_nvjitlinklib.add_data(handle, input_type, data, filename)
_nvjitlinklib.complete(handle)
ptx = _nvjitlinklib.get_linked_ptx(handle)
_nvjitlinklib.get_linked_ptx(handle)
_nvjitlinklib.destroy(handle)


Expand Down
Loading

0 comments on commit f41ddf6

Please sign in to comment.