# Environment setup 

Add path to `libprotobuf.so` and `libnvdla_compiler.so` in LD_LIBRARY_PATH



# Compilation Command 

Compilation script : `miniera-hpvm/src/compile_benchmark.sh`

Command:

```
python3 /home/hsharif3/Gitlab/hpvm_release_nvdla/hpvm/build/tools/hpvm/tools/hpvm-clang/main.py -t nvdla --conf-file data/tuner_confs.txt -DMODEL_PARAMS_DIR=${PATH_TO_MODELPARAMS} -fno-exceptions miniera-hpvm.cpp miniera-hpvm

```

*NOTE*: by default hpvm-clang is configured to read calibration inputs from a `calib.txt` file plaed in the current build directoy (see main.py.in in hpvm-clang). Default compilation mode is INT8 - modify `main.py` in build directory to use FP16 mode (easily configurable)


# Running on EPOCHS chip 

The compilation creates an nvdla module named `hpvm-mod.nvdla` 

Connect to EPOCHS chip:

```
ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 5506 root@ espgate.cs.columbia.edu

```

*password*: `openesp` 

More instructions on EPOCHS chip here: 

https://docs.google.com/document/d/1rQa6sIDKtYHGKmWg5bPROJ_FijDUnaVEWkckLWtpHFU/edit?usp=sharing


Running on EPOCHS chip:

```

cd NV_NVDLA/

./nvdla_runtime  --loadable  hpvm-mod.nvdla --image  ${test_image}  --rawdump

```

*NOTE*  --normalize not neeed here -- input should be INT8

# Images to use for Testing 

Images to use for testing under `/benchmarks/miniera-hpvm/data/images` 

The ground truth class of the image is part of the file name. For instance, `*_1.jpg` indicates file with target class `1`.


# Frontend/Source changes required

* Weights must be FP16!

* Weights for FC layers need to be tranposed 

* Modify paths to readTrainedWeights to pass constant file path -- use MODEL_PARAMS_STR as part of string (see `miniera-hpvm.cpp` as example) 



# Missing Support 

** BatchNorm support missing (better to try on small example first)