build.sh 1.5 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
  
  # Initialization model
B
Bo Zhou 已提交
17
  if [ ! -d ./demo/paddle/cartpole_init_model ]; then
Z
zenghsh3 已提交
18 19
    unzip ./demo/paddle/cartpole_init_model.zip -d ./demo/paddle/
  fi
Z
zenghsh3 已提交
20 21 22 23 24 25

  FLAGS=" -DWITH_PADDLE=ON"
elif [ $1 = "torch" ]; then
  #---------------libtorch-------------#
  if [ ! -d "./libtorch" ];then
    echo "Cannot find the torch library: ./libtorch"
R
rical730 已提交
26 27 28 29 30
      echo "Downloading Torch library"
      wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcpu.zip
      unzip -q libtorch-cxx11-abi-shared-with-deps-1.4.0+cpu.zip
      rm -rf libtorch-cxx11-abi-shared-with-deps-1.4.0+cpu.zip
      echo "Torch library Downloaded"
Z
zenghsh3 已提交
31 32 33 34 35 36 37
  fi
  FLAGS=" -DWITH_TORCH=ON"
else
  echo "Invalid arguments. [paddle/torch]"
  exit 0
fi

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

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

#-----------------run----------------#
54
./parallel_main