-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ATLAS] Update ATLAS, support new APIs like get input shape map
- Loading branch information
Showing
6 changed files
with
162 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,56 @@ | ||
#!/bin/bash | ||
|
||
#export DDK_PATH=/data1/Ascend/ascend-toolkit/latest | ||
#export NPU_HOST_LIB=/data1/Ascend/ascend-toolkit/latest/acllib/lib64 | ||
|
||
ARM="ON" | ||
OPENMP="ON" | ||
DEBUG=0 | ||
SHARED_LIB="ON" | ||
BENCHMARK="OFF" | ||
TNN_TEST="ON" | ||
TARGET_ARCH=aarch64 | ||
|
||
TNN_BUILD_PATH=$PWD | ||
if [ -z $TNN_ROOT_PATH ] | ||
then | ||
TNN_ROOT_PATH=$(cd `dirname $0`; pwd)/.. | ||
fi | ||
|
||
TNN_BUILD_DIR=${TNN_ROOT_PATH}/scripts/build_atlas | ||
TNN_INSTALL_DIR=${TNN_ROOT_PATH}/scripts/release_atlas | ||
if [ $DEBUG == "ON" ]; then | ||
TNN_BUILD_DIR=${TNN_ROOT_PATH}/scripts/build_atlas_debug | ||
TNN_INSTALL_DIR=${TNN_ROOT_PATH}/scripts/release_atlas_debug | ||
fi | ||
|
||
TNN_VERSION_PATH=$TNN_ROOT_PATH/scripts/version | ||
echo $TNN_ROOT_PATH | ||
echo $TNN_VERSION_PATH | ||
echo ' ' | ||
echo '******************** step 1: update version.h ********************' | ||
cd $TNN_VERSION_PATH | ||
source $TNN_VERSION_PATH/version.sh | ||
source $TNN_VERSION_PATH/add_version_attr.sh | ||
|
||
echo ' ' | ||
echo '******************** step 2: start build atlas ********************' | ||
#删除旧SDK文件 | ||
cd $TNN_BUILD_PATH | ||
if [ -x "build_atlas" ];then | ||
rm -r build_atlas | ||
fi | ||
|
||
#新建build目录 | ||
mkdir build_atlas | ||
cd build_atlas | ||
mkdir -p ${TNN_BUILD_DIR} | ||
cd ${TNN_BUILD_DIR} | ||
|
||
|
||
cmake ${TNN_ROOT_PATH} \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DDEBUG=$DEBUG \ | ||
-DTNN_TEST_ENABLE:BOOL=$TNN_TEST \ | ||
-DTNN_BENCHMARK_MODE:BOOL=$BENCHMARK \ | ||
-DTNN_TEST_ENABLE:BOOL="ON" \ | ||
-DTNN_BENCHMARK_MODE:BOOL="OFF" \ | ||
-DTNN_CPU_ENABLE:BOOL="ON" \ | ||
-DTNN_ARM_ENABLE:BOOL=$ARM \ | ||
-DTNN_OPENMP_ENABLE:BOOL=$OPENMP \ | ||
-DTNN_ARM_ENABLE:BOOL="ON" \ | ||
-DTNN_OPENMP_ENABLE:BOOL="ON" \ | ||
-DTNN_X86_ENABLE:BOOL="OFF" \ | ||
-DTNN_BUILD_SHARED:BOOL=$SHARED_LIB \ | ||
-DTNN_BUILD_SHARED:BOOL="ON" \ | ||
-DCMAKE_SYSTEM_PROCESSOR=$TARGET_ARCH \ | ||
-DTNN_ATLAS_ENABLE:BOOL="ON" | ||
make -j8 | ||
|
||
echo ' ' | ||
echo '******************** step 3: add version attr ********************' | ||
#添加版本信息到库文件 | ||
cd $TNN_BUILD_PATH | ||
if [ "$SHARED_LIB" = "ON" ];then | ||
AddAllVersionAttr "$TNN_BUILD_PATH/build_atlas/libTNN.so" | ||
AddAllVersionAttr "$TNN_BUILD_PATH/build64/libTNN.so" | ||
else | ||
AddAllVersionAttr "$TNN_BUILD_PATH/build_atlas/libTNN.a" | ||
AddAllVersionAttr "$TNN_BUILD_PATH/build64/libTNN.a" | ||
fi | ||
echo "Building TNN on ATLAS ..." | ||
make -j $(nproc) | ||
|
||
|
||
echo '******************** step 4: copy to release ********************' | ||
cd $TNN_BUILD_PATH | ||
mkdir -p release_atlas | ||
cd release_atlas | ||
rm -rf * | ||
mkdir lib | ||
cd .. | ||
if [ "$SHARED_LIB" = "ON" ];then | ||
cp -d build_atlas/libTNN.so* release_atlas/lib | ||
else | ||
cp build_atlas/libTNN.a release_atlas/lib | ||
if [ -d ${TNN_INSTALL_DIR} ] | ||
then | ||
rm -rf ${TNN_INSTALL_DIR} | ||
fi | ||
cp -r ${TNN_ROOT_PATH}/include release_atlas | ||
mkdir ${TNN_INSTALL_DIR} | ||
mkdir ${TNN_INSTALL_DIR}/lib | ||
mkdir ${TNN_INSTALL_DIR}/bin | ||
|
||
cp -r ${TNN_ROOT_PATH}/include ${TNN_INSTALL_DIR}/ | ||
cp ${TNN_BUILD_DIR}/libTNN.so* ${TNN_INSTALL_DIR}/lib | ||
cp ${TNN_BUILD_DIR}/test/TNNTest ${TNN_INSTALL_DIR}/bin | ||
|
||
echo "build done!" | ||
echo "Building TNN on ATLAS ... done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters