Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undocker benchmark runs. #16

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .benchmark_inner.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .buildbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ setup
sed -e 's/invocations: [0-9]\+/invocations: 2/g' \
-e 's/iterations: [0-9]\+/iterations: 1/g' \
rebench.conf > rebench_ci.conf
~/.local/bin/rebench --no-denoise -c rebench_ci.conf
venv/bin/rebench --no-denoise -c rebench_ci.conf

# Do some minimal checks on the reporter.
cd reporter
Expand Down
20 changes: 0 additions & 20 deletions Dockerfile-benchmarking

This file was deleted.

43 changes: 28 additions & 15 deletions benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# Run a benchmarking session inside a docker container and file away the
# Run a benchmarking session inside a temporary directory and file away the
# results file.

set -eu
Expand Down Expand Up @@ -47,21 +47,34 @@ RES_DIR=$1; shift
RES_SUBDIR="${RES_DIR}/$(${FMT_EPOCH} ${TIMESTAMP} +%Y%m)"
mkdir -p ${RES_SUBDIR}

# Run benchmarks inside docker.
# Set up a fresh time-stamped directory.
YMDHMS=$(${FMT_EPOCH} ${TIMESTAMP} +%Y%m%d_%H%M%S)
IMAGE_TAG="bm-${YMDHMS}"
CONT_NAME=$(pwgen -s 16 1)
BM_UID=$(id -u)
docker build --build-arg BM_UID=${BM_UID} -t ${IMAGE_TAG} --file Dockerfile-benchmarking .
docker run --cap-add CAP_PERFMON -u ${BM_UID} --name ${CONT_NAME} ${IMAGE_TAG}
RUN_DIR="${PWD}/runs/${YMDHMS}"
mkdir -p ${RUN_DIR}
cleanup() {
rm -rf ${RUN_DIR}
}
trap 'cleanup' EXIT

. ./common.sh
cd ${RUN_DIR}
setup
ln -s ../../rebench.conf .
ln -s ../../suites .

# Stash extra info file.
docker container cp ${CONT_NAME}:/bm/extra.toml \
${RES_SUBDIR}/${YMDHMS}-extra.toml
# Collect some extra info and put in a TOML file alongside the results file.
EXTRA_TOML=extra.toml
TOML_BIN=venv/bin/toml
touch ${EXTRA_TOML}
${TOML_BIN} add_section --toml-path ${EXTRA_TOML} versions
${TOML_BIN} set --toml-path ${EXTRA_TOML} versions.yk-benchmarks "$(git rev-parse HEAD)"
${TOML_BIN} set --toml-path ${EXTRA_TOML} versions.yk "$(cd yk && git rev-parse HEAD)"
${TOML_BIN} set --toml-path ${EXTRA_TOML} versions.ykllvm "$(cd yk/ykllvm && git rev-parse HEAD)"
${TOML_BIN} set --toml-path ${EXTRA_TOML} versions.yklua "$(cd yklua && git rev-parse HEAD)"

# File away the results file in the output directory.
docker container cp ${CONT_NAME}:/bm/benchmark.data \
${RES_SUBDIR}/${YMDHMS}.data
# Run benchmarks.
venv/bin/rebench -q --no-denoise -c rebench.conf

# Remove the container.
docker container rm ${CONT_NAME}
# File away the results file (and extra info file) in the output directory.
cp ${EXTRA_TOML} ../../${RES_SUBDIR}/${YMDHMS}-extra.toml
cp benchmark.data ../../${RES_SUBDIR}/${YMDHMS}.data
20 changes: 13 additions & 7 deletions common.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# Common shared functionality.

# Build/install everything required for benchmarking.
#
# The python bits are installed inside a virtual env in a directory
# `$(PWD)/venv`.
setup() {
# Install Rust
export CARGO_HOME="$(pwd)/.cargo"
export RUSTUP_HOME="$(pwd)/.rustup"
export RUSTUP_INIT_SKIP_PATH_CHECK="yes"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
sh rustup.sh --default-host x86_64-unknown-linux-gnu \
--default-toolchain nightly \
--no-modify-path \
--profile default \
-y
export PATH=~/.cargo/bin/:${PATH}
--default-toolchain nightly \
--no-modify-path \
--profile default \
-y
export PATH=${PWD}/.cargo/bin/:${PATH}

# Set up yk.
git clone --recurse-submodules https://github.com/ykjit/yk
Expand All @@ -35,6 +40,7 @@ setup() {
make -j $(nproc)
cd ..

pipx install rebench
pipx install toml-cli
python3 -m venv venv
./venv/bin/pip install rebench
./venv/bin/pip install toml-cli
}
Loading