Install TBB and build vtr with TBB and other fixes
authorR Veera Kumar <vklr@vkten.in>
Sun, 17 Oct 2021 12:57:42 +0000 (18:27 +0530)
committerR Veera Kumar <vklr@vkten.in>
Sun, 17 Oct 2021 12:57:42 +0000 (18:27 +0530)
Add TBB installation and build vtr with TBB for multi-threading.
Give option to select tbb and vtr building.
Many other fixes.

symbiflow-install

index b44e2a0f259429fa97d0235436b86c7b91fd167a..93c1f1a7139bf3fd7e490c49a76e458c538d1fc3 100755 (executable)
@@ -25,11 +25,12 @@ cd /home/$SUDO_USER
 mkdir -p src/symbiflow
 cd src/symbiflow
 
-apt-get install -y git wget
+apt-get install -y libcurl3-gnutls/buster git/buster wget
 
 git clone https://github.com/steveicarus/iverilog.git
 git clone https://github.com/YosysHQ/yosys.git
 git clone https://github.com/YosysHQ/abc.git
+git clone https://github.com/oneapi-src/oneTBB.git
 git clone https://github.com/verilog-to-routing/vtr-verilog-to-routing.git
 git clone https://github.com/cliffordwolf/icestorm.git
 git clone https://github.com/SymbiFlow/prjxray.git
@@ -65,13 +66,11 @@ make install
 export PATH=/usr/local/symbiflow/iverilog/bin:$PATH
 cd ..
 
-#Please adjust the install paths for iverilog.
-
 ## Steps to compile Yosys
 
 ### Necessary software to install
 
-apt-get install -y -t buster_backports cmake
+apt-get install -y cmake
 apt-get install -y python3 clang libreadline-dev gawk tcl-dev \
  libffi-dev pkg-config libboost-system-dev libboost-python-dev \
  libboost-filesystem-dev zlib1g-dev
@@ -85,12 +84,49 @@ git checkout f44110c62561b21fa673f44d8e115c3ee70d2900
 ln -s ../abc .
 make -j $(nproc) PREFIX=/usr/local/symbiflow/yosys
 make PREFIX=/usr/local/symbiflow/yosys install
-install -d -m 0755 /usr/local/symbiflow/share
+install -v -d -m 0755 /usr/local/symbiflow/share
 ln -s ../yosys/share/yosys /usr/local/symbiflow/share
 export PATH=/usr/local/symbiflow/yosys/bin:$PATH
 cd ..
 
-#Please adjust the install paths for Yosys.
+# NOTE: Option to choose TBB and build vtr-verilog-to-routing with or
+# without or both. Set env var TBB_VTR.
+# TBB_VTR=0   --- Do not build TBB and so build vtr without TBB
+# TBB_VTR=1   --- Build TBB and build vtr with TBB only
+# TBB_VTR=2   --- Build TBB and build one vtr without TBB and another with TBB
+#                 Choose vtr without TBB as default
+# TBB_VTR=3   --- Build TBB and build one vtr without TBB and another with TBB
+#                 Choose vtr with TBB as default
+
+export TBB_VTR=3
+
+## Steps to compile oneTBB
+
+#Note: TBB is needed for multi-threading VTR-Verilog-to-routing
+#If not need multi-threading do not build TBB and VTR with TBB
+
+### Necessary software to install
+
+[ $TBB_VTR != 0 ] && apt-get install -y libhwloc-dev
+
+### Build TBB
+
+if [ $TBB_VTR != 0 ]; then
+
+cd oneTBB
+git checkout v2020.3
+make -j$(nproc) tbb tbbmalloc tbbproxy tbbbind
+install -v -d -m 0755 /usr/local/symbiflow/oneTBB/lib
+cp -dpr include /usr/local/symbiflow/oneTBB
+install -v -Dm755 build/linux_*/*.so* -t /usr/local/symbiflow/oneTBB/lib
+cmake -DINSTALL_DIR=/usr/local/symbiflow/oneTBB/lib/cmake/TBB \
+  -DTBB_VERSION_FILE=/usr/local/symbiflow/oneTBB/include/tbb/tbb_stddef.h \
+  -DSYSTEM_NAME=Linux -P cmake/tbb_config_installer.cmake
+echo "/usr/local/symbiflow/oneTBB/lib" > /etc/ld.so.conf.d/symbiflow.conf
+ldconfig
+cd ..
+
+fi
 
 ## Steps to compile vtr-verilog-to-routing
 
@@ -102,20 +138,45 @@ apt-get install -y libeigen3-dev
 #apt-get install libcairo2-dev libfontconfig1-dev libx11-dev libxft-dev \
 #libgtk-3-dev
 
-### Build vtr-verilog-to-routing
+### Build vtr
+
+if [ $TBB_VTR != 1 ]; then
 
 cd vtr-verilog-to-routing
 git checkout 77a3df829fdf509a76b9d7b941376f3835c2576a
 mkdir build; cd build
-cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr ..
+cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr ..
 make -j $(nproc)
 make install
-install -d -m 0755 /usr/local/symbiflow/share/vtr
-cp ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp /usr/local/symbiflow/share/vtr
-export PATH=/usr/local/symbiflow/vtr/bin:$PATH
+install -v -d -m 0755 /usr/local/symbiflow/share/vtr
+install -v -m 0644 ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp /usr/local/symbiflow/share/vtr
+[ $TBB_VTR == 0 ] || [ $TBB_VTR == 2 ] && \
+  export PATH=/usr/local/symbiflow/vtr/bin:$PATH
+cd ../..
+
+fi
+
+### Build vtr-tbb
+
+if [ $TBB_VTR != 0 ]; then
+
+cd vtr-verilog-to-routing
+git checkout 77a3df829fdf509a76b9d7b941376f3835c2576a
+mkdir build-tbb; cd build-tbb
+cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr-tbb \
+  -DTBB_INCLUDE_DIR=/usr/local/symbiflow/oneTBB/include \
+  -DTBB_LIBRARY=/usr/local/symbiflow/oneTBB/lib ..
+LIBRARY_PATH=/usr/local/symbiflow/oneTBB/lib make -j $(nproc)
+LIBRARY_PATH=/usr/local/symbiflow/oneTBB/lib make install
+install -v -d -m 0755 /usr/local/symbiflow/share/vtr
+install -v -m 0644 ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp \
+  /usr/local/symbiflow/share/vtr
+# Choose either one of path for vtr-binaries
+[ $TBB_VTR == 1 ] || [ $TBB_VTR == 3 ] && \
+  export PATH=/usr/local/symbiflow/vtr-tbb/bin:$PATH
 cd ../..
 
-#Please adjust the install paths for vtr-verilog-to-routing.
+fi
 
 ## Steps to compile libxml2
 
@@ -130,16 +191,15 @@ apt-get install -y python3-dev
 
 tar -xf libxml2-2.9.12.tar.gz
 cd libxml2-2.9.12
-./configure --prefix=/usr/local/symbiflow/libxml2 --with-history --with-python=/usr/bin/python3
+./configure --prefix=/usr/local/symbiflow/libxml2 --with-history \
+  --with-python=/usr/bin/python3
 make -j $(nproc)
 make install
-echo "/usr/local/symbiflow/libxml2/lib" > /etc/ld.so.conf.d/symbiflow.conf
+echo "/usr/local/symbiflow/libxml2/lib" >> /etc/ld.so.conf.d/symbiflow.conf
 ldconfig
 export PATH=/usr/local/symbiflow/libxml2/bin:$PATH
 cd ..
 
-#Please adjust the install paths for libxml2
-
 ## Steps to compile libxslt
 
 # Needed by python3 lxml.
@@ -150,7 +210,8 @@ tar -xf libxslt-1.1.34.tar.gz
 cd libxslt-1.1.34
 sed -i s/3000/5000/ libxslt/transform.c doc/xsltproc.{1,xml}
 sed -i -r '/max(Parser)?Depth/d' ./tests/fuzz/fuzz.c
-./configure --prefix=/usr/local/symbiflow/libxslt --disable-static --without-python PKG_CONFIG_PATH=/usr/local/symbiflow/libxml2/lib/pkgconfig
+./configure --prefix=/usr/local/symbiflow/libxslt --disable-static \
+  --without-python PKG_CONFIG_PATH=/usr/local/symbiflow/libxml2/lib/pkgconfig
 make -j $(nproc)
 make install
 echo "/usr/local/symbiflow/libxslt/lib" >> /etc/ld.so.conf.d/symbiflow.conf
@@ -158,8 +219,6 @@ ldconfig
 export PATH=/usr/local/symbiflow/libxslt/bin:$PATH
 cd ..
 
-#Please adjust the install paths for libxslt
-
 ## Steps to compile prjxray
 
 ### Necessary software to install
@@ -171,7 +230,7 @@ git checkout f7f06896ad26bb7c94680dc323d4b871eded1f4e
 git submodule update --init --recursive
 mkdir build; cd build
 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
-make
+make -j$(nproc)
 make install
 export PATH=/usr/local/symbiflow/bin:$PATH
 cd ../..
@@ -183,7 +242,7 @@ cd ../..
 cd yosys-symbiflow-plugins
 git checkout b170f1d3575568d87901422f846b700169e299be
 sed -i -e 's@-include third_party/make-env/conda.mk@#-include third_party/make-env/conda.mk@' Makefile
-make
+make -j$(nproc)
 make install
 cd ..
 
@@ -192,7 +251,8 @@ cd ..
 ### Install prjxray-db
 
 cd prjxray-db
-git archive --format=tar --prefix=prjxray-db/ cd41f08a8a4d2a60053750a0fe10623b1e2e35da | tar -C /usr/local/symbiflow -xf -
+git archive --format=tar --prefix=prjxray-db/ \
+  cd41f08a8a4d2a60053750a0fe10623b1e2e35da | tar -C /usr/local/symbiflow -xf -
 
 cat > /usr/local/symbiflow/bin/prjxray-config << EOF
 #!/bin/bash
@@ -213,7 +273,7 @@ apt-get install -y libftdi-dev
 cd icestorm
 git checkout 83b8ef947f77723f602b706eac16281e37de278c
 make -j $(nproc) PREFIX=/usr/local/symbiflow/icestorm
-make install
+make PREFIX=/usr/local/symbiflow/icestorm install
 export PATH=/usr/local/symbiflow/icestorm/bin:$PATH
 cd ..
 
@@ -246,18 +306,29 @@ git checkout v1.0.0b1
 pip3 install .
 cd ..
 
-## Steps to install fpga-interchange
+## Git checkout python-fpga-interchange
+
 cd python-fpga-interchange
-git checkout v0.0.18         # pick stable version 0.0.18
-python3 setup.py install
+git checkout 1959b40e998db987c604c0a75664ccb209df13f7
+cd ..
+
+##  Git checkout quicklogic-fasm-utils
+
+cd quicklogic-fasm-utils
+git checkout 3d6a375ddb6b55aaa5a59d99e44a207d4c18709f
+cd ..
+
+##  Git checkout quicklogic-fasm
+
+cd quicklogic-fasm
+git checkout ee546ff09b2ee25894db3f419366afaf3c4bfe32
 cd ..
 
 ## Steps to compile symbiflow-arch-defs
 
 ## Necessary software to install
 
-apt-get install -y nodejs npm python-pytest openocd flake8 \
-  default-jre-headless libantlr4-runtime-dev python3-numpy \
+apt-get install -y nodejs npm python-pytest openocd flake8 python3-numpy \
   python3-intervaltree python3-simplejson python3-intelhex \
   python3-importlib-metadata python3-jsonschema python3-packaging \
   python3-pyparsing python3-pyrsistent python3-tqdm python3-zipp \
@@ -268,8 +339,10 @@ pip3 install textx fasm pyjson5 pyyaml tinyfpgab tinyprog pyjson lxml \
   yapf==0.26.0 python-sat
 
 cd symbiflow-arch-defs
+git checkout c2c0f00960baf538eb31e4c42bf5d09dca87bad7
 git submodule init
 git submodule update --init --recursive
+pip3 install ../python-fpga-interchange
 pip3 install -e third_party/prjxray
 pip3 install -e third_party/xc-fasm
 pip3 install ../quicklogic-fasm-utils
@@ -284,20 +357,25 @@ pip3 install -e third_party/symbiflow-xc-fasm2bels
 mkdir -p env/conda/envs
 ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
 
-git checkout c2c0f00960baf538eb31e4c42bf5d09dca87bad7
+sed -i -e 's@add_subdirectory(litex)@#add_subdirectory(litex)@g' \
+  -e 's@add_subdirectory(ibex)@#add_subdirectory(ibex)@g' \
+  xc/xc7/tests/soc/CMakeLists.txt
 
-sed -i -e 's@add_subdirectory(litex)@#add_subdirectory(litex)@g' -e 's@add_subdirectory(ibex)@#add_subdirectory(ibex)@g' xc/xc7/tests/soc/CMakeLists.txt
+### Build symbiflow-arch-defs-xc7-artix7-100t
 
-### Build symbiflow-arch-defs-xc7-artix7_100t
+export VPR_NUM_WORKERS=$(nproc)
 
 mkdir build; cd build
-cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/usr/local/symbiflow/prjxray-db -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
+cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/usr/local/symbiflow/prjxray-db \
+  -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t \
+  -DINSTALL_DEVICES=xc7a100t -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
 cd xc/xc7/archs/artix7_100t
 make install
 cd ../..;
 make PINMAP_INSTALL_arty100t-full_xc7a100t_test_arty100t-full_pinmap.csv
-install -d -m 0755 /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
-cp arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1/pinmap.csv
+install -v -d -m 0755 /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
+install -v -m 0644 arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1/pinmap.csv
+cd ../../../..
 
 cd /home/$SUDO_USER/src/symbiflow
 chown -R $SUDO_USER .