-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
72 lines (66 loc) · 1.87 KB
/
run
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
#! /bin/bash
# Maker/tester/runner for the experimental version of Fizz.
# Usage: ./run.sh r|t e|p|n|h 1|2[|h-opts]
# Mods:
# r - run; run Viewer from /data/ with options from e|p|n|h
# t - test; make Viewer, used to see if there are any compile time errors
# e - eventlog; compiles and runs the file with eventlog enabled
# p - profile; compiles and runs the file with profiling enabled
# n - neither profiling nor eventlog is enabled
# h - runs the program with heap profiling, converts output to a .ps file.
# For this option third arg is an extra arg for heap profile, i.e. -h[arg]
# 1|2 - number of cores in execution, from ghc's -N*
#
# Examples:
# ./run t - test, compile with no optimization
# ./run r e 2, compile+run with eventlong enabled, two cores
# NOTE: Script is designed to be run from the directory where all code files
# are placed, with data files stored in data/ subdirectory
if [ "$1" = "r" ]
then
MAKESTRING="ghc Viewer.hs -O2 -rtsopts -threaded"
RUNSTRING="../Viewer +RTS -s -K200M"
elif [ "$1" = "t" ]
then
MAKESTRING="ghc Viewer.hs"
eval $MAKESTRING
exit
else
echo "ERROR: Argument 1 is wrong (or missing)"
exit
fi
if [ "$2" = "e" ]
then
MAKESTRING=$MAKESTRING" -eventlog"
RUNSTRING=$RUNSTRING" -ls"
elif [ "$2" = "p" ]
then
MAKESTRING=$MAKESTRING" -prof -fprof-auto"
RUNSTRING=$RUNSTRING" -p"
elif [ "$2" = "h" ]
then
MAKESTRING=$MAKESTRING" -prof -fprof-auto"
cd data
eval $RUNSTRING" -N2 -p -h"$3
eval "hp2ps -c Viewer.hp; cd .."
exit
elif [ "$2" = "n" ]
then
: # proceed, no extra options
else
echo "ERROR: Argument 2 is wrong (or missing)"
exit
fi
if [ $3 -le 4 ] && [ $3 -ge 1 ]
then
RUNSTRING=$RUNSTRING" -N"$3
FILENAME=$FILENAME"_"$3
else
echo "ERROR: Argument 3 is missing or greater than 4"
exit
fi
eval $MAKESTRING
cd data
RUNSTRING=$RUNSTRING" -RTS"
eval $RUNSTRING
cd ..