Skip to content

Add scaffolding for running tests and benchmarks #18

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

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
19a3c8d
Patch to fix testcases 363, 365 and 366. The modules string.gfind and…
Jan 8, 2019
1c0859e
Add test input files and md5sum file for arm64.
Jan 16, 2019
8c873d8
Tuning the parameters for existing test machine
Jan 28, 2019
f6133bd
Tuning the parameters for existing test machine
Jan 28, 2019
66eeabc
Scale arm64 benchmark parameters
siddhesh Feb 28, 2019
1846523
Add scaling support to k-nucleatide.lua
siddhesh Feb 28, 2019
158ad7e
Support scaling support in the sum-file
siddhesh Mar 1, 2019
4c93e36
Revert "Support scaling support in the sum-file"
siddhesh Mar 6, 2019
6e7a1b8
Revert "Add scaling support to k-nucleatide.lua"
siddhesh Mar 6, 2019
4c52c95
Add a default value for partialsums iterations
siddhesh Mar 6, 2019
60f07f1
Pass the file as first argument to the script
siddhesh Mar 6, 2019
8cbb375
Reduce array dimensions
siddhesh Mar 8, 2019
3f59bf6
Add driver for benchmarks
siddhesh Mar 8, 2019
7a89a54
Adjust k-nucleotide argument parsing to work with lua chunks
siddhesh Mar 8, 2019
abee5be
Fix up comment
siddhesh Mar 8, 2019
26f12e8
Add copyright notice to the driver and give credit to Vlad
siddhesh Mar 8, 2019
a2f0110
Remove debug echo
siddhesh Mar 8, 2019
67e93f2
Check for arg before subscripting it
siddhesh Mar 8, 2019
04669e9
More arg handling fixes
siddhesh Mar 8, 2019
cdf96af
Fix case when a different lua binary is specified
siddhesh Mar 8, 2019
45ec059
Refactor: change LUAJIT_* to LUA_*
siddhesh Mar 8, 2019
9004df4
Build the benchmark binary as part of the benchmark
siddhesh Mar 8, 2019
49930d2
Get external lua programs running again
siddhesh Mar 8, 2019
79749de
Add a README for the benchmarks
siddhesh Mar 8, 2019
7d9e670
Add more build dependencies to bench-luajit
siddhesh Mar 8, 2019
95ce08f
Add lua wrapper script to run benchmarks
siddhesh Mar 11, 2019
6e4acce
Rename main.c to luajit-bench.c
siddhesh Mar 11, 2019
489e873
Reformat luajit-benchmark.c to be closer to the luajit coding style
siddhesh Mar 11, 2019
399ff47
Add top level makefile
siddhesh Mar 11, 2019
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
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ifndef LUA_BIN
LUA_BIN = luajit
endif

.PHONY: check bench

all: check bench

check:
cd test && $(LUA_BIN) test.lua

bench:
make -C bench
1,671 changes: 1,671 additions & 0 deletions bench/FASTA_10000

Large diffs are not rendered by default.

166,671 changes: 166,671 additions & 0 deletions bench/FASTA_1000000

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions bench/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
CC=gcc

LUA_FILE_ARG = -a
LUA_ARG = $(patsubst %.lua,%,$^)

ifndef LUA_BIN
BENCH_BIN = luajit-bench
LUA_BIN_NAME = ./$(BENCH_BIN)
else
ifdef BENCH_DURATION
BENCH_ARG = -t $(BENCH_DURATION)
endif
LUA_BIN_NAME = $(LUA_BIN) luajit-bench.lua $(BENCH_ARG)
endif

BENCHMARKS = array3d binary-trees chameneos coroutine-ring euler14-bit \
fannkuch fasta k-nucleotide life mandelbrot mandelbrot-bit md5 \
meteor nbody nsieve nsieve-bit nsieve-bit-fp partialsums \
pidigits-nogmp ray recursive-ack recursive-fib revcomp \
scimark-2010-12-20 scimark-fft scimark-lu series scimark-sparse \
scimark-sor spectral-norm sum-file

# Specify benchmarks that need input files.
INPUT-k-nucleotide = FASTA_1000000
INPUT-revcomp = FASTA_1000000
INPUT-sum-file = SUMCOL_1000

input-file = $(INPUT-$(patsubst %.result,%,$@))
input-file-arg = $(if $(input-file),$(LUA_FILE_ARG) $(input-file),)
LUA_CMD = $(LUA_BIN_NAME) $(LUA_ARG) $(input-file-arg)

bench_targets = $(patsubst %,%.result,$(BENCHMARKS))

all: $(BENCH_BIN) $(bench_targets)

%.result: %.lua
@$(LUA_CMD)

ifndef LUA_BIN
# Recipe to build the benchmark binary. This needs the luajit static library.

ifndef LUAJIT_PATH
LUAJIT_PATH = ./LuaJIT
endif

ifdef BENCH_DURATION
DURATION = -DBENCH_DURATION=$(BENCH_DURATION)
endif

LUAJIT_A = $(LUAJIT_PATH)/src/libluajit.a

$(BENCH_BIN): $(LUAJIT_PATH)/src/libluajit.a $(BENCH_BIN).c Makefile
$(CC) [email protected] $(DURATION) -g -O3 -c -o [email protected] -I $(LUAJIT_PATH)/src
$(CC) [email protected] -lpthread $< -lm -ldl -o $@

# Build the luajit static library if it doesn't exist.
$(LUAJIT_A):
make -C $(LUAJIT_PATH) -j

clean:
rm -f $(BENCH_BIN) main.o
endif
29 changes: 29 additions & 0 deletions bench/PARAM_arm64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
array3d 515
binary-trees 17
chameneos 1e7
coroutine-ring 5e7
euler14-bit 8e7
fannkuch 11
fasta 15e6
k-nucleotide 2 FASTA_1000000
life
mandelbrot 6000
mandelbrot-bit 10000
md5 70000
nbody 12e6
nsieve 13
nsieve-bit 14
nsieve-bit-fp 12
partialsums 3e7
pidigits-nogmp 5000
ray 12
recursive-ack 10
recursive-fib 42
revcomp 1e6 FASTA_1000000
scimark-fft 50000
scimark-lu 6000
scimark-sor 100000
scimark-sparse 100000
series 16000
spectral-norm 5000
sum-file 2e7 SUMCOL_1000
38 changes: 38 additions & 0 deletions bench/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Instructions on running the benchmark
=====================================

This benchmark can be run in two modes, either as a program linked against
libluajit.a or by running the scripts with an external lua command. The
results of both modes are similar but not comparable due to the difference in
precision of timings in both cases. In both cases, higher number is better and
the output is in the following format:


<benchmark name>:<total executions>:<executions per second>

Benchmark binary
----------------

Invoke the benchmark as follows:

make LUAJIT_PATH={{Path to LuaJIT sources}}

You can change the benchmark duration using the BENCH_DURATION variable like
so:

make BENCH_DURATION=20 LUAJIT_PATH={{Path to LuaJIT sources}}

Benchmarking an external lua command
------------------------------------

Invoke the benchmark as follows:

make LUA_BIN={{Your lua/luajit bin}}

LIMITATION
----------

Benchmarking using an external lua command currently has very low resolution
timing (milliseconds) compared to the binary, which uses clock_gettime and
hence has nanosecond resolution. As a result, one cannot reasonably compare
results using the benchmark binary with that of the script.
100 changes: 100 additions & 0 deletions bench/SUMCOL_100
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
66
-237
314
-79
624
710
272
-365
928
856
138
-479
520
832
862
760
846
-81
106
-513
-193
650
782
-517
944
218
712
-663
-559
462
-635
-25
182
530
844
330
-833
102
-881
108
-947
-763
-405
232
410
104
-729
-149
-889
888
360
968
908
116
-815
-129
522
-723
-993
860
-503
926
-219
-415
60
158
-609
-501
986
-699
-583
884
212
210
-957
526
-985
552
344
-395
-95
338
248
494
130
404
358
600
-639
-125
-33
-965
752
474
-731
758
-573
4
38
264
Loading