[Build] Disable python binding by default; Add a pybind option to build-scalehls.sh; [Readme] Update readme accordingly

This commit is contained in:
Hanchen Ye 2022-03-09 02:11:32 -06:00
parent 564c413385
commit 8626ca3ed5
2 changed files with 11 additions and 7 deletions

View File

@ -21,11 +21,14 @@ For more details, please see our [HPCA'22 paper](https://arxiv.org/abs/2107.1167
## Setting this up ## Setting this up
### Prerequisites ### Prerequisites
- python3
- cmake - cmake
- ninja - ninja
- clang and lld (recommended) - clang and lld
Optionally, the following packages are required for the Python binding.
- pybind11 - pybind11
- python3 with numpy - numpy
### Clone ScaleHLS ### Clone ScaleHLS
```sh ```sh
@ -34,7 +37,7 @@ $ cd scalehls
``` ```
### Build ScaleHLS ### Build ScaleHLS
Run the following script to build ScaleHLS. Note that you can use `-j xx` to specify the number of parallel linking jobs. Run the following script to build ScaleHLS. Optionally, add `-p ON` to enable the Python binding and `-j xx` to specify the number of parallel linking jobs.
```sh ```sh
$ ./build-scalehls.sh $ ./build-scalehls.sh
``` ```
@ -60,7 +63,7 @@ $ scalehls-opt test_gemm.mlir -debug-only=scalehls \
| scalehls-translate -emit-hlscpp > test_gemm_dse.cpp | scalehls-translate -emit-hlscpp > test_gemm_dse.cpp
``` ```
Meanwhile, we provide a `pyscalehls` tool to showcase the `scalehls` Python library: If Python binding is enabled, we provide a `pyscalehls` tool to showcase the `scalehls` Python library:
```sh ```sh
$ pyscalehls.py test_gemm.c -f test_gemm > test_gemm_pyscalehls.cpp $ pyscalehls.py test_gemm.c -f test_gemm > test_gemm_pyscalehls.cpp
``` ```

View File

@ -5,10 +5,11 @@ set -o pipefail
set -o nounset set -o nounset
# Script options. # Script options.
while getopts 'j:' opt while getopts 'j:p:' opt
do do
case $opt in case $opt in
j) JOBS="${OPTARG}";; j) JOBS="${OPTARG}";;
p) PYBIND="${OPTARG}";;
esac esac
done done
@ -44,8 +45,8 @@ if [ ! -f "CMakeCache.txt" ]; then
-DLLVM_TARGETS_TO_BUILD="host" \ -DLLVM_TARGETS_TO_BUILD="host" \
-DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_BUILD_TYPE=DEBUG \ -DCMAKE_BUILD_TYPE=DEBUG \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DMLIR_ENABLE_BINDINGS_PYTHON="${PYBIND:=OFF}" \
-DSCALEHLS_ENABLE_BINDINGS_PYTHON=ON \ -DSCALEHLS_ENABLE_BINDINGS_PYTHON="${PYBIND:=OFF}" \
-DLLVM_PARALLEL_LINK_JOBS="${JOBS:=}" \ -DLLVM_PARALLEL_LINK_JOBS="${JOBS:=}" \
-DLLVM_USE_LINKER=lld \ -DLLVM_USE_LINKER=lld \
-DCMAKE_C_COMPILER=clang \ -DCMAKE_C_COMPILER=clang \