@@ -4,47 +4,26 @@ set -euo pipefail
44# CI entry point for the ONNX Runtime execution-provider inference test.
55#
66# This is meant to be called from an alidist recipe (O2-GPU-test) that has the
7- # O2 dependency environment loaded (ONNXRuntime, gpu-system, CMake, ninja ). It
7+ # O2 dependency environment loaded (ONNXRuntime, gpu-system). It
88# derives the GPU backends to test the same way the other O2 GPU CI recipes do
99# (O2GPUCI_BACKENDS or gpu-features-available.sh), maps them onto the ONNX
1010# Runtime execution providers ONNXRuntime was built with (ort-init.sh), and
1111# fails if no GPU execution provider ends up being tested: a GPU CI check that
1212# silently tests only the CPU provider is not a GPU CI check.
1313#
14- # usage: run-ci-onnxruntime-inference-test.sh [O2_SOURCEDIR]
15- # O2_SOURCEDIR AliceO2 source tree. Defaults to the tree this script is in .
14+ # usage: run-ci-onnxruntime-inference-test.sh
15+ # Runs the executable and model installed alongside this script.
1616#
1717# Environment:
1818# O2GPUCI_BACKENDS Comma/space separated list of backends to require
1919# (CUDA, HIP). Defaults to what gpu-system detected.
20- # BUILDDIR If set (as in alidist recipes), the test is built in
21- # $BUILDDIR/onnxruntime-inference-test.
20+ # ONNXRUNTIME_INFERENCE_TEST_BINARY Optional test executable override.
2221# ONNXRUNTIME_INFERENCE_TEST_DEVICE_ID GPU device id, defaults to 0.
2322
2423SCRIPT_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)
25- O2_SOURCEDIR=${1:- $(cd " $SCRIPT_DIR /../../../.." && pwd)}
26- TEST_DIR=$O2_SOURCEDIR /Common/ML/test/onnxruntime-inference
27- TEST_SCRIPT=$TEST_DIR /run-local-onnxruntime-inference-test.sh
24+ export ONNXRUNTIME_INFERENCE_TEST_BINARY=${ONNXRUNTIME_INFERENCE_TEST_BINARY:- $SCRIPT_DIR / o2-test-ml-onnxruntime-ep-inference}
2825
29- if [[ ! -f $TEST_SCRIPT ]]; then
30- echo " onnxruntime-inference-ci: could not find test runner: $TEST_SCRIPT " >&2
31- echo " Pass the AliceO2 source tree as the first argument." >&2
32- exit 1
33- fi
34-
35- if [[ -z ${ONNXRUNTIME_ROOT:- } || ! -d $ONNXRUNTIME_ROOT /lib/cmake/onnxruntime ]]; then
36- echo " onnxruntime-inference-ci: ONNXRUNTIME_ROOT is not set or does not contain lib/cmake/onnxruntime" >&2
37- echo " ONNXRUNTIME_ROOT=${ONNXRUNTIME_ROOT:- } " >&2
38- exit 1
39- fi
40- for TOOL in cmake ninja; do
41- if ! command -v $TOOL > /dev/null; then
42- echo " onnxruntime-inference-ci: $TOOL not found in PATH; add CMake and ninja to build_requires" >&2
43- exit 1
44- fi
45- done
46-
47- if [[ -f $ONNXRUNTIME_ROOT /etc/ort-init.sh ]]; then
26+ if [[ -n ${ONNXRUNTIME_ROOT:- } && -f $ONNXRUNTIME_ROOT /etc/ort-init.sh ]]; then
4827 source " $ONNXRUNTIME_ROOT /etc/ort-init.sh"
4928fi
5029if [[ -n ${GPU_SYSTEM_ROOT:- } && -f $GPU_SYSTEM_ROOT /etc/gpu-features-available.sh ]]; then
@@ -96,17 +75,7 @@ if [[ ${#PROVIDERS[@]} == 1 ]]; then
9675 exit 1
9776fi
9877
99- BUILD_DIR=${BUILDDIR:- ${TMPDIR:-/ tmp} } /onnxruntime-inference-test
100- PROVIDER_LIST=$( IFS=,; echo " ${PROVIDERS[*]} " )
101- echo " onnxruntime-inference-ci: backends: ${GPU_BACKENDS[*]} ; providers: $PROVIDER_LIST "
102-
103- EXTRA_ARGS=()
104- [[ -n ${ONNXRUNTIME_INFERENCE_TEST_DEVICE_ID:- } ]] && EXTRA_ARGS+=(--device-id " $ONNXRUNTIME_INFERENCE_TEST_DEVICE_ID " )
78+ export ONNXRUNTIME_INFERENCE_TEST_PROVIDERS=$( IFS=,; echo " ${PROVIDERS[*]} " )
79+ echo " onnxruntime-inference-ci: backends: ${GPU_BACKENDS[*]} ; providers: $ONNXRUNTIME_INFERENCE_TEST_PROVIDERS "
10580
106- # The local runner must never fall back to alienv bootstrapping in CI.
107- export ONNXRUNTIME_INFERENCE_TEST_BOOTSTRAPPED=1
108- " $TEST_SCRIPT " --model " $TEST_DIR /net.onnx" \
109- --build-dir " $BUILD_DIR " \
110- --providers " $PROVIDER_LIST " \
111- ${EXTRA_ARGS[@]+" ${EXTRA_ARGS[@]} " }
112- rm -Rf " $BUILD_DIR "
81+ exec " $SCRIPT_DIR /run-onnxruntime-all-eps.sh" " $SCRIPT_DIR /net.onnx"
0 commit comments