Browse by type
🕹 OpenPARF is an open-source FPGA placement and routing framework build upon the deep learning toolkit PyTorch. It is designed to be flexible, efficient, and extensible.
Flexshelf. We have also made a number of improvements to unit tests and documentation. We encourage all users to upgrade to this new version.OpenPARF is an open-source framework for FPGA rapid placement and routing, which can run on both CPU and GPU. OpenPARF provides a number of APIs to enable researchers to quickly prototype their own FPGA algorithms and evaluate their performance on real FPGA hardware.
At a granular level, OpenPARF is a framework that consists of the following components:
| Component | Description |
|---|---|
openparf |
The core placement and routing tool |
openparf.ops |
A collection of operators that allow the implementation of various P&R algorithms |
openparf.placement |
A set of APIs for performing placement tasks |
openparf.routing |
A set of APIs for performing routing tasks |
openparf.py_utils |
Provides other utility functions for Python convenience |
OpenPARF provides a compilation stack to integrate your placement and routing algorithms into operators that can be used in Python. You can extend OpenPARF as needed, making it the ideal environment for FPGA optimization enthusiasts.
Elaborating Further:
OpenPARF is a powerful FPGA P&R framework that utilizes a multi-electrostatic-based approach to achieve optimal results with respect to routed wirelength and placement speed. OpenPARF supports the following features:
- A wide range of logical unit types including LUT, FF, DSP, BRAM, IO, Distributed RAM, and Shift Register
- Support for SLICEL and SLICEM CLB heterogeneous types
- Clock routing constraints
- Advanced support for multi-die FPGA placement
- ...
OpenPARF has proven to be a powerful tool, outperforming the state-of-the-art academic FPGA P&R tools in terms of wired length and placement speed. With a 0.4-12.7% improvement in routed wirelength and a speedup of over 2X in placement, OpenPARF is a highly efficient FPGA P&R framework that offers optimized results with minimal manual intervention.

The following are the visualization for electrostatic fields in benchmark ISPD2016/FPGA06.
| LUT | FF | DSP | BRAM |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
In the ongoing endeavor to enhance OpenPARF, we have integrated a key feature from the LEAPS - a specialized solution aimed at minimizing super long line (SLL) counts in multi-die FPGA placement. This integration not only enriches OpenPARF's capabilities but also addresses the complexities of modern multi-die FPGA designs.
Compared to the existing state-of-the-art method, OpenPARF demonstrates significant superiority, achieving an average reduction of 43.08% in the SLL counts and a 9.99% optimization in half-perimeter wirelength (HPWL). Notably, OpenPARF leverages GPU acceleration technology, achieving a remarkable runtime improvement of up to 34.34X.

OpenPARF is written in C++ and Python. The following are the prerequisites for building OpenPARF.
ENABL_ROUTER to OFF when compiling OpenPARF.We have provided two ways to build OpenPARF,
We highly recommend installing an Anaconda or Mamba environment. You will get controlled dependency versions regardless of your Linux distro.
# * create and activate conda environment
mamba create --name openparf python=3.7
mamba activate openparf
# * common packages
mamba install cmake boost bison
# * Pytorch 1.7.1. Other version may also work, but have not been tested.
mamba install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=11.0 -c pytorch
# * python packages
pip install hummingbird-ml pyyaml networkx tqdm
Permit me to illuminate the exquisite process of installing Gurobi, using the recommended Gurobi 9.5.1 as a quintessential example:
<your Gurobi home>..lic. Save this file to a location of your choosing, aptly referred to as <your Gurobi license path>.~/.bashrc file.export GUROBI_HOME="<your Gurobi home>/linux64"
# For example,
# export GUROBI_HOME="/home/jingmai/softwares/gurobi951/linux64"
export GRB_LICENSE_FILE="<your Gurobi license path>"
# For example,
# export GRB_LICENSE_FILE="/home/jingmai/licenses/gurobi.lic"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
Now, please go to the Build and Install OpenPARF section to build and install OpenPARF.
You can also pull a pre-built docker image from Docker Hub.
docker pull magic3007/openparf:2.0
You can also build the docker image yourself. The dockerfile is located in docker/openparf.dockerfile. To build the image, run the following command:
cd
/docker
docker build . -t openparf:2.0 -f openparf.dockerfile
We recommend that you have the following two directories/files on your host before running docker:
: The directory where you store the OpenPARF source code on host. See [Get the OpenPARF Source](#get-the-openparf-source) for more details.
2.`: The directory where you store the ISPD 2016/2017 benchmarks on host. See Obtaining Benchmarks for more details.
Without CUDA Support To run the docker image without CUDA support, run the following command:
docker run -itd --restart=always --network host -e TERM=$TERM \
--name openparf \
-v /etc/localtime:/etc/localtime:ro \
-v <project directory on host>:/root/OpenPARF \
-v <benchmark directory on host>:/root/benchmarks \
openparf:2.0 \
/bin/bash;
With CUDA Support To run the docker image with CUDA support, run the following command:
docker run -itd --restart=always --network host -e TERM=$TERM \
--name openparf \
--gpus all \
-v /etc/localtime:/etc/localtime:ro \
-v <project directory on host>:/root/OpenPARF \
-v <benchmark directory on host>:/root/benchmarks \
openparf:2.0 \
/bin/bash;
Once the docker image is running, you can enter the docker container by running the following command:
docker exec -it openparf /bin/bash
Within the docker container:
/root/OpenPARF./root/benchmarks.NOTE that though we have gurobi 9.5.1 installed in docker (located in /opt/gurobi), due to permission reasons, if you need router, you still need to get gurobi license and place it as /root/gurobi.lic.
Now, please go to the Build and Install OpenPARF section to build and install OpenPARF.
git clone --recursive https://github.com/PKU-IDEA/OpenPARF.git
If you have already clone the repository, e.g., the repository is mounted in the docker container, you can skip this step.
Assuming that OpenAPRF is a subfolder in the current directory, i.e., ./OpenPARF is the path to the OpenPARF source code.
mkdir build
cd build
cmake ../OpenPARF -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DPYTHON_EXECUTABLE=$(which python) -DPython3_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=<installation directory>
make -j8
make install
Where <installation directory> is the directory where you want to install OpenPARF (e.g., ../install).
You can adjust the configuration of cmake variables optionally (without buiding first), by doing the following.
CMAKE_INSTALL_PREFIX: The directory where you want to install OpenPARF (e.g., ../install).CMAKE_BUILD_TYPE: The build type, can be Release or Debug. Default is Release.USE_CCACHE: Whether to use ccache to speed up compilation. Default is OFF.ENABLE_ROUTER: Whether to compile the router. Default is OFF. $ claude mcp add OpenPARF \
-- python -m otcore.mcp_server <graph>