Distinguish package name according to hardware platform

This commit is contained in:
zhoufeng 2020-04-06 12:17:43 +08:00
parent a06853ccdb
commit 27e49d1415
3 changed files with 21 additions and 4 deletions

View File

@ -452,8 +452,10 @@ if [[ "X$INC_BUILD" = "Xoff" ]]; then
bash "${PROJECT_PATH}/package.sh" ge
elif [[ "X$ENABLE_GPU" = "Xon" ]]; then
bash "${PROJECT_PATH}/package.sh" ms gpu
elif [[ "X$ENABLE_D" = "Xon" ]] || [[ "X$ENABLE_CPU" = "Xon" ]]; then
bash "${PROJECT_PATH}/package.sh" ms
elif [[ "X$ENABLE_D" = "Xon" ]]; then
bash "${PROJECT_PATH}/package.sh" ms ascend
elif [[ "X$ENABLE_CPU" = "Xon" ]]; then
bash "${PROJECT_PATH}/package.sh" ms cpu
else
bash "${PROJECT_PATH}/package.sh" debug
fi

View File

@ -96,14 +96,29 @@ if [ -n "$1" ];then
else
export BACKEND_POLICY="ms"
fi
# package name
if [[ "X$1" = "Xge" ]]; then
export MS_PACKAGE_NAME="mindspore"
elif [[ "X$1" = "Xms" && "X$2" = "Xgpu" ]]; then
export MS_PACKAGE_NAME="mindspore-gpu"
elif [[ "X$1" = "Xms" && "X$2" = "Xascend" ]]; then
export MS_PACKAGE_NAME="mindspore-ascend"
elif [[ "X$1" = "Xms" && "X$2" = "Xcpu" ]]; then
export MS_PACKAGE_NAME="mindspore"
else
export MS_PACKAGE_NAME="mindspore"
fi
${PYTHON} "${BASEPATH}/setup_package.py" bdist_wheel
chmod -R 700 ${PACKAGE_PATH}/mindspore/
chmod -R 700 ${PACKAGE_PATH}/mindspore.egg-info/
chmod -R 700 ${PACKAGE_PATH}/${MS_PACKAGE_NAME//-/_}.egg-info/
# rename package
PACKAGE_FULL_NAME=$(find "${PACKAGE_PATH}" -iname "*.whl")
PACKAGE_BASE_NAME=$(echo ${PACKAGE_FULL_NAME} | awk -F / '{print $NF}' | awk -F - '{print $1"-"$2}')
PACKAGE_BASE_NAME=${PACKAGE_BASE_NAME//_*-/-}
PACKAGE_NEW_NAME="${PACKAGE_BASE_NAME}-${PY_TAGS}-${PLATFORM_TAG}.whl"
cp -rf "${PACKAGE_PATH}/dist"/*.whl "${PACKAGE_PATH}/${PACKAGE_NEW_NAME}"

View File

@ -21,7 +21,6 @@ from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
from setuptools.command.build_py import build_py
package_name = 'mindspore'
version = '0.1.0'
author = 'The MindSpore Authors'
author_email = 'contact@mindspore.cn'
@ -29,6 +28,7 @@ home_page = 'https://www.mindspore.cn'
backend_policy = os.getenv('BACKEND_POLICY')
commit_id = os.getenv('COMMIT_ID').replace("\n", "")
package_name = os.getenv('MS_PACKAGE_NAME').replace("\n", "")
pwd = os.path.dirname(os.path.realpath(__file__))
pkg_dir = os.path.join(pwd, 'build/package')