Commit b28c494c authored by Andreas Klebinger's avatar Andreas Klebinger

fasta/k-nulceotide: Create input via bash scrip.

We can use the same script from shake, this avoids duplicating the logic.
parent 9018d663
......@@ -7,6 +7,7 @@ SRCS = Main.hs
CLEAN_FILES += fasta-c fasta.faststdout fasta.stdout fasta.slowstdout
# If you modify these also modify boot.sh
FAST_OPTS = 750000
NORM_OPTS = 7500000
SLOW_OPTS = 25000000 # official shootout setting
......@@ -18,31 +19,9 @@ SRC_DEPS = bytestring
#------------------------------------------------------------------
# Create output to validate against
fasta-c : fasta-c.c
$(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@
boot :: fasta.stdout
fasta.faststdout : fasta-c
./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
fasta.stdout : fasta-c
./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
fasta.slowstdout : fasta-c
./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
# Since we only decide here what the INPUT_FILE is, it's required to first run
# `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
# doesn't call `runstdtest` correctly)
ifeq "$(mode)" "slow"
STDOUT_FILE = fasta.slowstdout
else
ifeq "$(mode)" "fast"
STDOUT_FILE = fasta.faststdout
else
STDOUT_FILE = fasta.stdout
endif
endif
boot :: $(STDOUT_FILE)
fasta.stdout: boot.sh
./boot.sh . . ${HC} $(mode)
include $(TOP)/mk/target.mk
#!/bin/bash
# Arguments:
# $1 - src folder
# $2 - output folder
# $3 - path to ghc
# $4 - mode
set -e
src=${1:-.}
output=${2:-.}
HC=${3:-ghc}
mode=${4:-norm}
EXE=""
if [[ $(shell uname -s | grep -c 'MSYS\|MINGW') -eq 1 ]]
then
EXE=".exe"
fi
FAST_OPTS=750000
NORM_OPTS=7500000
SLOW_OPTS=25000000 # official shootout setting
case $mode in
"norm"*)
MODE_ARGS=$NORM_OPTS
;;
"slow"*)
MODE_ARGS=$SLOW_OPTS
;;
*)
MODE_ARGS=$FAST_OPTS
;;
esac
set -x
${HC} -O2 ${src}/../fasta/fasta-c.c -c -o ${output}/fasta-c.o
${HC} -O2 ${output}/fasta-c.o -o ${output}/fasta-c$EXE -no-hs-main
${output}/fasta-c${EXE} $MODE_ARGS | tr -d '\r' > ${output}/fasta.stdout
# k-nucleotide.faststdin : fasta-c
# ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
# k-nucleotide.stdin : fasta-c
# ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
# k-nucleotide.slowstdin : fasta-c
# ./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
\ No newline at end of file
TOP = ../..
include $(TOP)/mk/boilerplate.mk
# These values are only used in this file. They are ignored by the
# executable itself.
# These values are only used in this file and boot.sh.
# They are ignored by the executable itself.
FAST_OPTS = 60000
NORM_OPTS = 600000
SLOW_OPTS = 3000000
......@@ -19,17 +19,17 @@ SRC_DEPS = bytestring
#------------------------------------------------------------------
# Create input
fasta-c : ../fasta/fasta-c.c
$(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@
# fasta-c : ../fasta/fasta-c.c
# $(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@
k-nucleotide.faststdin : fasta-c
./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
# k-nucleotide.faststdin : fasta-c
# ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
k-nucleotide.stdin : fasta-c
./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
# k-nucleotide.stdin : fasta-c
# ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
k-nucleotide.slowstdin : fasta-c
./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
# k-nucleotide.slowstdin : fasta-c
# ./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
# Since we only decide here what the INPUT_FILE is, it's required to first run
# `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
......@@ -46,4 +46,13 @@ endif
boot :: $(INPUT_FILE)
k-nucleotide.faststdin : boot.sh ../fasta/fasta-c.c
./boot.sh . . ${HC} $(mode)
k-nucleotide.stdin : boot.sh ../fasta/fasta-c.c
./boot.sh . . ${HC} $(mode)
k-nucleotide.slowstdin : boot.sh ../fasta/fasta-c.c
./boot.sh . . ${HC} $(mode)
include $(TOP)/mk/target.mk
#!/bin/bash
# Arguments:
# $1 - src folder
# $2 - output folder
# $3 - path to ghc
# $4 - mode
set -e
src=${1:-.}
output=${2:-.}
HC=${3:-ghc}
mode=${4:-norm}
EXE=""
if [[ $(shell uname -s | grep -c 'MSYS\|MINGW') -eq 1 ]]
then
EXE=".exe"
fi
FAST_OPTS=60000
NORM_OPTS=600000
SLOW_OPTS=3000000
case $mode in
"norm"*)
MODE_ARGS=$NORM_OPTS
INPUT_FILE=k-nucleotide.stdin
;;
"slow"*)
MODE_ARGS=$SLOW_OPTS
INPUT_FILE=k-nucleotide.slowstdin
;;
*)
MODE_ARGS=$FAST_OPTS
INPUT_FILE=k-nucleotide.faststdin
;;
esac
set -x
${HC} -O2 ${src}/../fasta/fasta-c.c -c -o ${output}/fasta-c.o
${HC} -O2 ${output}/fasta-c.o -o ${output}/fasta-c$EXE -no-hs-main
${output}/fasta-c${EXE} $MODE_ARGS | tr -d '\r' > ${output}/${INPUT_FILE}
# k-nucleotide.faststdin : fasta-c
# ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
# k-nucleotide.stdin : fasta-c
# ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
# k-nucleotide.slowstdin : fasta-c
# ./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment