Stabilise benchmarks wrt. GC
[nofib.git] / shootout / reverse-complement / Makefile
1 TOP = ../..
2 include $(TOP)/mk/boilerplate.mk
3
4 # Override default SRCS; the default is all source files, but
5 # we don't want to include revcomp-c.c
6 SRCS = Main.hs
7
8 CLEAN_FILES += fasta-c revcomp-c reverse-complement *stdout *stdin
9
10 # These values are only used in this file. They are ignored by the
11 # executable itself.
12 FAST_OPTS = 5000000
13 NORM_OPTS = 50000000
14 # Normally, we'd want to have SLOW_OPTS = $((5*NORM_OPTS)) to run this for 5s
15 # in 2018. But that means
16 # - slow generation of huge input and output files
17 # - having to diff the generated output files
18 # - the input parser in fasta-c.c overflows, so we're generating an incorrect
19 # reference output
20 # So we don't do it.
21 SLOW_OPTS = 50000000
22 # This is the official shootout setting ($((NORM_OPTS/2)), i.e. running 0.5s in
23 # 2018):
24 # SLOW_OPTS = 25000000
25
26 # The benchmark game also uses -fllvm, which we can't since it might
27 # not be available on the developer's machine.
28 HC_OPTS += -funfolding-use-threshold=32
29
30 #------------------------------------------------------------------
31 # Create input
32
33 fasta-c : ../fasta/fasta-c.c
34 $(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@
35
36 reverse-complement.faststdin : fasta-c
37 ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
38
39 reverse-complement.stdin : fasta-c
40 ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
41
42 reverse-complement.slowstdin : fasta-c
43 ./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
44
45 # Since we only decide here what the INPUT_FILE is, it's required to first run
46 # `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
47 # doesn't call `runstdtest` correctly)
48 ifeq "$(mode)" "slow"
49 INPUT_FILE = reverse-complement.slowstdin
50 else
51 ifeq "$(mode)" "fast"
52 INPUT_FILE = reverse-complement.faststdin
53 else
54 INPUT_FILE = reverse-complement.stdin
55 endif
56 endif
57
58 #------------------------------------------------------------------
59 # Create output to validate against
60
61 revcomp-c : revcomp-c.o
62 gcc $< -o $@ -pthread
63
64 reverse-complement.faststdout : revcomp-c $(INPUT_FILE)
65 ./revcomp-c < $(INPUT_FILE) | tr -d '\r' > $@
66
67 reverse-complement.stdout : revcomp-c $(INPUT_FILE)
68 ./revcomp-c < $(INPUT_FILE) | tr -d '\r' > $@
69
70 reverse-complement.slowstdout : revcomp-c $(INPUT_FILE)
71 ./revcomp-c < $(INPUT_FILE) | tr -d '\r' > $@
72
73 # Since we only decide here what the OUTPUT_FILE is, it's required to first run
74 # `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
75 # doesn't call `runstdtest` correctly)
76 ifeq "$(mode)" "slow"
77 OUTPUT_FILE = reverse-complement.slowstdout
78 else
79 ifeq "$(mode)" "fast"
80 OUTPUT_FILE = reverse-complement.faststdout
81 else
82 OUTPUT_FILE = reverse-complement.stdout
83 endif
84 endif
85
86 boot :: $(INPUT_FILE) $(OUTPUT_FILE)
87
88 include $(TOP)/mk/target.mk