Skip to content
Snippets Groups Projects
Commit 9c8d6f93 authored by Daniel Maier's avatar Daniel Maier
Browse files

bpp perforate2.sh

parent 1c386aaa
No related branches found
No related tags found
No related merge requests found
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
CLAN=/home/daniel/polyhedral_perforation/clan-0.8.0/clan CLAN=/home/daniel/polyhedral_perforation/clan-0.8.0/clan
PERF=./build/perf2 PERF=./build/perf2
BPP=./build/bpp
CLOOG=/home/daniel/polyhedral_perforation/pluto/cloog-isl/cloog CLOOG=/home/daniel/polyhedral_perforation/pluto/cloog-isl/cloog
PLUTO=/home/daniel/polyhedral_perforation/pluto/polycc PLUTO=/home/daniel/polyhedral_perforation/pluto/polycc
# FIXME: update usage to reflect all options
usage() { usage() {
printf -- "%s: <OPTIONS>\n" "$0" printf -- "%s: <OPTIONS>\n" "$0"
printf -- "perforate program\n\n" printf -- "perforate program\n\n"
...@@ -12,6 +14,7 @@ usage() { ...@@ -12,6 +14,7 @@ usage() {
printf -- "-o, --output FILE output file\n" printf -- "-o, --output FILE output file\n"
printf -- "-e, --extract extract scop\n" printf -- "-e, --extract extract scop\n"
printf -- "-p, --perforate perforate scop\n" printf -- "-p, --perforate perforate scop\n"
printf -- "-b, --bpp SCOP compute perforation pattern using BPP\n"
printf -- "-g, --generate generate perforated program\n" printf -- "-g, --generate generate perforated program\n"
printf -- "-s, --statement statement to perforate\n" printf -- "-s, --statement statement to perforate\n"
printf -- "-l, --level level to perforate\n" printf -- "-l, --level level to perforate\n"
...@@ -25,6 +28,10 @@ perforate() { ...@@ -25,6 +28,10 @@ perforate() {
$PERF "$1" "$2" "$3" "$4" $PERF "$1" "$2" "$3" "$4"
} }
bpp() {
$BPP "$1" "$2" "$3"
}
generate() { generate() {
$CLOOG -openscop "$1" > "$2" $CLOOG -openscop "$1" > "$2"
} }
...@@ -54,6 +61,11 @@ while true; do ...@@ -54,6 +61,11 @@ while true; do
-p|--perforate) -p|--perforate)
cmd=perforate cmd=perforate
;; ;;
-b|--bpp)
cmd=bpp
shift
output_scop="$1"
;;
-g|--generate) -g|--generate)
cmd=generate cmd=generate
;; ;;
...@@ -103,6 +115,33 @@ case "$cmd" in ...@@ -103,6 +115,33 @@ case "$cmd" in
done done
cat "$perfin" > "$output" cat "$perfin" > "$output"
rm "$perfin" "$perfout" rm "$perfin" "$perfout"
;;
bpp)
xx="$output_scop"
tmp_file="$(mktemp)"
echo "$output_scop" > "$tmp_file"
timeout 2 tail -f "$tmp_file" |
while read x y; do
echo processing $x $y
bpp "$input" "$x" "$y" >> $tmp_file
done
perfin="$(mktemp)"
perfout="$(mktemp)"
cat "$input" > "$perfin"
sort "$tmp_file" | uniq | while read s l; do
echo perforating "$perfin" "$perfout" "$s" "$l"
perforate "$perfin" "$perfout" "$s" "$l"
tmp="$perfin"
perfin="$perfout"
perfout="$tmp"
# we write the output in every iteration because we are in a subshell!
cat "$perfin" > "$output"
done
rm "$perfin" "$perfout" "$tmp_file"
;; ;;
generate) generate)
generate "$input" "$output" generate "$input" "$output"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment