-
Notifications
You must be signed in to change notification settings - Fork 24
/
install.sh
106 lines (90 loc) · 3.67 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
#Before running this bash script, please read REAMME.md
ccf_root=$(pwd)
#Change this to the path you want and make sure it is a true path!
install_path=""
mapping_debug=1
# ==============================================================================
# Installing OpenSSL if necessary
openssl_version="$(openssl version | grep -Eo '[+-]?[0-9]+([.][0-9]+)?' | head -1)"
openssl_exist=$(which openssl)
if [ $(echo "$openssl_version > 1.1" | bc) -eq 0 -o -z "$openssl_exist" ]; then
echo Installing OpenSSL 1.1.1j in case CMake 3.19.5 needs it
wget https://www.openssl.org/source/openssl-1.1.1j.tar.gz --no-check-certificate
tar zxvf openssl-1.1.1j.tar.gz
cd openssl-1.1.1j
./config --prefix=${install_path}
make -j 8 && make -j 8 install
cd ..
rm -rf openssl-1.1.1j*
fi
# ==============================================================================
# Installing CMake'
cmake_version="$(cmake -version | grep -Eo '[+-]?[0-9]+([.][0-9]+)?' | head -1)"
cmake_exist=$(which cmake)
if [ $(echo "$cmake_version > 3.19" | bc) -eq 0 -o -z "$cmake_exist" ]; then
echo Installing CMake 3.19.5
wget https://github.com/Kitware/CMake/releases/download/v3.19.5/cmake-3.19.5.tar.gz --no-check-certificate
tar zxvf cmake-3.19.5.tar.gz
cd cmake-3.19.5
./configure --prefix=${install_path}
make -j 8 && make -j 8 install
cd ..
rm -rf cmake-3.19.5*
fi
# ==============================================================================
# Installing LLVM
echo Installing Clang/LLVM + LLVM-Gold
cd llvm-project
llvm_dir=$(pwd)
mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_BINUTILS_INCDIR="${llvm_dir}/binutils/include" --enable-pic -DCMAKE_BUILD_TYPE=Release ../llvm -DCMAKE_INSTALL_PREFIX=${install_path}
make -j 8 && make -j 8 install
cd ../..
# ==============================================================================
# Compiling Mapping Algorithms
# Add the following lines below when you know what is going on with the directories
#if [ $(echo "$mapping_debug" | bc) -eq 1 ]; then
#fi
cd mappings
echo $(pwd)
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do
cd $dir/Release
make
cd ../DFGFiles
g++ -O3 nodefile.cpp -o nodefile
g++ -O3 edgefile.cpp -o edgefile
cd ../../
done
echo "Mapping compilation complete"
cd ..
# ==============================================================================
# Building Instruction Generation files
cd InstructionGenerator
make clean && make insgen && make falcon_insgen
echo "Instruction Generator compilation complete"
cd ..
# ==============================================================================
# Changing toolchain path of cgracc and cgra++ and copying them
# into ${install_path}/bin
cd scripts/CGRALib
sed -i "/ccf_root\=/c\ccf_root=\"${ccf_root}\"" cgracc
sed -i "/ccf_root\=/c\ccf_root=\"${ccf_root}\"" cgra++
sed -i "/ccf_root\=/c\ccf_root=\"${ccf_root}\"" cgraexe
sed -i "/ccf_root\=/c\ccf_root=\"${ccf_root}\"" cgradb
sed -i "/install_path\=/c\install_path=\"${install_path}\"" cgracc
sed -i "/install_path\=/c\install_path=\"${install_path}\"" cgra++
sed -i "/install_path\=/c\install_path=\"${install_path}\"" cgraexe
sed -i "/install_path\=/c\install_path=\"${install_path}\"" cgradb
cp cgracc cgra++ cgraexe cgradb ${install_path}/bin
echo "cgracc, cgra++, and cgraexe manipulation and copy complete"
cd ../..
# ==============================================================================
# Build gem5
python3 -m pip install --user scons
cd gem5
scons build/ARM/gem5.opt -j8
sed -i "s|AtomicSimpleCPU|AtomicCGRA,AtomicSimpleCPU|g" ./build/variables/ARM
scons build/ARM/gem5.opt -j8
scons build/ARM/gem5.debug -j8
cd ../