From 5e06bce73873d98aa1a816772d4ec8689745a907 Mon Sep 17 00:00:00 2001 From: Corleone Date: Thu, 8 Dec 2022 11:07:01 +0800 Subject: [PATCH] adapt gcc11 for cpu codegen and default pack whl package --- build.sh | 6 ++++-- scripts/package.sh | 15 ++++++++++++++- setup.py | 14 +++++++++++--- .../incubator-tvm/cmake/modules/LLVM.cmake | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 70c0c356..052b570b --- a/build.sh +++ b/build.sh @@ -23,6 +23,7 @@ usage() echo "bash build.sh [-e cpu|gpu|ascend] [-j[n]] [-t on|off] [-o] [-u]" echo "" echo "Options:" + echo " -d Debug mode" echo " -e Hardware environment: cpu, gpu or ascend" echo " -j[n] Set the threads when building (Default: -j8)" echo " -t Unit test: on or off (Default: off)" @@ -41,7 +42,7 @@ mk_new_dir() mkdir -pv "${create_dir}" } -write_checksum() +write_checksum_tar() { cd "$OUTPUT_PATH" || exit PACKAGE_LIST=$(ls lib*.tar.gz) || exit @@ -175,7 +176,8 @@ cp libakg.so ${OUTPUT_PATH} cd ${OUTPUT_PATH} tar czvf libakg.tar.gz libakg.so rm -rf libakg.so -write_checksum +write_checksum_tar +source ${AKG_DIR}/scripts/package.sh cd - echo "---------------- AKG: build end ----------------" diff --git a/scripts/package.sh b/scripts/package.sh index 230bfcfb..e6532b04 100644 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -23,6 +23,16 @@ if [ ! -d ${OUTPUT_PATH} ]; then mkdir -pv "${OUTPUT_PATH}" fi +write_version() { + if [ ! -e ${BASEPATH}/version.txt ]; then + version=`git branch | sed -n '/\* /s///p'` + if [ -z ${version} ]; then + version='master' + fi + echo ${version#r} > ${BASEPATH}/version.txt + fi +} + write_checksum() { cd "${OUTPUT_PATH}" PACKAGE_LIST=$(ls akg-*.whl) @@ -32,6 +42,7 @@ write_checksum() { done } +write_version cd ${BASEPATH} ${PYTHON} setup.py sdist bdist_wheel @@ -46,8 +57,10 @@ do PY_TAGS="cp37-cp37m" elif [[ $PY_VERSION == *3.8* ]]; then PY_TAGS="cp38-cp38" + elif [[ $PY_VERSION == *3.9* ]]; then + PY_TAGS="cp39-cp39" else - echo "Error: Could not find Python 3.8 or Python 3.7" + echo "Error: Could not find Python between 3.7 and 3.9" exit 1 fi new_file_name="${prefix}-${PY_TAGS}-linux_${CUR_ARCH}.whl" diff --git a/setup.py b/setup.py index 0b9b15fe..a85ecd8a 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,15 @@ import os from setuptools import setup -VERSION = '1.6.0' +pwd = os.path.dirname(os.path.realpath(__file__)) + + +def _read_file(filename): + with open(os.path.join(pwd, filename), encoding='UTF-8') as f: + return f.read() + + +version = _read_file('version.txt').replace("\n", "") package_data = { 'akg': [ @@ -33,7 +41,7 @@ package_data = { def collect_dirs(cur_dir, dirs): """Collect all sub dirs in current dir.""" - for root, all_dirs, files in os.walk(cur_dir, followlinks=True): + for root, all_dirs, _ in os.walk(cur_dir, followlinks=True): for d in all_dirs: if '.' in d: continue @@ -67,7 +75,7 @@ def find_files(where=None): setup( name='akg', - version=VERSION, + version=version, author='The MindSpore Authors', author_email='contact@mindspore.cn', url='https://www.mindspore.cn/', diff --git a/third_party/incubator-tvm/cmake/modules/LLVM.cmake b/third_party/incubator-tvm/cmake/modules/LLVM.cmake index 44e326b3..7a3d6634 100644 --- a/third_party/incubator-tvm/cmake/modules/LLVM.cmake +++ b/third_party/incubator-tvm/cmake/modules/LLVM.cmake @@ -36,7 +36,7 @@ if(NOT USE_LLVM STREQUAL "OFF") set_source_files_properties(${COMPILER_LLVM_SRCS} PROPERTIES COMPILE_DEFINITIONS "DMLC_ENABLE_RTTI=0") set_source_files_properties(${COMPILER_LLVM_SRCS} - PROPERTIES COMPILE_FLAGS "-fno-rtti -Wno-init-list-lifetime") + PROPERTIES COMPILE_FLAGS "-fno-rtti -Wno-init-list-lifetime -Wno-mismatched-new-delete -Wno-deprecated-declarations") endif() endif() endif()