From 7737811b7a56304bcfc33b7495cd4fc2638b65ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jere=20Lepp=C3=A4nen?= Date: Fri, 25 Oct 2024 14:34:17 +0300 Subject: [PATCH] linux-gen: perf: add odp_ml_perf_run.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ML performance test run for linux-gen. This runs some basic performance tests using the conv.onnx model. Signed-off-by: Jere Leppänen --- .../test/performance/Makefile.am | 26 +++++++++++++++++++ .../test/performance/odp_ml_perf_run.sh | 20 ++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 platform/linux-generic/test/performance/odp_ml_perf_run.sh diff --git a/platform/linux-generic/test/performance/Makefile.am b/platform/linux-generic/test/performance/Makefile.am index 4070f09f2e..2a05607015 100644 --- a/platform/linux-generic/test/performance/Makefile.am +++ b/platform/linux-generic/test/performance/Makefile.am @@ -1 +1,27 @@ SUBDIRS = dmafwd + +if WITH_ML +TESTS = odp_ml_perf_run.sh +EXTRA_DIST = odp_ml_perf_run.sh +endif + +# If building out-of-tree, make check will not copy the scripts and data to the +# $(builddir) assuming that all commands are run locally. However this prevents +# running tests on a remote target using LOG_COMPILER. +# So copy all script and data files explicitly here. +all-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + if [ -e $(srcdir)/$$f ]; then \ + mkdir -p $(builddir)/$$(dirname $$f); \ + cp -f $(srcdir)/$$f $(builddir)/$$f; \ + fi \ + done \ + fi + +clean-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + rm -f $(builddir)/$$f; \ + done \ + fi diff --git a/platform/linux-generic/test/performance/odp_ml_perf_run.sh b/platform/linux-generic/test/performance/odp_ml_perf_run.sh new file mode 100755 index 0000000000..8ddd086866 --- /dev/null +++ b/platform/linux-generic/test/performance/odp_ml_perf_run.sh @@ -0,0 +1,20 @@ +#!/bin/sh -xe +# +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2024 Nokia + +TEST_DIR="${TEST_DIR:-$(dirname $0)}" + +cd $TEST_DIR +BIN_DIR=../../../../test/performance +MODEL_DIR=../../example/ml + +run_conv() { + $BIN_DIR/odp_ml_perf${EXEEXT} -M $MODEL_DIR/conv.onnx \ + -I $MODEL_DIR/conv-input.bin -R $MODEL_DIR/conv-output.bin $@ +} + +run_conv -m 0 -r 1000 +run_conv -m 0 -r 1000 -l +run_conv -m 2 -l +run_conv -m 3 -l