Skip to content

Commit d65f80d

Browse files
pass test bin dir as an env var
1 parent 4ce95a7 commit d65f80d

File tree

4 files changed

+52
-25
lines changed

4 files changed

+52
-25
lines changed

ci/test_conda_pynvjitlink.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ set +u
5353
conda install -c rapidsai pynvjitlink
5454
set -u
5555

56-
rapids_logger "Build tests"
56+
rapids-logger "Build tests"
5757

5858
PY_SCRIPT="
5959
import numba_cuda
@@ -62,14 +62,14 @@ test_dir = root + \"numba/cuda/tests/test_binary_generation/\"
6262
print(test_dir)
6363
"
6464

65-
TEST_DIR=$(python -c "$PY_SCRIPT")
66-
pushd $TEST_DIR
65+
NUMBA_CUDA_TEST_BIN_DIR=$(python -c "$PY_SCRIPT")
66+
pushd $NUMBA_CUDA_TEST_BIN_DIR
6767
make
6868
popd
6969

7070

7171
rapids-logger "Run Tests"
72-
ENABLE_PYNVJITLINK=1 python -m numba.runtests numba.cuda.tests -v
72+
ENABLE_PYNVJITLINK=1 NUMBA_CUDA_TEST_BIN_DIR=$NUMBA_CUDA_TEST_BIN_DIR python -m numba.runtests numba.cuda.tests -v
7373

7474
popd
7575

ci/test_wheel_pynvjitlink.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ test_dir = root + \"numba/cuda/tests/test_binary_generation/\"
2121
print(test_dir)
2222
"
2323

24-
TEST_DIR=$(python -c "$PY_SCRIPT")
25-
pushd $TEST_DIR
24+
NUMBA_CUDA_TEST_BIN_DIR=$(python -c "$PY_SCRIPT")
25+
pushd $NUMBA_CUDA_TEST_BIN_DIR
2626
make
2727
popd
2828

@@ -42,6 +42,6 @@ rapids-logger "Show Numba system info"
4242
python -m numba --sysinfo
4343

4444
rapids-logger "Run Tests"
45-
ENABLE_PYNVJITLINK=1 python -m numba.runtests numba.cuda.tests -v
45+
ENABLE_PYNVJITLINK=1 NUMBA_CUDA_TEST_BIN_DIR=$NUMBA_CUDA_TEST_BIN_DIR python -m numba.runtests numba.cuda.tests -v
4646

4747
popd

numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,39 @@
44
from numba.cuda.cudadrv.driver import PyNvJitLinker
55

66
import itertools
7+
import os
78
from numba.cuda import get_current_device
89
from numba import cuda
910
from numba import config
1011

11-
12-
@unittest.skipIf(not config.ENABLE_PYNVJITLINK, "pynvjitlink not enabled")
12+
TEST_BIN_DIR = os.getenv("NUMBA_CUDA_TEST_BIN_DIR")
13+
test_device_functions_a = os.path.join(
14+
TEST_BIN_DIR, "test_device_functions.a"
15+
)
16+
test_device_functions_cubin = os.path.join(
17+
TEST_BIN_DIR, "test_device_functions.cubin"
18+
)
19+
test_device_functions_cu = os.path.join(
20+
TEST_BIN_DIR, "test_device_functions.cu"
21+
)
22+
test_device_functions_fatbin = os.path.join(
23+
TEST_BIN_DIR, "test_device_functions.fatbin"
24+
)
25+
test_device_functions_o = os.path.join(
26+
TEST_BIN_DIR, "test_device_functions.o"
27+
)
28+
test_device_functions_ptx = os.path.join(
29+
TEST_BIN_DIR, "test_device_functions.ptx"
30+
)
31+
test_device_functions_ltoir = os.path.join(
32+
TEST_BIN_DIR, "test_device_functions.ltoir"
33+
)
34+
35+
36+
@unittest.skipIf(
37+
not config.ENABLE_PYNVJITLINK or not TEST_BIN_DIR,
38+
"pynvjitlink not enabled"
39+
)
1340
@skip_on_cudasim("Linking unsupported in the simulator")
1441
class TestLinker(CUDATestCase):
1542
_NUMBA_NVIDIA_BINDING_0_ENV = {"NUMBA_CUDA_USE_NVIDIA_BINDING": "0"}
@@ -91,12 +118,12 @@ def test_nvjitlink_ptx_compile_options(self):
91118

92119
def test_nvjitlink_add_file_guess_ext_linkable_code(self):
93120
files = (
94-
"test_device_functions.a",
95-
"test_device_functions.cubin",
96-
"test_device_functions.cu",
97-
"test_device_functions.fatbin",
98-
"test_device_functions.o",
99-
"test_device_functions.ptx",
121+
test_device_functions_a,
122+
test_device_functions_cubin,
123+
test_device_functions_cu,
124+
test_device_functions_fatbin,
125+
test_device_functions_o,
126+
test_device_functions_ptx,
100127
)
101128
for file in files:
102129
with self.subTest(file=file):
@@ -106,7 +133,7 @@ def test_nvjitlink_add_file_guess_ext_linkable_code(self):
106133
patched_linker.add_file_guess_ext(file)
107134

108135
def test_nvjitlink_test_add_file_guess_ext_invalid_input(self):
109-
with open("test_device_functions.cubin", "rb") as f:
136+
with open(test_device_functions_cubin, "rb") as f:
110137
content = f.read()
111138

112139
patched_linker = PyNvJitLinker(
@@ -121,12 +148,12 @@ def test_nvjitlink_test_add_file_guess_ext_invalid_input(self):
121148

122149
def test_nvjitlink_jit_with_linkable_code(self):
123150
files = (
124-
"test_device_functions.a",
125-
"test_device_functions.cubin",
126-
"test_device_functions.cu",
127-
"test_device_functions.fatbin",
128-
"test_device_functions.o",
129-
"test_device_functions.ptx",
151+
test_device_functions_a,
152+
test_device_functions_cubin,
153+
test_device_functions_cu,
154+
test_device_functions_fatbin,
155+
test_device_functions_o,
156+
test_device_functions_ptx,
130157
)
131158
for file in files:
132159
with self.subTest(file=file):
@@ -142,7 +169,7 @@ def kernel(result):
142169
assert result[0] == 3
143170

144171
def test_nvjitlink_jit_with_linkable_code_lto(self):
145-
file = "test_device_functions.ltoir"
172+
file = test_device_functions_ltoir
146173

147174
sig = "uint32(uint32, uint32)"
148175
add_from_numba = cuda.declare_device("add_from_numba", sig)
@@ -156,7 +183,7 @@ def kernel(result):
156183
assert result[0] == 3
157184

158185
def test_nvjitlink_jit_with_invalid_linkable_code(self):
159-
with open("test_device_functions.cubin", "rb") as f:
186+
with open(test_device_functions_cubin, "rb") as f:
160187
content = f.read()
161188
with self.assertRaisesRegex(
162189
TypeError, "Expected path to file or a LinkableCode"

numba_cuda/numba/cuda/tests/test_binary_generation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ LIBRARY_FLAGS := $(GENCODE) -lib
3232
FATBIN_FLAGS := $(FATBIN_GENCODE) --fatbin
3333
LTOIR_FLAGS := $(LTOIR_GENCODE) -dc
3434

35-
OUTPUT_DIR := ../cudadrv
35+
OUTPUT_DIR := ./
3636

3737
all:
3838
@echo "GPU CC: $(GPU_CC)"

0 commit comments

Comments
 (0)