-
Notifications
You must be signed in to change notification settings - Fork 6
/
init.sh
executable file
·131 lines (114 loc) · 4.12 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /bin/bash
MAKE_EXPECTED_OUTPUT_FILES=0
if [ $# -eq 1 ]
then
MAKE_EXPECTED_OUTPUT_FILES=1
fi
OS=`uname -o 2>/dev/null`
if [ $? -ne 0 ]
then
# Option -o does not exist in Mac OS X default version of uname
# command.
OS=`uname -s 2>/dev/null`
fi
# It is nice to avoid creating multiple copies of large files, but on
# Cygwin we measure the cpu and memory usage of commands using
# timemem.exe in a DOS/Windows batch file, and redirecting input files
# from Cygwin symbolic links does not work. So just make a copy.
if [ "$OS" == "Cygwin" ]
then
LINK_OR_COPY="cp"
else
LINK_OR_COPY="ln -s"
fi
# Some of the input and expected output files are quite large. Rather
# than waste space on github, it seems best to use one of the
# benchmark programs to generate them, where possible. I'll pick
# Java, since the -server version is within 3 times the computation
# time of the C and C++ implementations on all benchmarks, and if you
# are getting this set of files, you are interested in Clojure and so
# must have a Java installation handy.
# We'll just trust the Java benchmark program to do a good job. If
# you start getting mismatches of expected output to actual output,
# then you may want to investigate more carefully to see whether it is
# the Java implementation that is in error, or the one it is being
# compared against.
make_expected_output_files () {
local B=$1
shift
local T
local L
cd $B
if [ "$B" == "pidigits" ]
then
L="gcc"
else
L="java"
fi
./batch.sh ${L} $*
for T in $*
do
/bin/mv -f output/${T}-${L}-output.txt output/${T}-expected-output.txt
done
cd ..
}
# Make all input files
# There are no fasta input files, but its output files are the input
# files for several other benchmarks.
make_expected_output_files fasta quick knucleotide medium regexdna long
# knucleotide and revcomp have input files that are produced as output
# from the fasta benchmark programs.
cd knucleotide
mkdir ./input
cd ./input
/bin/rm -f quick-input.txt medium-input.txt long-input.txt
${LINK_OR_COPY} ../../fasta/output/knucleotide-expected-output.txt quick-input.txt
${LINK_OR_COPY} ../../fasta/output/medium-expected-output.txt medium-input.txt
${LINK_OR_COPY} ../../fasta/output/long-expected-output.txt long-input.txt
cd ../..
cd revcomp
mkdir ./input
cd ./input
/bin/rm -f quick-input.txt medium-input.txt long-input.txt
${LINK_OR_COPY} ../../fasta/output/quick-expected-output.txt quick-input.txt
${LINK_OR_COPY} ../../fasta/output/medium-expected-output.txt medium-input.txt
${LINK_OR_COPY} ../../fasta/output/long-expected-output.txt long-input.txt
cd ../..
# revlines isn't one of the benchmarks from the Benchmarks Game web
# site. I created it as a simplified version of reverse-complement,
# to try to figure out why Clojure was using so much memory for one of
# my earlier solution attempts. I'm keeping it around for future
# reference.
cd revlines
mkdir ./input
cd ./input
sed -n -e '/^>THREE/,$p' ../../fasta/output/long-expected-output.txt >| long-input.txt
cd ../..
cd regexdna
mkdir ./input
cd ./input
${LINK_OR_COPY} ../../fasta/output/knucleotide-expected-output.txt quick-input.txt
${LINK_OR_COPY} ../../fasta/output/regexdna-expected-output.txt long-input.txt
cd ../..
if [ $MAKE_EXPECTED_OUTPUT_FILES == 0 ]
then
exit 0
fi
# Make all expected output files
# These don't have input files, just command line parameters that vary
# for the different "size" tests.
make_expected_output_files binarytrees quick medium long
make_expected_output_files fannkuch quick medium long
make_expected_output_files fannkuchredux quick medium long
make_expected_output_files hello long
make_expected_output_files mandelbrot quick medium long
make_expected_output_files nbody quick medium long
make_expected_output_files pidigits quick medium long
make_expected_output_files spectralnorm quick medium long
# These do have input files, which are all output files of the fasta
# benchmark program.
make_expected_output_files knucleotide quick medium long
make_expected_output_files regexdna quick long
make_expected_output_files revcomp quick medium long
make_expected_output_files revlines long
exit 0