forked from ParaGroup/p3arsec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·155 lines (140 loc) · 4.62 KB
/
install.sh
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
MEASURE=true
INPUT=true
ONLYINPUT=false
NORNIR=false
SKEPU=false
APPLICATIONS="blackscholes bodytrack facesim ferret fluidanimate freqmine raytrace swaptions vips x264"
KERNELS="canneal dedup streamcluster"
ALLAPS="$APPLICATIONS $KERNELS"
VERSIONS="gcc-pthreads gcc-openmp gcc-tbb gcc-ff gcc-serial gcc-skepu gcc-pthreads-nornir gcc-openmp-nornir gcc-ff-nornir"
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
# -e|--extension)
# EXTENSION="$2"
# shift # past argument (Needed only if the parameter has an argument: e.g. --foo bar).
# ;;
-m|--nomeasure)
MEASURE=false
;;
-f|--fast)
INPUT=false
;;
-i|--inputs)
ONLYINPUT=true
;;
-n|--nornir)
NORNIR=true
;;
-s|--skeputools)
SKEPU=true
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
if [ "$ONLYINPUT" = true ]; then
# Only download and add the inputs
wget http://parsec.cs.princeton.edu/download/3.0/parsec-3.0-input-sim.tar.gz
tar -xvzf parsec-3.0-input-sim.tar.gz
rm -f parsec-3.0-input-sim.tar.gz
rsync --remove-source-files -a parsec-3.0/ ./
rm -rf parsec-3.0
wget http://parsec.cs.princeton.edu/download/3.0/parsec-3.0-input-native.tar.gz
tar -xvzf parsec-3.0-input-native.tar.gz
rm -f parsec-3.0-input-native.tar.gz
rsync --remove-source-files -a parsec-3.0/ ./
rm -rf parsec-3.0
cp ./pkgs/apps/raytrace/inputs/input_simlarge.tar ./pkgs/apps/raytrace/inputs/input_demo-bright17.tar
cp ./pkgs/apps/fluidanimate/inputs/input_simsmall.tar ./pkgs/apps/fluidanimate/inputs/input_demo-bright17.tar
else
# Get PARSEC
if [ "$INPUT" = true ]; then
wget http://parsec.cs.princeton.edu/download/3.0/parsec-3.0.tar.gz
tar -xvzf parsec-3.0.tar.gz
rm -f parsec-3.0.tar.gz
else
wget http://parsec.cs.princeton.edu/download/3.0/parsec-3.0-core.tar.gz
tar -xvzf parsec-3.0-core.tar.gz
rm -f parsec-3.0-core.tar.gz
fi
# Copy its content in the current directory
rsync --remove-source-files -a parsec-3.0/ ./
rm -rf parsec-3.0
# Overwrite files with parsec-ff ones.
rsync --remove-source-files -a parsec-ff/ ./
rm -rf parsec-ff
# Overwrite files with parsec-hooks ones.
if [ "$MEASURE" = true ]; then
rsync --remove-source-files -a parsec-hooks/ ./
rm -rf parsec-hooks
# Download and install Mammut (for energy measurements)
mkdir pkgs/libs/mammut
git clone https://github.com/DanieleDeSensi/mammut.git pkgs/libs/mammut
pushd pkgs/libs/mammut
make
popd
# Add "hooks" to 'build_deps'
echo $ALLAPS
for APP in $ALLAPS
do
for VER in $VERSIONS
do
if [[ $APPLICATIONS == *$APP* ]]
then
AFOLD="apps"
else
AFOLD="kernels"
fi
FILE="pkgs/"$AFOLD"/"$APP"/parsec/"$VER".bldconf"
echo $APP" "$VER" "$FILE
if [ -f $FILE ];
then
echo -e "\nbuild_deps=\"hooks \${build_deps}\"\n" >> $FILE
fi
done
done
fi
rootdir=$(pwd)
# Install Nornir
if [ "$NORNIR" = true ]; then
cd ./pkgs/libs && git clone https://github.com/DanieleDeSensi/nornir.git
if [ "$MEASURE" = true ]; then
# To avoid collisions between two differet mammut versions, remove
# one so that both p3arsec and nornir have the same mammut version.
rm -rf ./nornir/src/external/mammut
ln -s $(pwd)/mammut $(pwd)/nornir/src/external/mammut
fi
cd nornir && git checkout a97827b && make && make bin
cd $rootdir
fi
# Install SkePU2
if [ "$SKEPU" = true ]; then
# Change LLVM_TARGETS_TO_BUILD value according to the specific architecture
cd ./pkgs/libs/skepu2 && mkdir external
cd external && git clone http://llvm.org/git/llvm.git && cd llvm && git checkout d3d1bf00 && cd tools
git clone http://llvm.org/git/clang.git && cd clang/ && git checkout 37b415dd && git apply ../../../../clang_patch.patch
ln -s $(pwd)/../../../../clang_precompiler $(pwd)/tools/skepu-tool
cmake -DLLVM_TARGETS_TO_BUILD=X86 -G "Unix Makefiles" ../../ -DCMAKE_BUILD_TYPE=Release && make -j skepu-tool
cd $rootdir
fi
# Repair documentation
echo "Repairing documentation..."
sh repairpod.sh &> /dev/null
# Removing caches
rm -rf pkgs/apps/bodytrack/src/autom4te.cache/
# Removing VIPS old file (is needed otherwise will not compile the new version).
rm -rf pkgs/apps/vips/src/libvips/iofuncs/threadpool.c
# Creating inputs for new configurations (e.g. for demos)
if [ "$INPUT" = true ]; then
cp ./pkgs/apps/raytrace/inputs/input_simlarge.tar ./pkgs/apps/raytrace/inputs/input_demo-bright17.tar
cp ./pkgs/apps/fluidanimate/inputs/input_simsmall.tar ./pkgs/apps/fluidanimate/inputs/input_demo-bright17.tar
fi
# Clean
mv README README_PARSEC
echo "Download succeeded."
fi