Skip to content

Commit e7f86b2

Browse files
committed
Refactor artefact
- fix two bugs which prevented it building correctly under docker on windows. - remove stale files that are no longer necessary - update dependencies - proper x11 xvfb support for alacritty under docker - caching of result transformations reduces processing time significantly
1 parent 592917d commit e7f86b2

31 files changed

+2411
-2479
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
results/
44
plots/
55
artefacts/
6-
src/
6+
src/*
77
!src/parserbench
88
!src/binary_trees
99
!src/regex_redux

Dockerfile

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,54 +23,53 @@ ENV EXPERIMENTS=$EXPERIMENTS
2323
ENV SUITES=$SUITES
2424
ENV MEASUREMENTS=$MEASUREMENTS
2525

26+
COPY packages-debian.txt .
27+
2628
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
2729
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
28-
rm -f /etc/apt/apt.conf.d/docker-clean && \
29-
apt-get update && \
30-
apt-get -y install make bc perl build-essential curl git cmake python3.11 python3.11-venv python3.11-distutils python3-pip \
31-
libtinfo-dev libzip-dev ninja-build gdb pipx rsync \
32-
libdwarf-dev libunwind-dev libboost-dev libfontconfig1-dev fontconfig libboost-iostreams-dev \
33-
libboost-all-dev libboost-program-options-dev libboost-regex-dev zlib1g-dev zstd libelf-dev elfutils \
34-
libdw-dev pkg-config libssl-dev zlib1g-dev libzstd-dev liblzma-dev \
35-
libffi-dev libedit-dev llvm-dev clang procps autotools-dev xz-utils \
36-
gperf bison flex xvfb time
30+
rm -f /etc/apt/apt.conf.d/docker-clean \
31+
&& apt-get update -y \
32+
&& apt-get install -y --no-install-recommends \
33+
autotools-dev bison bc perl build-essential clang cmake curl dvipng elfutils \
34+
cm-super flex gdb git gperf fontconfig libfontconfig1-dev libboost-all-dev \
35+
libdwarf-dev libdw-dev libedit-dev libffi-dev liblzma-dev libssl-dev \
36+
libtinfo-dev libunwind-dev libzip-dev libzstd-dev \
37+
libx11-6 libx11-xcb1 libxkbcommon-x11-dev libxext6 libxrandr2 libxcb1 \
38+
libxrender1 libxcursor1 libgl1 libgl1-mesa-dri libglx-mesa0 x11-apps \
39+
llvm-dev make ninja-build pkg-config pipx procps python3 rsync time \
40+
xvfb xauth which zlib1g-dev zstd \
41+
&& rm -rf /var/lib/apt/lists/*
42+
RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
3743

3844
# Set Python 3.11 as default
3945
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \
4046
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
4147

42-
# Set environment variables for Rust and Cargo
4348
ENV CARGO_HOME=/cargo
4449
ENV RUSTUP_HOME=/rustup
4550
ENV PATH=$CARGO_HOME/bin:$PATH
4651

47-
# Install rustup and Rust nightly toolchain
4852
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
4953

50-
# Show versions for debugging
5154
RUN rustc --version && cargo --version
5255

53-
COPY pyproject.toml ./
54-
55-
RUN --mount=type=cache,target=/root/.cache/pip \
56-
pip install --upgrade pip --break-system-packages && \
57-
pip install .[dev] --break-system-packages
56+
COPY pyproject.toml .
57+
COPY Makefile .
58+
RUN make venv
5859

59-
COPY . .
6060

61-
RUN mkdir -p /app/artefacts
61+
COPY src src
62+
COPY *.py .
6263

63-
RUN --mount=type=cache,target=/cache \
64-
if [ "$FULL" = "false" ]; then \
65-
./fetch_binaries.sh --out-dir /cache && \
66-
cp -r /cache/bin /app/artefacts/ && \
67-
ls -ls /app/artefacts/bin; \
64+
RUN if [ "$FULL" = "false" ]; then \
65+
make download-bins; \
66+
else \
67+
RUN make build-heaptrack; \
68+
RUN make build-alloy; \
69+
RUN make build-benchmarks; \
6870
fi
69-
70-
RUN invoke build-benchmarks $EXPERIMENTS $SUITES $MEASUREMENTS
71-
72-
FROM scratch as log_export
73-
COPY --from=build /app/experiment.log /docker-run-full.log
71+
#
72+
COPY extra extra
7473

7574
FROM build as runtime
7675

@@ -88,9 +87,7 @@ ENV MEASUREMENTS=$MEASUREMENTS
8887

8988
WORKDIR /app
9089

91-
RUN pip install --upgrade pip --break-system-packages && \
92-
pip install .[dev] --break-system-packages
9390

94-
RUN ls -la
95-
run invoke run-benchmarks $PEXECS $EXPERIMENTS $SUITES $MEASUREMENTS
91+
CMD make run-benchmarks
92+
9693

Makefile

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@ CURDIR ?= $(shell pwd)
33
IMAGE := $(if $(FULL),full:latest,quick:latest)
44
LOG_STAGE := log_export
55
RUNTIME_STAGE := runtime
6-
RESULTS := $(CURDIR)/results
6+
RESULTS := ./results
7+
TABLES := ./tables
8+
PLOTS := ./plots
79
LOGFILE := $(CURDIR)/experiment.log
810

9-
VENV_DIR := .venv
11+
VENV_DIR := $(CURDIR)/.venv
1012
VENV_PYTHON := $(VENV_DIR)/bin/python
1113
PYTHON := $(VENV_PYTHON)
1214
INVOKE := $(VENV_DIR)/bin/invoke
1315

1416
BIN_DIR ?= $(CURDIR)/artefacts/bin
1517
BIN_ARCHIVE ?= artefacts-bin.tar.xz
18+
GDRIVE_FID = 1hwNZbAEEJPoFkvYoq-J4yadFsbsnbHdU
19+
GDOWN = $(VENV_DIR)/bin/gdown
20+
1621

1722
EXP_ARG := $(if $(strip $(EXPERIMENTS)),--experiments "$(EXPERIMENTS)")
18-
SUITE_ARG := $(if $(strip $(SUITES)),--suites $(SUITES))
23+
SUITE_ARG := $(if $(strip $(SUITES)),--suites "$(SUITES)")
1924
MEASURE_ARG := $(if $(strip $(MEASUREMENTS)),--measurements $(MEASUREMENTS))
2025
QUICK_PEXECS = 5
2126
FULL_PEXECS = 30
@@ -33,25 +38,33 @@ venv: pyproject.toml | $(VENV_DIR)
3338
define WITH_DOCKER
3439
docker buildx build --progress=plain \
3540
--build-arg FULL=$1 \
36-
$(if $(EXP_ARG),--build-arg EXPERIMENTS=$(EXP_ARG)) \
37-
$(if $(SUITE_ARG),--build-arg SUITES=$(SUITE_ARG)) \
38-
$(if $(MEASURE_ARG),--build-arg MEASUREMENTS=$(MEASURE_ARG)) \
41+
$(if $(EXP_ARG),--build-arg EXPERIMENTS='$(EXPERIMENTS)') \
42+
$(if $(SUITE_ARG),--build-arg SUITES='$(SUITES)') \
43+
$(if $(MEASURE_ARG),--build-arg MEASUREMENTS='$(MEASUREMENTS)') \
3944
--target runtime \
4045
--tag $2 \
4146
--load .
42-
@test -f $(LOGFILE) || touch $(LOGFILE)
43-
chmod a+w $(LOGFILE)
4447
docker run --rm -it \
4548
--mount type=bind,source="$(RESULTS)",target=/app/results \
49+
--mount type=bind,source="$(TABLES)",target=/app/tables \
50+
--mount type=bind,source="$(PLOTS)",target=/app/plots \
4651
$2
4752
endef
4853

54+
results:
55+
mkdir results
56+
57+
plots:
58+
mkdir plots
4959

50-
run-quick:
60+
tables:
61+
mkdir tables
62+
63+
run-quick: results plots tables
5164
$(call WITH_DOCKER,false,quick:latest)
5265

53-
run-full:
54-
$(call WITH_DOCKER,true,full:latext)
66+
run-full: results plots tables
67+
$(call WITH_DOCKER,true,full:latest)
5568

5669
tarball:
5770
@echo "Compressing $(BIN_DIR) with maximum compression..."
@@ -68,15 +81,39 @@ bare-metal: venv
6881
$(EXP_ARG) \
6982
$(SUITE_ARG) \
7083
$(MEASURE_ARG)
84+
@$(INVOKE) run-benchmarks \
85+
$(if $(PEXECS),$(PEXECS),$(FULL_PEXECS)) \
86+
$(EXP_ARG) \
87+
$(SUITE_ARG) \
88+
$(MEASURE_ARG)
7189

90+
run-benchmarks: venv
7291
@$(INVOKE) run-benchmarks \
7392
$(if $(PEXECS),$(PEXECS),$(FULL_PEXECS)) \
7493
$(EXP_ARG) \
7594
$(SUITE_ARG) \
7695
$(MEASURE_ARG)
7796

97+
build-benchmarks: venv
98+
@$(INVOKE) build-benchmarks \
99+
$(EXP_ARG) \
100+
$(SUITE_ARG) \
101+
$(MEASURE_ARG)
102+
103+
build-alloy: venv
104+
@$(INVOKE) build-alloy $(EXP_ARG)
105+
106+
download-bins: venv
107+
@$(GDOWN) $(GDRIVE_FID) -O $(CURDIR)/artefacts-bin.tar.xz
108+
mkdir -p artefacts
109+
tar -xvf artefacts-bin.tar.xz -C artefacts
110+
$(INVOKE) prerequisites
111+
112+
build-heaptrack: venv
113+
@$(INVOKE) build-heaptrack
114+
78115
process: venv
79-
@$(INVOKE) process-results
116+
@$(INVOKE) process-results $(EXP_ARG) $(SUITE_ARG) $(MEASURE_ARG)
80117

81118
build-paper:
82119
docker build --progress=plain -f Dockerfile.paper --target export --output type=local,dest=./rustgc_paper -t rustgc-paper:latest .

alloy_adapter.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ def should_enable_finalizer_elision(self, run_id):
5050

5151
def setup_stats(self, run_id):
5252
bm = run_id.benchmark.name.lower()
53-
if "GC_LOG_DIR" in run_id.env:
54-
logdir = run_id.env["GC_LOG_DIR"]
55-
run_id.env["GC_LOG_FILE"] = f"{logdir}-{bm}.csv"
53+
if "USE_MT" in run_id.env:
54+
dir = run_id.env["RESULTS_DIR"]
55+
out = f"{dir}/{bm}-{run_id.completed_invocations + 1}"
56+
run_id.env["GC_LOG_FILE"] = f"{out}.json"
5657

5758
def acquire_command(self, run_id):
5859
self.setup_stats(run_id)
@@ -61,12 +62,11 @@ def acquire_command(self, run_id):
6162
if not self._completed_time_availability_check:
6263
self._check_which_time_command_is_available()
6364

64-
if "GC_HEAPTRACK_DIR" in run_id.env:
65-
dir = run_id.env["GC_HEAPTRACK_DIR"]
65+
if "USE_HT" in run_id.env:
66+
dir = run_id.env["RESULTS_DIR"]
6667
bm = run_id.benchmark.name.lower()
6768
out = f"{dir}/{bm}-{run_id.completed_invocations + 1}"
68-
ht = run_id.env["HEAPTRACK_PATH"]
69-
run_id.env["GC_HEAPTRACK_ZST"] = out
69+
ht = run_id.env["HT_PATH"]
7070
command = " ".join([ht, "--record-only", "-o", out, command])
7171
return self._create_command(command)
7272

@@ -127,15 +127,6 @@ def parse_data(self, data, run_id, invocation):
127127
invocation, iteration, time, "ms", run_id, "total"
128128
)
129129

130-
# if "GC_HEAPTRACK_DIR" in run_id.env:
131-
# zst = run_id.env["GC_HEAPTRACK_ZST"]
132-
# ht_print = run_id.env["HEAPTRACK_PRINT_PATH"]
133-
# subprocess.run(
134-
# [ht_print, "-M", f"{zst}.massif", f"{zst}.zst"],
135-
# stdout=subprocess.DEVNULL,
136-
# stderr=subprocess.DEVNULL,
137-
# )
138-
139130
current.add_measurement(measure)
140131
data_points.append(current)
141132
current = DataPoint(run_id)

0 commit comments

Comments
 (0)