OpenPARF provides two ways to build and install:
- Build from source
- Build with Docker
We recommend using Anaconda/Mamba for dependency management:
# Create and activate conda environment
mamba create --name openparf python=3.7
mamba activate openparf
# Install common packages
mamba install cmake boost bison
# Install PyTorch 1.7.1
mamba install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=11.0 -c pytorch
# Install Python packages
pip install hummingbird-ml pyyaml networkx tqdm
- Download gurobi9.5.1_linux64.tar.gz
- Extract to
<your Gurobi home>
- Obtain a license from Gurobi website
- Set environment variables in
~/.bashrc
:
export GUROBI_HOME="<your Gurobi home>/linux64"
export GRB_LICENSE_FILE="<your Gurobi license path>"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
docker pull magic3007/openparf:2.0
cd <source directory>/docker
docker build . -t openparf:2.0 -f openparf.dockerfile
Without CUDA Support:
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:
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
docker exec -it openparf /bin/bash
git clone --recursive https://github.com/PKU-IDEA/OpenPARF.git
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
Adjustable CMake variables:
CMAKE_INSTALL_PREFIX
: Installation directoryCMAKE_BUILD_TYPE
: Release/Debug (Default: Release)USE_CCACHE
: Enable ccache (Default: OFF)ENABLE_ROUTER
: Enable router compilation (Default: OFF)