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

If the setup has already been done

TLDR, if the setup has already been done, here's the command to run

# Without TF
$ cd ~/repo/he-transformer/build
$ ./test/unit-test --gtest_filter="HE_HEAAN.ab"

# With TF
# activate python env with tf and ngraph installed
$ source ~/repo/venvs/he3/bin/activate
$ cd ~/repo/ngraph-tf/examples/
$ NGRAPH_TF_BACKEND=HE_SEAL python axpy.py
$ deactivate

Build ngraph-he

1. Build HE Transformer without TF

  • Create build directory
cd ~/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

2.1 Create python virtualenv and install TF

virtualenv ~/repo/venvs/he3 -p python3
source ~/repo/venvs/he3/bin/activate
pip install tensorflow

2.2 Build he-tr with ngraph-tf

  • Create build directory
cd ~/repo/he-transformer/
mkdir build
cd build
  • Build he-transformer with ngraph-tf

Note: must be done inside the virtualenv

cmake .. -DHE_TF=ON (-DPREBUILD_NGRAPH_LIB_DIR=~/repo/venvs/he3/lib/python3.5/site-packages/ngraph)
  • Installs libhe_backend.so into the python site-packages make -j make install

### 2.4 Run TF python model

Note: must be done inside the virtualenv

```bash
# 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
NGRAPH_TF_BACKEND=HE_SEAL NGRAPH_ENABLE_SERIALIZE=1 python axpy.py

# run on HEAAN
NGRAPH_TF_BACKEND=HE_HEAAN NGRAPH_ENABLE_SERIALIZE=1 python axpy.py
Clone this wiki locally