forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kata-containers#9391 from dborquez/add-onednn-open…
…vino-ml-benchs add onednn and openvino ml-benchmarks
- Loading branch information
Showing
5 changed files
with
409 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
tests/metrics/machine_learning/onednn-dockerfile/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright (c) 2024 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Set up an Ubuntu image with 'phoronix-test-suite' installed | ||
|
||
FROM ubuntu:22.04 | ||
|
||
LABEL DOCKERFILE_VERSION="1.0" | ||
|
||
ENV PHORONIX_TAR_URL="https://phoronix-test-suite.com/releases/" | ||
ENV PHORONIX_VER="phoronix-test-suite-10.8.4.tar.gz" | ||
ENV PHORONIX_CFG="/usr/share/phoronix-test-suite/pts-core/static/user-config-defaults.xml" | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV DEBCONF_NONINTERACTIVE_SEEN true | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends git curl build-essential autoconf && \ | ||
apt-get install -y --no-install-recommends php libapache2-mod-php php-bz2 php-gd php-sqlite3 php-xml && \ | ||
apt-get install -y --no-install-recommends cmake cmake-data mesa-utils vulkan-tools unzip apt-file && \ | ||
curl -OkL ${PHORONIX_TAR_URL}/${PHORONIX_VER} && \ | ||
tar zxf ${PHORONIX_VER} && cd phoronix-test-suite && ./install-sh && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists && \ | ||
rm -f ${PHORONIX_VER} && \ | ||
if [ -n "$http_proxy" ] ; then \ | ||
sed -i "s|<ProxyAddress></ProxyAddress>|<ProxyAddress>$(getent hosts "$(echo $http_proxy | sed 's~http[s]*://~~g' | sed -e 's/:[0-9]*//g')" | awk '{ print $1 }')</ProxyAddress>|g" ${PHORONIX_CFG} ; \ | ||
sed -i "s|<ProxyPort></ProxyPort>|<ProxyPort>$(echo $http_proxy | sed 's/^.*://g')</ProxyPort>|g" ${PHORONIX_CFG} ; \ | ||
fi && \ | ||
sed -i "s|<UploadResults>TRUE</UploadResults>|<UploadResults>FALSE</UploadResults>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<PromptForTestIdentifier>TRUE</PromptForTestIdentifier>|<PromptForTestIdentifier>FALSE</PromptForTestIdentifier>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<PromptSaveName>TRUE</PromptSaveName>|<PromptSaveName>FALSE</PromptSaveName>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<PromptForTestDescription>TRUE</PromptForTestDescription>|<PromptForTestDescription>FALSE</PromptForTestDescription>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<Configured>FALSE</Configured>|<Configured>TRUE</Configured>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<Timeout>20</Timeout>|<Timeout>2</Timeout>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<SaveResults>FALSE</SaveResults>|<SaveResults>TRUE</SaveResults>|g" ${PHORONIX_CFG} && \ | ||
phoronix-test-suite download-test-files onednn && \ | ||
phoronix-test-suite install-dependencies onednn && \ | ||
phoronix-test-suite install onednn && \ | ||
sed -i "s/<NoNetworkCommunication>FALSE/<NoNetworkCommunication>TRUE/g" ${PHORONIX_CFG} && \ | ||
sed -i "s/<Timeout>20/<Timeout>3/g" ${PHORONIX_CFG} | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2024 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Description of the test: | ||
# This test runs the 'onednn benchmark' | ||
# https://github.com/v8/web-tooling-benchmark | ||
|
||
set -o pipefail | ||
|
||
# General env | ||
SCRIPT_PATH=$(dirname "$(readlink -f "$0")") | ||
source "${SCRIPT_PATH}/../lib/common.bash" | ||
|
||
# TEST_NAME is required to collect results and name the workload container. | ||
TEST_NAME="onednn-bench" | ||
|
||
WORKLOAD="phoronix-test-suite batch-run onednn" | ||
PAYLOAD_ARGS="${PAYLOAD_ARGS:-tail -f /dev/null}" | ||
|
||
IMAGE="docker.io/library/pts-onednn:latest" | ||
DOCKERFILE="${SCRIPT_PATH}/onednn-dockerfile/Dockerfile" | ||
|
||
TMP_DIR=$(mktemp --tmpdir -d onednn.XXXXXXXXXX) | ||
KATA_PERF_CONFIG="${TMP_DIR}/onednn_config.toml" | ||
TEST_RESULTS_FNAME="${TMP_DIR}/onednn-results.json" | ||
|
||
# Variable used to store the initial configuration file name. | ||
# This file is again pointed to by kata once the script finishes. | ||
KATA_INITIAL_CONFIG_FNAME="" | ||
|
||
function restore_kata_config() { | ||
rm -rf "${TMP_DIR}" | ||
set_kata_config_file "${KATA_INITIAL_CONFIG_FNAME}" | ||
} | ||
trap restore_kata_config EXIT | ||
|
||
# Show help about this script | ||
function help(){ | ||
cat << EOF | ||
Usage: $0 | ||
Description: | ||
Runs onednn benchmark using the maximum number of cpus and memory available. | ||
EOF | ||
} | ||
|
||
function save_config() { | ||
metrics_json_start_array | ||
|
||
pushd "${DEFAULT_KATA_CONFIG_DIR}" | ||
local MEM_AVAIL_MB="$(cat ${DEFAULT_KATA_CONFIG_FNAME} | grep -i "default_memory =" | cut -d "=" -f2 | tr -d ' ' | tr -d '"')" | ||
local NUM_CPUS="$(cat ${DEFAULT_KATA_CONFIG_FNAME} | grep -i "default_vcpus =" | cut -d "=" -f2 | tr -d ' ' | tr -d '"')" | ||
local SHARED_FS="$(cat ${DEFAULT_KATA_CONFIG_FNAME} | grep shared_fs | cut -d "=" -f2 | tr -d ' ' | tr -d '"')" | ||
popd | ||
|
||
local json="$(cat << EOF | ||
{ | ||
"image": "${IMAGE}", | ||
"units": "ms", | ||
"mode": "Lower Is Better", | ||
"shared-fs": "${SHARED_FS}", | ||
"num-vcpus": "${NUM_CPUS}", | ||
"memory-available-mb": "${MEM_AVAIL_MB}" | ||
} | ||
EOF | ||
)" | ||
metrics_json_add_array_element "${json}" | ||
metrics_json_end_array "Config" | ||
} | ||
|
||
function main() { | ||
local i=0 | ||
local cmds=("docker") | ||
local RES_DIR="/var/lib/phoronix-test-suite/test-results" | ||
|
||
# Check tools/commands dependencies | ||
init_env | ||
check_cmds "${cmds[@]}" | ||
check_ctr_images "$IMAGE" "$DOCKERFILE" | ||
|
||
clean_cache | ||
|
||
# Configure Kata to use the maximum number of available CPUs | ||
# and to use the available free memory. | ||
get_current_kata_config_file KATA_INITIAL_CONFIG_FNAME | ||
set_kata_configuration_performance "${KATA_PERF_CONFIG}" | ||
|
||
# Launch container. | ||
sudo -E "${CTR_EXE}" run -d --runtime "${CTR_RUNTIME}" "${IMAGE}" "${TEST_NAME}" sh -c "${PAYLOAD_ARGS}" | ||
|
||
# Run the test. | ||
sudo -E "${CTR_EXE}" t exec -t --exec-id "$(random_name)" "${TEST_NAME}" sh -c "${WORKLOAD}" | ||
|
||
results_fname=$(sudo -E "${CTR_EXE}" t exec --exec-id $(random_name) ${TEST_NAME} sh -c "ls ${RES_DIR}") | ||
SAVE_RESULTS_CMD="phoronix-test-suite result-file-to-json ${results_fname}" | ||
|
||
# Save results. | ||
sudo -E "${CTR_EXE}" t exec --exec-id "$(random_name)" "${TEST_NAME}" sh -c "${SAVE_RESULTS_CMD}" | ||
|
||
# Extract results. | ||
sudo -E "${CTR_EXE}" t exec --exec-id "${RANDOM}" "${TEST_NAME}" sh -c "cat /root/${results_fname}.json" > "${TEST_RESULTS_FNAME}" | ||
|
||
cat <<< $(jq 'del(.systems[].data)' "${TEST_RESULTS_FNAME}") > "${TEST_RESULTS_FNAME}" | ||
local results="$(cat ${TEST_RESULTS_FNAME})" | ||
|
||
metrics_json_init | ||
save_config | ||
metrics_json_start_array | ||
metrics_json_add_array_element "${results}" | ||
metrics_json_end_array "Results" | ||
metrics_json_save | ||
clean_env_ctr | ||
} | ||
|
||
main "$@" |
46 changes: 46 additions & 0 deletions
46
tests/metrics/machine_learning/openvino-dockerfile/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) 2024 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Set up an Ubuntu image with 'phoronix-test-suite' installed | ||
|
||
FROM ubuntu:22.04 | ||
|
||
LABEL DOCKERFILE_VERSION="1.0" | ||
|
||
ENV PHORONIX_VER="10.8.4" | ||
ENV PHORONIX_URL="https://phoronix-test-suite.com/releases/" | ||
ENV PHORONIX_TAR_FILE="phoronix-test-suite-${PHORONIX_VER}.tar.gz" | ||
ENV PHORONIX_SRC="${PHORONIX_URL}/${PHORONIX_TAR_FILE}" | ||
ENV PHORONIX_CFG_ALT="/etc/phoronix-test-suite.xml" | ||
ENV PHORONIX_CFG="/usr/share/phoronix-test-suite/pts-core/static/user-config-defaults.xml" | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV DEBCONF_NONINTERACTIVE_SEEN true | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends git curl build-essential autoconf && \ | ||
apt-get install -y --no-install-recommends php libapache2-mod-php php-bz2 php-gd php-sqlite3 php-xml && \ | ||
apt-get install -y --no-install-recommends cmake cmake-data mesa-utils vulkan-tools unzip apt-file && \ | ||
curl -OkL ${PHORONIX_SRC} && \ | ||
tar zxf ${PHORONIX_TAR_FILE} && cd phoronix-test-suite && ./install-sh && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists && \ | ||
rm -f ${PHORONIX_TAR_FILE} && \ | ||
if [ -n "$http_proxy" ] ; then \ | ||
sed -i "s|<ProxyAddress></ProxyAddress>|<ProxyAddress>$(getent hosts "$(echo $http_proxy | sed 's~http[s]*://~~g' | sed -e 's/:[0-9]*//g')" | awk '{ print $1 }')</ProxyAddress>|g" ${PHORONIX_CFG} ; \ | ||
sed -i "s|<ProxyPort></ProxyPort>|<ProxyPort>$(echo $http_proxy | sed 's/^.*://g')</ProxyPort>|g" ${PHORONIX_CFG} ; \ | ||
fi && \ | ||
sed -i "s|<UploadResults>TRUE</UploadResults>|<UploadResults>FALSE</UploadResults>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<PromptForTestIdentifier>TRUE</PromptForTestIdentifier>|<PromptForTestIdentifier>FALSE</PromptForTestIdentifier>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<PromptSaveName>TRUE</PromptSaveName>|<PromptSaveName>FALSE</PromptSaveName>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<PromptForTestDescription>TRUE</PromptForTestDescription>|<PromptForTestDescription>FALSE</PromptForTestDescription>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<Configured>FALSE</Configured>|<Configured>TRUE</Configured>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<Timeout>20</Timeout>|<Timeout>2</Timeout>|g" ${PHORONIX_CFG} && \ | ||
sed -i "s|<SaveResults>FALSE</SaveResults>|<SaveResults>TRUE</SaveResults>|g" ${PHORONIX_CFG} && \ | ||
phoronix-test-suite download-test-files openvino && \ | ||
phoronix-test-suite install openvino && \ | ||
sed -i 's/<NoNetworkCommunication>FALSE/<NoNetworkCommunication>TRUE/g' ${PHORONIX_CFG} && \ | ||
sed -i 's/<Timeout>20/<Timeout>3/g' ${PHORONIX_CFG} | ||
|
||
CMD ["/bin/bash"] |
Oops, something went wrong.