• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2021 Huawei Technologies Co., Ltd
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ============================================================================
16
17set -e
18
19# check and set options
20process_options()
21{
22  # Process the options
23  while getopts 'drvj:c:t:hb:s:a:g:p:ie:m:l:I:RP:D:zM:V:K:B:En:A:S:k:W:H:L:y' opt
24  do
25    CASE_SENSIVE_ARG=${OPTARG}
26    OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')
27    case "${opt}" in
28      d)
29        DEBUG_MODE="on" ;;
30      n)
31        build_option_proc_n ;;
32      y)
33        export ENABLE_SYM_FILE="on" ;;
34      r)
35        export DEBUG_MODE="off" ;;
36      v)
37        build_option_proc_v ;;
38      j)
39        export THREAD_NUM=$OPTARG ;;
40      c)
41        build_option_proc_c ;;
42      t)
43        build_option_proc_t ;;
44      g)
45        build_option_proc_g ;;
46      h)
47        build_option_proc_h ;;
48      b)
49        build_option_proc_b ;;
50      a)
51        build_option_proc_a ;;
52      p)
53        build_option_proc_p ;;
54      l)
55        build_option_proc_l ;;
56      i)
57        export INC_BUILD="on" ;;
58      m)
59        build_option_proc_m ;;
60      s)
61        build_option_proc_s ;;
62      R)
63        export ENABLE_TIMELINE="on"
64        echo "enable time_line record" ;;
65      S)
66        build_option_proc_upper_s ;;
67      k)
68        check_on_off $OPTARG k
69        export ENABLE_MAKE_CLEAN="$OPTARG"
70        echo "enable make clean" ;;
71      e)
72        export DEVICE=$OPTARG ;;
73      M)
74        check_on_off $OPTARG M
75        export ENABLE_MPI="$OPTARG" ;;
76      V)
77        export DEVICE_VERSION=$OPTARG ;;
78      P)
79        check_on_off $OPTARG p
80        export ENABLE_DUMP2PROTO="$OPTARG"
81        echo "enable dump anf graph to proto file" ;;
82      D)
83        build_option_proc_upper_d ;;
84      z)
85        build_option_proc_z ;;
86      I)
87        build_option_proc_upper_i ;;
88      K)
89        export ENABLE_AKG="on"
90        echo "enable compile with akg" ;;
91      B)
92        build_option_proc_upper_b ;;
93      E)
94        export ENABLE_IBVERBS="on"
95        echo "enable IBVERBS for parameter server" ;;
96      A)
97        build_option_proc_upper_a ;;
98      W)
99        build_option_proc_upper_w ;;
100      H)
101        check_on_off $OPTARG H
102        export ENABLE_HIDDEN="$OPTARG"
103        echo "${OPTARG} hidden" ;;
104      L)
105        export ENABLE_TRT="on"
106        export TENSORRT_HOME="$CASE_SENSIVE_ARG"
107        echo "Link Tensor-RT library. Path: ${CASE_SENSIVE_ARG}" ;;
108      *)
109        echo "Unknown option ${opt}!"
110        usage
111        exit 1
112    esac
113  done
114}