forked from KarypisLab/METIS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_written.sh
More file actions
executable file
·79 lines (63 loc) · 1.67 KB
/
Copy pathrun_written.sh
File metadata and controls
executable file
·79 lines (63 loc) · 1.67 KB
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
#!/usr/bin/env bash
# small utility to run the "to partition" command from a GraphBuilder
set -euo pipefail
USAGE="usage: $0 <GRAPH> [rust|env|diff|norm(default)|norm-gdb|rust-gdb]"
FILE="${1:?"$USAGE"}"
# gets the program name
CMDLINE=$(awk '/^%/ { $1 = ""; bin = $0 }; /^[^%]/ { next }; END { print bin }' "$FILE" | cut -d' ' -f 2-)
# echo "$CMDLINE"
NAME="$(echo "$CMDLINE" | cut -d' ' -f 1)"
ARGS="$(echo "$CMDLINE" | cut -d' ' -f 2-)"
case "$NAME" in
'gpmetis' | 'mpmetis' | 'ndmetis' | 'm2gmetis')
;;
*)
echo "Last comment is not a metis program (\`$NAME'), was it created with GraphBuilder?"
exit 1
esac
OP="${2:-norm}"
case "$OP" in
'rust')
cargo b
BIN_BASE="target/debug/"
;;
'rust-gdb')
cargo b
BIN_BASE="rust-gdb --args target/debug/"
;;
'diff')
cargo b
: ${METIS_NORM:?"METIS_NORM is not set, are you in nix-shell?"}
;;
'env')
BIN_BASE=""
;;
'norm')
: ${METIS_NORM:?"METIS_NORM is not set, are you in nix-shell?"}
BIN_BASE="$METIS_NORM/bin/"
;;
'norm-gdb')
: ${METIS_NORM:?"METIS_NORM is not set, are you in nix-shell?"}
BIN_BASE="norm-gdb --args $METIS_NORM/bin/"
;;
*)
echo "$USAGE"
exit 1
;;
esac
if [ "$OP" = 'diff' ]; then
diff -d --color=always -s -b -a -y -W130 \
--label "norm" <(eval $(printf "$METIS_NORM/bin/%s %s" "$NAME" "$ARGS")) \
--label "rust" <(eval $(printf "target/debug/%s %s" "$NAME" "$ARGS"))
exit 0
fi
# same as one defined in shell.nix
function norm-gdb() {
gdb -d "$METIS_NORM_SRC/programs" \
-d "$METIS_NORM_SRC/libmetis" \
-d "$METIS_NORM_SRC/include" \
-x gdb/options_pp.scm "$@"
}
CMD=$(printf "%s%s %s" "$BIN_BASE" "$NAME" "$ARGS")
printf "%s\n" "$CMD"
eval $CMD