triton_build.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/bash
  2. for i in "$@"; do
  3. case $i in
  4. --triton_client=*)
  5. TRITON_CLIENT="${i#*=}"
  6. shift
  7. ;;
  8. *)
  9. echo "unknown option $i"
  10. exit 1
  11. ;;
  12. esac
  13. done
  14. if [ $TRITON_CLIENT ];then
  15. echo "TRITON_CLIENT = $TRITON_CLIENT"
  16. else
  17. echo "TRITON_CLIENT is not exist, please set by --triton_client"
  18. exit 1
  19. fi
  20. # install relayed library
  21. sh $(pwd)/scripts/triton_env.sh
  22. # download opencv library
  23. OPENCV_DIR=$(pwd)/deps/opencv3.4.6gcc4.8ffmpeg/
  24. {
  25. bash $(pwd)/scripts/bootstrap.sh ${OPENCV_DIR}
  26. } || {
  27. echo "Fail to execute script/bootstrap.sh"
  28. exit -1
  29. }
  30. # download glog library
  31. GLOG_DIR=$(pwd)/deps/glog/
  32. GLOG_URL=https://bj.bcebos.com/paddlex/deploy/glog.tar.gz
  33. if [ ! -d $(pwd)deps/ ]; then
  34. mkdir -p deps
  35. fi
  36. if [ ! -d ${GLOG_DIR} ]; then
  37. cd deps
  38. wget -c ${GLOG_URL} -O glog.tar.gz
  39. tar -zxvf glog.tar.gz
  40. rm -rf glog.tar.gz
  41. cd ..
  42. fi
  43. # download gflogs library
  44. GFLAGS_DIR=$(pwd)/deps/gflags/
  45. GFLAGS_URL=https://bj.bcebos.com/paddlex/deploy/gflags.tar.gz
  46. if [ ! -d ${GFLAGS_DIR} ]; then
  47. cd deps
  48. wget -c ${GFLAGS_URL} -O glags.tar.gz
  49. tar -zxvf gflags.tar.gz
  50. rm -rf gflags.tar.gz
  51. cd ..
  52. fi
  53. # install libpng needed by opencv
  54. ldconfig -p | grep png16 > log
  55. if [ $? -ne 0 ];then
  56. apt-get install libpng16-16
  57. fi
  58. # install libjasper1 needed by opencv
  59. ldconfig -p | grep libjasper > log
  60. if [ $? -ne 0 ];then
  61. add-apt-repository > log
  62. if [ $? -ne 0 ]; then
  63. apt-get install software-properties-common
  64. fi
  65. add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
  66. apt update
  67. apt install libjasper1 libjasper-dev
  68. fi
  69. rm -rf build
  70. mkdir -p build
  71. cd build
  72. cmake ../demo/onnx_triton/ \
  73. -DTRITON_CLIENT=${TRITON_CLIENT} \
  74. -DOPENCV_DIR=${OPENCV_DIR} \
  75. -DGLOG_DIR=${GLOG_DIR} \
  76. -DGFLAGS_DIR=${GFLAGS_DIR}
  77. make -j16