Skip to content

Commit 397cc79

Browse files
committed
fix: replace pytest.skip with requirement_not_met in conjugateGradientMultiBlockCG example
The example imported pytest inside main() and used pytest.skip() for requirement checks, which is inappropriate for a standalone script. All other cuda.bindings examples use requirement_not_met() from _example_helpers for this purpose. Replace all pytest.skip() calls with requirement_not_met() and remove the local pytest import, aligning this example with the established pattern used across the rest of the examples directory. Fixes #1530 Relates to #1839 Signed-off-by: Eden <edenfunf@users.noreply.github.com>
1 parent 5064470 commit 397cc79

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
KernelHelper,
2727
check_cuda_errors,
2828
find_cuda_device,
29+
requirement_not_met,
2930
)
3031

3132
conjugate_gradient_multi_block_cg = """\
@@ -213,31 +214,29 @@ def gen_tridiag(i, j, val, n, nz):
213214
def main():
214215
tol = 1e-5
215216

216-
import pytest
217-
218217
# WAIVE: Due to bug in NVRTC
219-
return
218+
requirement_not_met("conjugateGradientMultiBlockCG is currently waived due to a known NVRTC issue")
220219

221220
if platform.system() == "Darwin":
222-
pytest.skip("conjugateGradientMultiBlockCG is not supported on Mac OSX")
221+
requirement_not_met("conjugateGradientMultiBlockCG is not supported on Mac OSX")
223222

224223
if platform.machine() == "armv7l":
225-
pytest.skip("conjugateGradientMultiBlockCG is not supported on ARMv7")
224+
requirement_not_met("conjugateGradientMultiBlockCG is not supported on ARMv7")
226225

227226
if platform.machine() == "qnx":
228-
pytest.skip("conjugateGradientMultiBlockCG is not supported on QNX")
227+
requirement_not_met("conjugateGradientMultiBlockCG is not supported on QNX")
229228

230229
# This will pick the best possible CUDA capable device
231230
dev_id = find_cuda_device()
232231
device_prop = check_cuda_errors(cudart.cudaGetDeviceProperties(dev_id))
233232

234233
if not device_prop.managedMemory:
235-
pytest.skip("Unified Memory not supported on this device")
234+
requirement_not_met("Unified Memory not supported on this device")
236235

237236
# This sample requires being run on a device that supports Cooperative Kernel
238237
# Launch
239238
if not device_prop.cooperativeLaunch:
240-
pytest.skip(f"Selected GPU {dev_id} does not support Cooperative Kernel Launch")
239+
requirement_not_met(f"Selected GPU {dev_id} does not support Cooperative Kernel Launch")
241240

242241
# Statistics about the GPU device
243242
print(

0 commit comments

Comments
 (0)