DreamPlace 是一款芯片放置工具,用于宏單元(macro)和標準單元(Standard Cell)的放置以及布線,并計算 HPWL、Overlap 等用于衡量芯片性能的參數。
一、環境
1. 系統環境:Ubuntu 20.04
DreamPlace 只能在 Linux 環境使用
2. Python 環境:
- Python 3.8
- PyTorch 2.0.0
- Cuda 11.8
二、安裝 Dreamplace
1. 安裝第三方 Dependency
- Boost
sudo apt-get update sudo apt-get install libboost-all-dev
- Bison & flex
sudo apt-get install flex bison
2. 下載 DreamPlace
git clone --recursive https://github.com/limbo018/DREAMPlace.git
3. 安裝 Python Dependency
cd DREAMPlace
pip install -r requirements.txt
4. Build Dreamplace
build 之前需要先打開 DREAMPlace/dreamplace/ops/CMakeLists.txt
文件,把第 12 行的注釋打開(不然無法安裝這個包,我在運行 deepplace 的時候用到了這個包,其他情況下還沒有用到)
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=<installation directory> -DPython_EXECUTABLE=$(which python)
make
make install
-DCMAKE_INSTALL_PREFIX
是安裝路徑,默認是DREAMPLACE/install
-DPython_EXECUTABLE
是 python 路徑,如果有 anaconda 默認是 base 環境
5. Install Benchmarks
cd ../install
python benchmarks/ispd2005_2015.py
另外,benchmark 也可以自己下載并解壓到正確的文件夾下,具體位置可參考下文目錄樹。DreamPlace 只支持 bookshelf 和 Lef/Def 格式的文件。
6. 測試是否安裝成功
python dreamplace/Placer.py test/ispd2005/adaptec1.json
python unittest/ops/hpwl_unittest.py
安裝完成后的目錄結構如下,主要用到的東西都在 install
文件夾內:
DREAMPlace
|-- CMakeLists.txt
|-- Dockerfile
|-- LICENSE
|-- README.md
|-- benchmarks
|-- build
|-- cmake
|-- dreamplace
|-- images
|-- install
| |-- benchmarks
| | |-- ispd2005
| | | |-- adaptec1
| | | | |-- adaptec1.aux
| | | | |-- adaptec1.dp.aux
| | | | |-- adaptec1.eplace-ip.pl
| | | | |-- adaptec1.eplace.aux
| | | | |-- adaptec1.lg.pl
| | | | |-- adaptec1.nets
| | | | |-- adaptec1.nodes
| | | | |-- adaptec1.pl
| | | | |-- adaptec1.scl
| | | | `-- adaptec1.wts
| | | |-- adaptec2
| | | |-- adaptec3
| | | |-- adaptec4
| | | |-- bigblue1
| | | |-- bigblue2
| | | |-- bigblue3
| | | `-- bigblue4
| | |-- ispd2005_2015.py
| | `-- ispd2019.py
| |-- bin
| |-- dreamplace
| | |-- BasicPlace.py
| | |-- EvalMetrics.py
| | |-- NesterovAcceleratedGradientOptimizer.py
| | |-- NonLinearPlace.py
| | |-- Params.py
| | |-- PlaceDB.py
| | |-- PlaceObj.py
| | |-- Placer.py
| | |-- Timer.py
| | |-- __init__.py
| | |-- configure.py
| | |-- ops
| | `-- params.json
| |-- include
| |-- lib
| |-- test
| | |-- dac2012
| | |-- iccad2014
| | |-- iccad2015.ot
| | |-- ispd2005
| | |-- ispd2015
| | `-- ispd2019
| |-- thirdparty
| `-- unittest
|-- requirements.txt
|-- test
|-- thirdparty
`-- unittest
三、測試腳本
回到根目錄根目錄創建新文件夾,并創建測試腳本
cd ~
mkdir test_dreamplace
cd test_dreamplace
vim main.py
腳本內容如下,其中 params 用來加載配置參數,我們需要提供關于 bechmark 的配置文件,配置文件格式可以參考 test
文件夾內的文件:
import Params, Placerparams = Params.Params()# load parameters
add = "./test/ispd2005/adaptec3.json"
params.load(add)
r = Placer.place(params)
r = r[-3][0]
wl = float(r[0].hpwl.data)
overf = float(r[0].overflow.data)print(wl)
print(overf)
將 DreamPlace 移植到該目錄下:
cd ~
cp -r DREAMPlace/install/* test_dreamplace/
然后將 test_dreamplace/dreamplace
文件夾下的除 ops、init.py、configure.py 之外的其他文件移動到 test_dreamplace/
目錄下。
之后運行腳本跑通即可:
python main.py
目前該文件夾結構為:
test_dreamplace
|-- BasicPlace.py
|-- EvalMetrics.py
|-- NesterovAcceleratedGradientOptimizer.py
|-- NonLinearPlace.py
|-- Params.py
|-- PlaceDB.py
|-- PlaceObj.py
|-- Placer.py
|-- Timer.py
|-- __pycache__
|-- benchmarks
| |-- ispd2005
| |-- ispd2005_2015.py
| `-- ispd2019.py
|-- bin
|-- dreamplace
| |-- __init__.py
| |-- __pycache__
| |-- configure.py
| `-- ops
|-- include
|-- lib
|-- main.py
|-- params.json
|-- results
| `-- adaptec3
|-- test
|-- thirdparty
`-- unittest