Skip to content

Commit 48758af

Browse files
committed
Follow gpu deterministic test setup
1 parent de44827 commit 48758af

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

Common/ML/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ if(BUILD_TESTING)
5252
"ORT_CUDA_BUILD=${ONNXRUNTIME_INFERENCE_TEST_CUDA}"
5353
"ORT_MIGRAPHX_BUILD=${ONNXRUNTIME_INFERENCE_TEST_MIGRAPHX}"
5454
"ORT_TENSORRT_BUILD=${ONNXRUNTIME_INFERENCE_TEST_TENSORRT}"
55-
LABELS ml onnxruntime
55+
LABELS ml onnxruntime gpu
5656
TIMEOUT 300)
5757
endif()

Common/ML/test/onnxruntime-inference/run-onnxruntime-all-eps.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ fi
1111
if [[ -n ${ONNXRUNTIME_ROOT:-} && -f $ONNXRUNTIME_ROOT/etc/ort-init.sh ]]; then
1212
source "$ONNXRUNTIME_ROOT/etc/ort-init.sh"
1313
fi
14+
if [[ -n ${GPU_SYSTEM_ROOT:-} && -f $GPU_SYSTEM_ROOT/etc/gpu-features-available.sh ]]; then
15+
source "$GPU_SYSTEM_ROOT/etc/gpu-features-available.sh"
16+
fi
1417

1518
has_cuda_device() {
1619
if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; then
@@ -28,25 +31,49 @@ has_rocm_device() {
2831

2932
if [[ -n ${ONNXRUNTIME_INFERENCE_TEST_PROVIDERS:-} ]]; then
3033
IFS=', ' read -r -a PROVIDERS <<< "$ONNXRUNTIME_INFERENCE_TEST_PROVIDERS"
34+
for PROVIDER in "${PROVIDERS[@]}"; do
35+
PROVIDER=${PROVIDER,,}
36+
if [[ $PROVIDER == "cuda" && ${O2_GPU_CUDA_AVAILABLE:-0} == 1 ]] && ! has_cuda_device; then
37+
echo "onnxruntime-inference-test: CUDA is available but no CUDA device was detected" >&2
38+
exit 1
39+
fi
40+
if [[ $PROVIDER == "tensorrt" && ${O2_GPU_CUDA_AVAILABLE:-0} == 1 ]] && ! has_cuda_device; then
41+
echo "onnxruntime-inference-test: TensorRT is available but no CUDA device was detected" >&2
42+
exit 1
43+
fi
44+
if [[ $PROVIDER == "migraphx" && ${O2_GPU_ROCM_AVAILABLE:-0} == 1 ]] && ! has_rocm_device; then
45+
echo "onnxruntime-inference-test: ROCm is available but no ROCm device was detected" >&2
46+
exit 1
47+
fi
48+
done
3149
else
3250
PROVIDERS=(cpu)
3351
if [[ ${ORT_MIGRAPHX_BUILD:-0} == 1 ]]; then
3452
if has_rocm_device; then
3553
PROVIDERS+=(migraphx)
54+
elif [[ ${O2_GPU_ROCM_AVAILABLE:-0} == 1 ]]; then
55+
echo "onnxruntime-inference-test: ROCm is available but no ROCm device was detected" >&2
56+
exit 1
3657
else
3758
echo "onnxruntime-inference-test: skipping migraphx, no ROCm device detected"
3859
fi
3960
fi
4061
if [[ ${ORT_CUDA_BUILD:-0} == 1 ]]; then
4162
if has_cuda_device; then
4263
PROVIDERS+=(cuda)
64+
elif [[ ${O2_GPU_CUDA_AVAILABLE:-0} == 1 ]]; then
65+
echo "onnxruntime-inference-test: CUDA is available but no CUDA device was detected" >&2
66+
exit 1
4367
else
4468
echo "onnxruntime-inference-test: skipping cuda, no CUDA device detected"
4569
fi
4670
fi
4771
if [[ ${ORT_TENSORRT_BUILD:-0} == 1 ]]; then
4872
if has_cuda_device; then
4973
PROVIDERS+=(tensorrt)
74+
elif [[ ${O2_GPU_CUDA_AVAILABLE:-0} == 1 ]]; then
75+
echo "onnxruntime-inference-test: TensorRT is available but no CUDA device was detected" >&2
76+
exit 1
5077
else
5178
echo "onnxruntime-inference-test: skipping tensorrt, no CUDA device detected"
5279
fi

0 commit comments

Comments
 (0)