@@ -98,7 +98,7 @@ EOF | |||||
} | } | ||||
function parse_args(){ | function parse_args(){ | ||||
parsed_args=$(getopt -a -o bperh --long build,pull,enter,resethelp -- "$@") || { | |||||
parsed_args=$(getopt -a -o bperh --long build,pull,enter,reset,help -- "$@") || { | |||||
help | help | ||||
exit 1 | exit 1 | ||||
} | } | ||||
@@ -41,20 +41,13 @@ $ cd ./scripts | |||||
$ ./ge.sh env | $ ./ge.sh env | ||||
``` | ``` | ||||
3.配置外部依赖服务器信息 | |||||
```sh | |||||
ge config -i=121.36.**.** -u=asc**, -p=Asc***\#@\!$ (Need add escape character \ before special charactor $、#、!) | |||||
``` | |||||
4.下载和安装构建所依赖的外部库 | |||||
```sh | |||||
$ ge update | |||||
``` | |||||
3.下载和安装构建所依赖的外部库 | |||||
```sh | |||||
$ ge update | |||||
``` | |||||
(注:进入容器后,`ge`命令已经自动注册进系统,因此容器内不需要写脚本全称) | (注:进入容器后,`ge`命令已经自动注册进系统,因此容器内不需要写脚本全称) | ||||
5.执行测试,默认执行单元测试用例,`ge test`会自动触发构建 | |||||
4.执行测试,默认执行单元测试用例,`ge test`会自动触发构建 | |||||
```sh | ```sh | ||||
$ ge test | $ ge test | ||||
@@ -140,7 +133,7 @@ Options: | |||||
-p, --password Config password | -p, --password Config password | ||||
-h, --help | -h, --help | ||||
Example: ge config -i=121.36.**.** -u=asc**, -p=Asc***\#@\!$ (Need add escape character \ before special charactor $、#、!) | |||||
Example: ge config -i=<ip-adress> -u=<username> -p=<password> (Need add escape character \ before special charactor $、#、!) | |||||
``` | ``` | ||||
参数详细解释: | 参数详细解释: | ||||
@@ -164,6 +157,7 @@ Usage: ge update [OPTIONS] | |||||
update dependencies of build and test | update dependencies of build and test | ||||
Options: | Options: | ||||
-p, --public Download dependencies from community | |||||
-d, --download Download dependencies | -d, --download Download dependencies | ||||
-i, --install Install dependencies | -i, --install Install dependencies | ||||
-c, --clear Clear dependencies | -c, --clear Clear dependencies | ||||
@@ -171,7 +165,7 @@ Options: | |||||
``` | ``` | ||||
参数详细解释: | 参数详细解释: | ||||
- `-p, --public` : 从社区下载安装依赖库; | |||||
- `-d, --download` : 下载构建需要外部依赖库; | - `-d, --download` : 下载构建需要外部依赖库; | ||||
- `-i, --install` : 安装外部依赖包到对应位置; | - `-i, --install` : 安装外部依赖包到对应位置; | ||||
- `-c, --clear` : 清除下载的外部依赖包; | - `-c, --clear` : 清除下载的外部依赖包; | ||||
@@ -200,28 +194,6 @@ Options: | |||||
默认:格式化本次修改代码。 | 默认:格式化本次修改代码。 | ||||
### `ge lint` | |||||
使用clang-format进行代码格式化检查,具体参数如下: | |||||
```sh | |||||
$ ge lint -h | |||||
Options: | |||||
-a Check code format of all files, default case | |||||
-c Check code format of the files changed compared to last commit | |||||
-l Check code format of the files changed in last commit | |||||
-h Print usage | |||||
``` | |||||
参数详细解释: | |||||
- `-a` : 检查所有代码格式; | |||||
- `-c` : 只检查修改的代码格式; | |||||
- `-l` : 检查上次提交的代码格式; | |||||
默认:检查本次修改代码格式。 | |||||
### `ge build` | ### `ge build` | ||||
执行构建 (注:调用原有build.sh脚本,改造中...); | 执行构建 (注:调用原有build.sh脚本,改造中...); | ||||
@@ -0,0 +1,34 @@ | |||||
#!/bin/bash | |||||
# Copyright 2021 Huawei Technologies Co., Ltd | |||||
# | |||||
# Licensed under the Apache License, Version 2.0 (the "License"); | |||||
# you may not use this file except in compliance with the License. | |||||
# You may obtain a copy of the License at | |||||
# | |||||
# http://www.apache.org/licenses/LICENSE-2.0 | |||||
# | |||||
# Unless required by applicable law or agreed to in writing, software | |||||
# distributed under the License is distributed on an "AS IS" BASIS, | |||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
# See the License for the specific language governing permissions and | |||||
# limitations under the License. | |||||
# ============================================================================ | |||||
set -e | |||||
#社区版 | |||||
CHIP_NAME_C=A800-9010 | |||||
DRIVER_VERSION_C=21.0.rc1 | |||||
DRIVER_RUN_NAME_C=${CHIP_NAME_C}-npu-driver_${DRIVER_VERSION_C}_ubuntu18.04-x86_64.run | |||||
DRIVER_SERVER_PATH_C=https://obs-9be7.obs.cn-east-2.myhuaweicloud.com | |||||
export DRIVER_URL_C=${DRIVER_SERVER_PATH_C}/turing/resourcecenter/Software/AtlasI/A800-9010%201.0.10/NPU/${DRIVER_RUN_NAME_C} | |||||
PACKAGE_VERSION_C=5.0.2.alpha002 | |||||
PACKAGE_NAME_C=Ascend-cann-toolkit_${PACKAGE_VERSION_C}_linux-x86_64.run | |||||
PACKAGE_SERVER_PATH_C=https://mirrors.huaweicloud.com | |||||
export PACKAGE_URL_C=${PACKAGE_SERVER_PATH_C}/ascend/autoarchive/CANN/${PACKAGE_VERSION_C}/${PACKAGE_NAME_C} | |||||
DEV_TOOLS_VERSION_C=1.78.t12.0.b120 | |||||
CPU_ARCH_C=linux.x86_64 | |||||
export ATC_RUN_NAME_C=Ascend-atc-${DEV_TOOLS_VERSION_C}-${CPU_ARCH_C}.run | |||||
export ACL_RUN_NAME_C=Ascend-acllib-${DEV_TOOLS_VERSION_C}-${CPU_ARCH_C}.run | |||||
export FWKACL_RUN_NAME_C=Ascend-fwkacllib-${DEV_TOOLS_VERSION_C}-${CPU_ARCH_C}.run | |||||
set +e |
@@ -34,6 +34,19 @@ function extract_deps_so() | |||||
./${DEV_TOOLS_PACKAGE}/${FWKACL_RUN_NAME} --noexec --extract=${DEP_TMP_DIR}/fwkacllib | ./${DEV_TOOLS_PACKAGE}/${FWKACL_RUN_NAME} --noexec --extract=${DEP_TMP_DIR}/fwkacllib | ||||
} | } | ||||
function extract_deps_so_community() | |||||
{ | |||||
echo "begin to extract .run file ........." | |||||
chmod +x ./${DRIVER_RUN_NAME_C} | |||||
chmod +X ./${PACKAGE_NAME_C} | |||||
[ -n "${DEP_TMP_DIR}" ] && rm -rf "${DEP_TMP_DIR}" | |||||
./${DRIVER_RUN_NAME_C} --noexec --extract=${DEP_TMP_DIR}/driver | |||||
./${PACKAGE_NAME_C} --noexec --extract=${DEP_TMP_DIR}/Packages_tmp | |||||
${DEP_TMP_DIR}/Packages_tmp/run_package/${ATC_RUN_NAME_C} --noexec --extract=${DEP_TMP_DIR}/atc | |||||
${DEP_TMP_DIR}/Packages_tmp/run_package/${ACL_RUN_NAME_C} --noexec --extract=${DEP_TMP_DIR}/acllib | |||||
${DEP_TMP_DIR}/Packages_tmp/run_package/${FWKACL_RUN_NAME_C} --noexec --extract=${DEP_TMP_DIR}/fwkacllib | |||||
} | |||||
function copy_so_to_target_dir() | function copy_so_to_target_dir() | ||||
{ | { | ||||
mkdir -p $DEP_LIB_DIR | mkdir -p $DEP_LIB_DIR | ||||
@@ -59,7 +72,19 @@ function download_runs() | |||||
wget --user=${DEP_USER} --password=${DEP_PASSWORD} ${DRIVER_URL} | wget --user=${DEP_USER} --password=${DEP_PASSWORD} ${DRIVER_URL} | ||||
wget --user=${DEP_USER} --password=${DEP_PASSWORD} ${DEV_TOOLS_URL} | wget --user=${DEP_USER} --password=${DEP_PASSWORD} ${DEV_TOOLS_URL} | ||||
popd >/dev/null | popd >/dev/null | ||||
} | |||||
function download_runs_from_community | |||||
{ | |||||
source scripts/update/deps_config_community.sh | |||||
echo "begin to download .run file from community........." | |||||
clear_libs | |||||
mkdir -p ./ ${DOWNLOAD_PATH} | |||||
pushd "${DOWNLOAD_PATH}" >/dev/null | |||||
cd ${DOWNLOAD_PATH} | |||||
wget ${DRIVER_URL_C} | |||||
wget ${PACKAGE_URL_C} | |||||
popd >/dev/null | |||||
} | } | ||||
function install_deps() | function install_deps() | ||||
@@ -73,6 +98,17 @@ function install_deps() | |||||
popd >/dev/null | popd >/dev/null | ||||
} | } | ||||
function install_deps_community() | |||||
{ | |||||
source scripts/update/deps_config_community.sh | |||||
mkdir -p ./ ${DOWNLOAD_PATH} | |||||
pushd "${DOWNLOAD_PATH}" >/dev/null | |||||
cd ${DOWNLOAD_PATH} | |||||
extract_deps_so_community | |||||
copy_so_to_target_dir | |||||
popd >/dev/null | |||||
} | |||||
function help(){ | function help(){ | ||||
cat <<-EOF | cat <<-EOF | ||||
@@ -81,6 +117,7 @@ Usage: ge update [OPTIONS] | |||||
update dependencies of build and test | update dependencies of build and test | ||||
Options: | Options: | ||||
-p, --public Download dependencies from community | |||||
-d, --download Download dependencies | -d, --download Download dependencies | ||||
-i, --install Install dependencies | -i, --install Install dependencies | ||||
-c, --clear Clear dependencies | -c, --clear Clear dependencies | ||||
@@ -90,20 +127,24 @@ EOF | |||||
} | } | ||||
function parse_args(){ | function parse_args(){ | ||||
parsed_args=$(getopt -a -o dich --long download,install,clear,help -- "$@") || { | |||||
parsed_args=$(getopt -a -o pdich --long public,download,install,clear,help -- "$@") || { | |||||
help | help | ||||
exit 1 | exit 1 | ||||
} | } | ||||
if [ $# -lt 1 ]; then | if [ $# -lt 1 ]; then | ||||
download_runs | |||||
install_deps | |||||
download_runs_from_community | |||||
install_deps_community | |||||
exit 1 | exit 1 | ||||
fi | fi | ||||
eval set -- "$parsed_args" | eval set -- "$parsed_args" | ||||
while true; do | while true; do | ||||
case "$1" in | case "$1" in | ||||
-p | --public) | |||||
download_runs_from_community | |||||
install_deps_community | |||||
;; | |||||
-d | --download) | -d | --download) | ||||
download_runs | download_runs | ||||
;; | ;; | ||||