forked from mindspore-Ecosystem/mindspore
Distinguish package name according to hardware platform
This commit is contained in:
parent
a06853ccdb
commit
27e49d1415
6
build.sh
6
build.sh
|
@ -452,8 +452,10 @@ if [[ "X$INC_BUILD" = "Xoff" ]]; then
|
||||||
bash "${PROJECT_PATH}/package.sh" ge
|
bash "${PROJECT_PATH}/package.sh" ge
|
||||||
elif [[ "X$ENABLE_GPU" = "Xon" ]]; then
|
elif [[ "X$ENABLE_GPU" = "Xon" ]]; then
|
||||||
bash "${PROJECT_PATH}/package.sh" ms gpu
|
bash "${PROJECT_PATH}/package.sh" ms gpu
|
||||||
elif [[ "X$ENABLE_D" = "Xon" ]] || [[ "X$ENABLE_CPU" = "Xon" ]]; then
|
elif [[ "X$ENABLE_D" = "Xon" ]]; then
|
||||||
bash "${PROJECT_PATH}/package.sh" ms
|
bash "${PROJECT_PATH}/package.sh" ms ascend
|
||||||
|
elif [[ "X$ENABLE_CPU" = "Xon" ]]; then
|
||||||
|
bash "${PROJECT_PATH}/package.sh" ms cpu
|
||||||
else
|
else
|
||||||
bash "${PROJECT_PATH}/package.sh" debug
|
bash "${PROJECT_PATH}/package.sh" debug
|
||||||
fi
|
fi
|
||||||
|
|
17
package.sh
17
package.sh
|
@ -96,14 +96,29 @@ if [ -n "$1" ];then
|
||||||
else
|
else
|
||||||
export BACKEND_POLICY="ms"
|
export BACKEND_POLICY="ms"
|
||||||
fi
|
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
|
${PYTHON} "${BASEPATH}/setup_package.py" bdist_wheel
|
||||||
|
|
||||||
chmod -R 700 ${PACKAGE_PATH}/mindspore/
|
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
|
# rename package
|
||||||
PACKAGE_FULL_NAME=$(find "${PACKAGE_PATH}" -iname "*.whl")
|
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=$(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"
|
PACKAGE_NEW_NAME="${PACKAGE_BASE_NAME}-${PY_TAGS}-${PLATFORM_TAG}.whl"
|
||||||
cp -rf "${PACKAGE_PATH}/dist"/*.whl "${PACKAGE_PATH}/${PACKAGE_NEW_NAME}"
|
cp -rf "${PACKAGE_PATH}/dist"/*.whl "${PACKAGE_PATH}/${PACKAGE_NEW_NAME}"
|
||||||
|
|
|
@ -21,7 +21,6 @@ from setuptools import setup, find_packages
|
||||||
from setuptools.command.egg_info import egg_info
|
from setuptools.command.egg_info import egg_info
|
||||||
from setuptools.command.build_py import build_py
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
package_name = 'mindspore'
|
|
||||||
version = '0.1.0'
|
version = '0.1.0'
|
||||||
author = 'The MindSpore Authors'
|
author = 'The MindSpore Authors'
|
||||||
author_email = 'contact@mindspore.cn'
|
author_email = 'contact@mindspore.cn'
|
||||||
|
@ -29,6 +28,7 @@ home_page = 'https://www.mindspore.cn'
|
||||||
|
|
||||||
backend_policy = os.getenv('BACKEND_POLICY')
|
backend_policy = os.getenv('BACKEND_POLICY')
|
||||||
commit_id = os.getenv('COMMIT_ID').replace("\n", "")
|
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__))
|
pwd = os.path.dirname(os.path.realpath(__file__))
|
||||||
pkg_dir = os.path.join(pwd, 'build/package')
|
pkg_dir = os.path.join(pwd, 'build/package')
|
||||||
|
|
Loading…
Reference in New Issue