build.sh 1.3 KB
Newer Older
1
#!/bin/bash
Z
zenghsh3 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14

if [ $# != 1 ]; then
  echo "You must choose one framework (paddle/torch) to compile DeepES."
  exit 0
fi

if [ $1 = "paddle" ]; then
  #---------------paddlelite-------------#
  if [ ! -d "./inference_lite_lib" ];then
    echo "Cannot find the PaddleLite library: ./inference_lite_lib"
    echo "Please put the PaddleLite libraray to current folder according the instruction in README"
    exit 1
  fi
15 16 17
  
  # Initialization model
  unzip ./demo/paddle/cartpole_init_model.zip -d ./demo/paddle/
Z
zenghsh3 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

  FLAGS=" -DWITH_PADDLE=ON"
elif [ $1 = "torch" ]; then
  #---------------libtorch-------------#
  if [ ! -d "./libtorch" ];then
    echo "Cannot find the torch library: ./libtorch"
    echo "Please put the torch libraray to current folder according the instruction in README"
    exit 1
  fi
  FLAGS=" -DWITH_TORCH=ON"
else
  echo "Invalid arguments. [paddle/torch]"
  exit 0
fi

#export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
34 35 36 37 38 39

#----------------protobuf-------------#
cp ./src/proto/deepes.proto ./
protoc deepes.proto --cpp_out ./
mv deepes.pb.h ./include
mv deepes.pb.cc ./src
Z
zenghsh3 已提交
40
rm deepes.proto
41 42

#----------------build---------------#
Z
zenghsh3 已提交
43
echo ${FLAGS}
44 45 46
rm -rf build
mkdir build
cd build
Z
zenghsh3 已提交
47
cmake ../ ${FLAGS}
48
make -j10
Z
zenghsh3 已提交
49 50

#-----------------run----------------#
51
./parallel_main