Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
Yixing Lao edited this page Sep 7, 2018 · 24 revisions

Build ngraph-he

1. Build HE Transformer without TF

  • Create build directory
cd /home/yixing/repo/he-transformer/
mkdir build
cd build
  • To build without ngraph-tf, we can build nGraph automatically
cmake ..
make -j
  • Run C++ Native example: in build
./test/unit-test --gtest_filter="HE_SEAL.ab"
./test/unit-test --gtest_filter="HE_HEAAN.ab"

2. Build HE Transformer with TF

  • Crate python virtualenv
virtualenv /home/yixing/repo/venvs/he3 -p python3
source ~/repo/venvs/he3/bin/activate
  • Install tensorflow-1.9 pip inside virtualenv
cd ~/repo/ngraph-tf
pip install tensorflow-1.9.0-cp35-cp35m-linux_x86_64.whl
  • Build ngraph-tf
cd ~/repo/ngraph-tf
mkdir build
cd build
cmake ..
make -j

#  Install ngraph-tf
make install

# Inside the virtualenv
pip install python/dist/ngraph-0.5.0-py2.py3-none-linux_x86_64.whl

# Try importing -- this shouldn't crash
python -c "import ngraph"
  • To config with ngraph-tf First we need to clean up our original he-transformer build
cd /home/yixing/repo/he-transformer
rm -rf build
mkdir build
cd build

Next we’ll configure he-transformer with the ngrpah-tf

cmake .. -DCMAKE_BUILD_TYPE=Debug -DPREBUILD_NGRAPH_INCLUDE_DIR=/home/yixing/repo/ngraph-tf/build/ngraph/ngraph_dist/include -DPREBUILD_NGRAPH_LIB_DIR=/home/yixing/repo/venvs/he3/lib/python3.5/site-packages/ngraph # <- missing "h" here

make -j

# this make install will install libhe_backend.so into the python site-packages
make install
  • Run TF python model
# source activate virtualenv first
source ~/repo/venvs/he3/bin/activate
cd /home/yixing/repo/ngraph-tf/examples

# run on ngraph-CPU
python axpy.py

# run on SEAL
LD_LIBRARY_PATH=$HOME/repo/venvs/he3/lib/python3.5/site-packages/ngraph NGRAPH_TF_BACKEND=HE_SEAL NGRAPH_ENABLE_SERIALIZE=1 python axpy.py

# run on HEAAN
LD_LIBRARY_PATH=$HOME/repo/venvs/he3/lib/python3.5/site-packages/ngraph NGRAPH_TF_BACKEND=HE_HEAAN NGRAPH_ENABLE_SERIALIZE=1 python axpy.py
Clone this wiki locally