Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
2dd60b4c
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2dd60b4c
编写于
4月 13, 2020
作者:
Z
zhoufeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pack via cpack
上级
60958d6b
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
283 addition
and
247 deletion
+283
-247
CMakeLists.txt
CMakeLists.txt
+3
-1
build.sh
build.sh
+2
-31
cmake/package.cmake
cmake/package.cmake
+185
-0
cmake/package_script.cmake
cmake/package_script.cmake
+92
-0
mindspore/ccsrc/CMakeLists.txt
mindspore/ccsrc/CMakeLists.txt
+1
-87
package.sh
package.sh
+0
-128
未找到文件。
CMakeLists.txt
浏览文件 @
2dd60b4c
...
...
@@ -25,7 +25,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/flatbuffers/include/flatbuffers
)
include
(
${
CMAKE_SOURCE_DIR
}
/cmake/dependency_utils.cmake
)
find_package
(
Python3 COMPONENTS Interpreter Development
)
find_package
(
Python3
3.7
COMPONENTS Interpreter Development
)
if
(
Python3_FOUND
)
set
(
PYTHON_INCLUDE_DIRS
"
${
Python3_INCLUDE_DIRS
}
"
)
set
(
PYTHON_LIBRARIES
"
${
Python3_LIBRARIES
}
"
)
...
...
@@ -60,3 +60,5 @@ add_subdirectory(mindspore/ccsrc)
if
(
ENABLE_TESTCASES
)
add_subdirectory
(
tests
)
endif
()
include
(
cmake/package.cmake
)
\ No newline at end of file
build.sh
浏览文件 @
2dd60b4c
...
...
@@ -16,7 +16,6 @@
set
-e
BASEPATH
=
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
PROJECT_PATH
=
"
${
BASEPATH
}
"
CUDA_PATH
=
""
CUDNN_PATH
=
""
export
BUILD_PATH
=
"
${
BASEPATH
}
/build/"
...
...
@@ -24,7 +23,7 @@ export BUILD_PATH="${BASEPATH}/build/"
usage
()
{
echo
"Usage:"
echo
"bash build.sh [-d] [-r] [-v] [-c on|off] [-t on|off] [-g on|off] [-h] [-
s] [-
b ge|cpu] [-m infer|train]
\\
"
echo
"bash build.sh [-d] [-r] [-v] [-c on|off] [-t on|off] [-g on|off] [-h] [-b ge|cpu] [-m infer|train]
\\
"
echo
" [-a on|off] [-g on|off] [-p on|off] [-i] [-L] [-R] [-D on|off] [-j[n]] [-e gpu|d|cpu]
\\
"
echo
" [-P on|off] [-z [on|off]] [-M on|off] [-V 9.2|10.1] [-I] [-K]"
echo
""
...
...
@@ -36,7 +35,6 @@ usage()
echo
" -t Run testcases switch, default on"
echo
" -g Use glog to output log, default on"
echo
" -h Print usage"
echo
" -s Install or setup"
echo
" -b Select other backend, available:
\\
"
echo
" ge:graph engine, cpu"
echo
" -m Select mode, available: infer, train, default is infer "
...
...
@@ -77,7 +75,6 @@ checkopts()
VERBOSE
=
""
ENABLE_COVERAGE
=
"off"
RUN_TESTCASES
=
"off"
EXECUTE_SETUP
=
"off"
ENABLE_BACKEND
=
""
TRAIN_MODE
=
"INFER"
ENABLE_ASAN
=
"off"
...
...
@@ -129,9 +126,6 @@ checkopts()
usage
exit
0
;;
s
)
EXECUTE_SETUP
=
"on"
;;
b
)
if
[[
"X
$OPTARG
"
!=
"Xge"
&&
"X
$OPTARG
"
!=
"Xcpu"
]]
;
then
echo
"Invalid value
${
OPTARG
}
for option -b"
...
...
@@ -139,9 +133,6 @@ checkopts()
exit
1
fi
ENABLE_BACKEND
=
$(
echo
"
$OPTARG
"
|
tr
'[a-z]'
'[A-Z]'
)
if
[[
"X
$ENABLE_BACKEND
"
==
"XGE"
]]
;
then
ENABLE_GE
=
"on"
fi
if
[[
"X
$ENABLE_BACKEND
"
!=
"XCPU"
]]
;
then
ENABLE_CPU
=
"on"
fi
...
...
@@ -323,10 +314,7 @@ build_mindspore()
if
[[
"X
$INC_BUILD
"
=
"Xoff"
]]
;
then
cmake
${
CMAKE_ARGS
}
../..
fi
make
${
VERBOSE
}
-j
$THREAD_NUM
if
[[
"X
$EXECUTE_SETUP
"
=
"Xon"
]]
;
then
make
install
fi
cmake
--build
.
--target
package
${
VERBOSE
}
-j
$THREAD_NUM
echo
"success to build mindspore project!"
}
...
...
@@ -457,24 +445,7 @@ else
build_mindspore
fi
if
[[
"X
$INC_BUILD
"
=
"Xoff"
]]
;
then
if
[[
"X
$ENABLE_GE
"
=
"Xon"
]]
;
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"
]]
;
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
fi
cp
-rf
${
BUILD_PATH
}
/package/mindspore/lib
${
BUILD_PATH
}
/../mindspore
cp
-rf
${
BUILD_PATH
}
/package/mindspore/
*
.so
${
BUILD_PATH
}
/../mindspore
if
[[
-d
"
${
BUILD_PATH
}
/package/build"
]]
;
then
rm
-rf
"
${
BUILD_PATH
}
/package/build"
fi
echo
"---------------- mindspore: build end ----------------"
cmake/package.cmake
0 → 100644
浏览文件 @
2dd60b4c
# include dependency
include
(
CMakePackageConfigHelpers
)
include
(
GNUInstallDirs
)
# set package information
set
(
CPACK_PACKAGE_NAME
${
PROJECT_NAME
}
)
set
(
CPACK_GENERATOR
"External"
)
set
(
CPACK_EXTERNAL_PACKAGE_SCRIPT
${
CMAKE_SOURCE_DIR
}
/cmake/package_script.cmake
)
set
(
CPACK_EXTERNAL_ENABLE_STAGING true
)
set
(
CPACK_TEMPORARY_PACKAGE_FILE_NAME
${
CMAKE_SOURCE_DIR
}
/build/package/mindspore
)
set
(
CPACK_TEMPORARY_INSTALL_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/build/package/mindspore
)
if
(
ENABLE_GE
)
set
(
CPACK_MS_BACKEND
"ge"
)
set
(
CPACK_MS_PACKAGE_NAME
"mindspore"
)
elseif
(
ENABLE_GPU
)
set
(
CPACK_MS_BACKEND
"ms"
)
set
(
CPACK_MS_PACKAGE_NAME
"mindspore-gpu"
)
elseif
(
ENABLE_D
)
set
(
CPACK_MS_BACKEND
"ms"
)
set
(
CPACK_MS_PACKAGE_NAME
"mindspore-ascend"
)
elseif
(
ENABLE_CPU
)
set
(
CPACK_MS_BACKEND
"ms"
)
set
(
CPACK_MS_PACKAGE_NAME
"mindspore"
)
else
()
set
(
CPACK_MS_BACKEND
"debug"
)
set
(
CPACK_MS_PACKAGE_NAME
"mindspore"
)
endif
()
include
(
CPack
)
# set install path
set
(
INSTALL_LIB_DIR
${
CMAKE_INSTALL_LIBDIR
}
CACHE PATH
"Installation directory for libraries"
)
set
(
INSTALL_PY_DIR
"."
)
set
(
INSTALL_LIB_DIR
"lib"
)
set
(
INSTALL_BASE_DIR
"."
)
# set package files
install
(
TARGETS _c_expression
DESTINATION
${
INSTALL_BASE_DIR
}
COMPONENT mindspore
)
install
(
TARGETS mindspore_gvar
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
if
(
USE_GLOG
)
file
(
GLOB_RECURSE GLOG_LIB_LIST
${
glog_LIBPATH
}
/libglog*
)
install
(
FILES
${
GLOG_LIB_LIST
}
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
endif
()
if
(
ENABLE_MINDDATA
)
install
(
TARGETS _c_dataengine _c_mindrecord
DESTINATION
${
INSTALL_BASE_DIR
}
COMPONENT mindspore
)
file
(
GLOB_RECURSE OPENCV_LIB_LIST
${
opencv_LIBPATH
}
/libopencv_core*
${
opencv_LIBPATH
}
/libopencv_imgcodecs*
${
opencv_LIBPATH
}
/libopencv_imgproc*
)
install
(
FILES
${
OPENCV_LIB_LIST
}
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
endif
()
if
(
ENABLE_CPU
)
if
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
)
file
(
GLOB_RECURSE DNNL_LIB_LIST
${
onednn_LIBPATH
}
/libdnnl
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
*
)
elseif
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
file
(
GLOB_RECURSE DNNL_LIB_LIST
${
onednn_LIBPATH
}
/libdnnl*
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
*
)
elseif
(
CMAKE_SYSTEM_NAME MATCHES
"Windows"
)
file
(
GLOB_RECURSE DNNL_LIB_LIST
${
onednn_LIBPATH
}
/dnnl.lib
)
endif
()
install
(
FILES
${
DNNL_LIB_LIST
}
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
endif
()
if
(
ENABLE_GPU
)
if
(
ENABLE_MPI
)
install
(
TARGETS _ms_mpi gpu_collective
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
endif
()
install
(
TARGETS gpu_queue
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
endif
()
if
(
NOT ENABLE_GE
)
if
(
ENABLE_D
)
if
(
DEFINED ENV{ASCEND_CUSTOM_PATH}
)
set
(
ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH}
)
else
()
set
(
ASCEND_PATH /usr/local/Ascend
)
endif
()
set
(
ASCEND_DRIVER_PATH
${
ASCEND_PATH
}
/driver/lib64/common
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/graphengine/src/common/graph/libgraph.so
${
CMAKE_BINARY_DIR
}
/graphengine/src/ge/common/libge_common.so
${
CMAKE_BINARY_DIR
}
/graphengine/src/ge/ge_runtime/libge_runtime.so
${
ASCEND_DRIVER_PATH
}
/libslog.so
${
ASCEND_DRIVER_PATH
}
/libc_sec.so
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
elseif
(
ENABLE_TESTCASES
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/graphengine/src/common/graph/libgraph.so
${
CMAKE_SOURCE_DIR
}
/graphengine/third_party/prebuild/
${
CMAKE_HOST_SYSTEM_PROCESSOR
}
/libslog.so
${
CMAKE_SOURCE_DIR
}
/graphengine/third_party/prebuild/
${
CMAKE_HOST_SYSTEM_PROCESSOR
}
/libc_sec.so
DESTINATION
${
INSTALL_LIB_DIR
}
COMPONENT mindspore
)
endif
()
endif
()
# set python files
file
(
GLOB MS_PY_LIST
${
CMAKE_SOURCE_DIR
}
/mindspore/*.py
)
install
(
FILES
${
MS_PY_LIST
}
DESTINATION
${
INSTALL_PY_DIR
}
COMPONENT mindspore
)
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/mindspore/nn
${
CMAKE_SOURCE_DIR
}
/mindspore/_extends
${
CMAKE_SOURCE_DIR
}
/mindspore/parallel
${
CMAKE_SOURCE_DIR
}
/mindspore/mindrecord
${
CMAKE_SOURCE_DIR
}
/mindspore/train
${
CMAKE_SOURCE_DIR
}
/mindspore/model_zoo
${
CMAKE_SOURCE_DIR
}
/mindspore/common
${
CMAKE_SOURCE_DIR
}
/mindspore/ops
${
CMAKE_SOURCE_DIR
}
/mindspore/communication
DESTINATION
${
INSTALL_PY_DIR
}
COMPONENT mindspore
)
if
(
ENABLE_GPU
)
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/mindspore/_akg
DESTINATION
${
INSTALL_PY_DIR
}
COMPONENT mindspore
)
if
(
EXISTS
${
CMAKE_SOURCE_DIR
}
/mindspore/incubator-tvm
)
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/mindspore/incubator-tvm/topi/python/topi
${
CMAKE_SOURCE_DIR
}
/mindspore/incubator-tvm/python/tvm
DESTINATION
${
INSTALL_PY_DIR
}
/_akg
COMPONENT mindspore
)
endif
()
endif
()
if
(
EXISTS
${
CMAKE_SOURCE_DIR
}
/mindspore/dataset
)
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/mindspore/dataset
DESTINATION
${
INSTALL_PY_DIR
}
COMPONENT mindspore
)
endif
()
cmake/package_script.cmake
0 → 100644
浏览文件 @
2dd60b4c
# find exec
find_package
(
Python3 3.7 COMPONENTS Interpreter Development
)
if
(
NOT Python3_FOUND
)
message
(
"No python3 found."
)
return
()
endif
()
set
(
PYTHON
${
Python3_EXECUTABLE
}
)
set
(
PYTHON_VERSION
${
Python3_VERSION_MAJOR
}
.
${
Python3_VERSION_MINOR
}
)
find_package
(
Git
)
if
(
NOT GIT_FOUND
)
message
(
"No git found."
)
return
()
endif
()
set
(
GIT
${
GIT_EXECUTABLE
}
)
# set path
set
(
MS_ROOT_DIR
${
CPACK_PACKAGE_DIRECTORY
}
/../../
)
set
(
MS_PACK_ROOT_DIR
${
MS_ROOT_DIR
}
/build/package
)
# set package file name
if
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
)
if
(
PYTHON_VERSION MATCHES
"3.7"
)
set
(
PY_TAGS
"cp37-cp37m"
)
else
()
message
(
"Could not find 'Python 3.7'"
)
return
()
endif
()
string
(
TOLOWER linux_
${
CMAKE_HOST_SYSTEM_PROCESSOR
}
PLATFORM_TAG
)
elseif
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
if
(
PYTHON_VERSION MATCHES
"3.7"
)
set
(
PY_TAGS
"py37-none"
)
else
()
message
(
"Could not find 'Python 3.7'"
)
return
()
endif
()
set
(
PLATFORM_TAG
"any"
)
elseif
(
CMAKE_SYSTEM_NAME MATCHES
"Windows"
)
if
(
PYTHON_VERSION MATCHES
"3.7"
)
set
(
PY_TAGS
"cp37-cp37m"
)
else
()
message
(
"Could not find 'Python 3.7'"
)
return
()
endif
()
set
(
PLATFORM_TAG
"win_amd64"
)
else
()
message
(
FATAL_ERROR
"other platform:
${
CMAKE_SYSTEM_NAME
}
"
)
endif
()
# get git commit id
set
(
GIT_COMMIT_ID
""
)
execute_process
(
COMMAND
${
GIT
}
log --format='[sha1]:%h,[branch]:%d' -1
OUTPUT_VARIABLE GIT_COMMIT_ID
WORKING_DIRECTORY
${
MS_ROOT_DIR
}
ERROR_QUIET
)
string
(
REPLACE
" "
""
GIT_COMMIT_ID
${
GIT_COMMIT_ID
}
)
set
(
ENV{BACKEND_POLICY}
${
CPACK_MS_BACKEND
}
)
set
(
ENV{MS_PACKAGE_NAME}
${
CPACK_MS_PACKAGE_NAME
}
)
set
(
ENV{COMMIT_ID}
${
GIT_COMMIT_ID
}
)
execute_process
(
COMMAND
${
PYTHON
}
${
MS_ROOT_DIR
}
/setup.py
"bdist_wheel"
WORKING_DIRECTORY
${
MS_PACK_ROOT_DIR
}
)
# finally
set
(
PACKAGE_NAME
${
CPACK_MS_PACKAGE_NAME
}
)
if
(
NOT CMAKE_SYSTEM_NAME MATCHES
"Windows"
)
string
(
REPLACE
"-"
"_"
PACKAGE_NAME
${
PACKAGE_NAME
}
)
execute_process
(
COMMAND chmod -R 700
${
MS_PACK_ROOT_DIR
}
/mindspore/
COMMAND chmod -R 700
${
MS_PACK_ROOT_DIR
}
/
${
PACKAGE_NAME
}
.egg-info/
)
endif
()
set
(
PACKAGE_NAME
"mindspore"
)
file
(
GLOB WHL_FILE
${
MS_PACK_ROOT_DIR
}
/dist/*.whl
)
get_filename_component
(
ORIGIN_FILE_NAME
${
WHL_FILE
}
NAME
)
string
(
REPLACE
"-"
";"
ORIGIN_FILE_NAME
${
ORIGIN_FILE_NAME
}
)
list
(
GET ORIGIN_FILE_NAME 1 VERSION
)
set
(
NEW_FILE_NAME
${
PACKAGE_NAME
}
-
${
VERSION
}
-
${
PY_TAGS
}
-
${
PLATFORM_TAG
}
.whl
)
file
(
RENAME
${
WHL_FILE
}
${
MS_PACK_ROOT_DIR
}
/
${
NEW_FILE_NAME
}
)
file
(
REMOVE_RECURSE
${
MS_ROOT_DIR
}
/output
)
file
(
MAKE_DIRECTORY
${
MS_ROOT_DIR
}
/output
)
file
(
COPY
${
MS_PACK_ROOT_DIR
}
/
${
NEW_FILE_NAME
}
DESTINATION
${
MS_ROOT_DIR
}
/output/
)
file
(
SHA256
${
MS_ROOT_DIR
}
/output/
${
NEW_FILE_NAME
}
SHA256_VAR
)
file
(
WRITE
${
MS_ROOT_DIR
}
/output/
${
NEW_FILE_NAME
}
.sha256
${
SHA256_VAR
}
" "
${
NEW_FILE_NAME
}
)
mindspore/ccsrc/CMakeLists.txt
浏览文件 @
2dd60b4c
...
...
@@ -492,93 +492,7 @@ if(ENABLE_MINDDATA)
add_subdirectory
(
mindrecord
)
add_subdirectory
(
dataset
)
endif
()
set
(
MS_PACK_PATH
${
CMAKE_SOURCE_DIR
}
/build/package/mindspore/
)
set
(
MS_LIB_PATH
${
CMAKE_SOURCE_DIR
}
/build/package/mindspore/lib/
)
add_custom_target
(
add_ms_lib ALL
COMMAND mkdir -pv
${
MS_LIB_PATH
}
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/_c_expression*
${
MS_PACK_PATH
}
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/libmindspore_gvar
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
${
MS_LIB_PATH
}
)
add_dependencies
(
add_ms_lib _c_expression
)
if
(
NOT ENABLE_GE
)
if
(
ENABLE_D
)
if
(
DEFINED ENV{ASCEND_CUSTOM_PATH}
)
set
(
ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH}
)
else
()
set
(
ASCEND_PATH /usr/local/Ascend
)
endif
()
set
(
ASCEND_DRIVER_PATH
${
ASCEND_PATH
}
/driver/lib64/common
)
add_custom_target
(
add_ge_lib ALL
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/../../graphengine/src/common/graph/libgraph.so
${
MS_LIB_PATH
}
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/../../graphengine/src/ge/common/libge_common.so
${
MS_LIB_PATH
}
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/../../graphengine/src/ge/ge_runtime/libge_runtime.so
${
MS_LIB_PATH
}
COMMAND cp
${
ASCEND_DRIVER_PATH
}
/libslog.so
${
MS_LIB_PATH
}
COMMAND cp
${
ASCEND_DRIVER_PATH
}
/libc_sec.so
${
MS_LIB_PATH
}
)
add_dependencies
(
add_ge_lib add_ms_lib
)
add_dependencies
(
add_ge_lib graph
)
add_dependencies
(
add_ge_lib ge_runtime
)
elseif
(
ENABLE_TESTCASES
)
add_custom_target
(
add_ge_lib ALL
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/../../graphengine/src/common/graph/libgraph.so
${
MS_LIB_PATH
}
COMMAND cp
${
CMAKE_SOURCE_DIR
}
/graphengine/third_party/prebuild/
${
CMAKE_HOST_SYSTEM_PROCESSOR
}
/libslog.so
${
MS_LIB_PATH
}
COMMAND cp
${
CMAKE_SOURCE_DIR
}
/graphengine/third_party/prebuild/
${
CMAKE_HOST_SYSTEM_PROCESSOR
}
/libc_sec.so
${
MS_LIB_PATH
}
)
add_dependencies
(
add_ge_lib add_ms_lib
)
add_dependencies
(
add_ge_lib graph
)
endif
()
endif
()
if
(
ENABLE_GPU
)
if
(
ENABLE_MPI
)
add_custom_target
(
add_mpi_lib ALL
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/_ms_mpi*
${
MS_PACK_PATH
}
)
add_dependencies
(
add_mpi_lib _ms_mpi
)
add_custom_target
(
add_gpu_collective_lib ALL
COMMAND mkdir -pv
${
MS_LIB_PATH
}
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/libgpu_collective*
${
MS_LIB_PATH
}
)
add_dependencies
(
add_gpu_collective_lib gpu_collective
)
endif
()
add_custom_target
(
add_gpu_queue_lib ALL
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/libgpu_queue*
${
MS_LIB_PATH
}
)
add_dependencies
(
add_gpu_queue_lib add_ms_lib
)
endif
()
if
(
ENABLE_CPU
)
if
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
add_custom_target
(
add_cpu_lib ALL COMMAND cp
${
onednn_LIBPATH
}
/libdnnl.1.1.dylib
${
MS_LIB_PATH
}
/libdnnl.1.1.dylib
)
else
()
add_custom_target
(
add_cpu_lib ALL COMMAND cp
${
onednn_LIBPATH
}
/libdnnl.so.1.1
${
MS_LIB_PATH
}
/libdnnl.so.1
)
endif
()
add_dependencies
(
add_cpu_lib add_ms_lib
)
endif
()
if
(
ENABLE_MINDDATA
)
add_custom_target
(
add_minddata_lib ALL
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/dataset/*.so
${
MS_PACK_PATH
}
COMMAND cp
${
MS_CCSRC_BUILD_PATH
}
/mindrecord/*.so
${
MS_PACK_PATH
}
COMMAND cp
${
opencv_LIBPATH
}
/libopencv_core.so.4.2.0
${
MS_LIB_PATH
}
/libopencv_core.so.4.2
COMMAND cp
${
opencv_LIBPATH
}
/libopencv_imgcodecs.so.4.2.0
${
MS_LIB_PATH
}
/libopencv_imgcodecs.so.4.2
COMMAND cp
${
opencv_LIBPATH
}
/libopencv_imgproc.so.4.2.0
${
MS_LIB_PATH
}
/libopencv_imgproc.so.4.2
)
add_dependencies
(
add_minddata_lib add_ms_lib
)
add_dependencies
(
add_minddata_lib _c_mindrecord
)
add_dependencies
(
add_minddata_lib _c_dataengine
)
add_dependencies
(
_c_mindrecord mindspore
)
add_dependencies
(
_c_dataengine mindspore
)
endif
()
if
(
USE_GLOG
)
target_link_libraries
(
_c_expression PRIVATE mindspore::glog
)
if
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
add_custom_target
(
add_glog_lib ALL COMMAND cp
${
glog_LIBPATH
}
/libglog*.dylib
${
MS_LIB_PATH
}
)
else
()
add_custom_target
(
add_glog_lib ALL COMMAND cp
${
glog_LIBPATH
}
/libglog*.so.0
${
MS_LIB_PATH
}
)
endif
()
endif
()
\ No newline at end of file
package.sh
已删除
100755 → 0
浏览文件 @
60958d6b
#!/bin/bash
# Copyright 2019 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
BASEPATH
=
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
echo
"
${
BASEPATH
}
"
cd
"
${
BASEPATH
}
"
BUILD_PATH
=
"
${
BASEPATH
}
/build"
PACKAGE_PATH
=
"
${
BUILD_PATH
}
/package"
OUTPUT_PATH
=
"
${
BASEPATH
}
/output"
mk_new_dir
()
{
local
create_dir
=
"
$1
"
# the target to make
if
[[
-d
"
${
create_dir
}
"
]]
;
then
rm
-rf
"
${
create_dir
}
"
fi
mkdir
-pv
"
${
create_dir
}
"
}
to_lower
()
{
echo
"
$1
"
|
tr
'[:upper:]'
'[:lower:]'
}
COMMIT_ID
=
$(
git log
--format
=
'[sha1]:%h,[branch]:%d'
-1
|
sed
's/ //g'
)
export
COMMIT_ID
PYTHON
=
$(
which python3
)
PYTHON_VERSION
=
$(
"
${
PYTHON
}
"
-V
2>&1 |
awk
'{print $2}'
|
cut
-d
.
-f-2
)
if
[[
$(
uname
)
==
"Linux"
]]
;
then
if
[[
"
${
PYTHON_VERSION
}
"
==
"3.7"
]]
;
then
PY_TAGS
=
"cp37-cp37m"
else
echo
"Could not find 'Python 3.7'"
exit
1
fi
PLATFORM_TAG
=
$(
to_lower
"
$(
uname
)
_
$(
uname
-m
)
"
)
elif
[[
$(
uname
)
==
"Darwin"
]]
;
then
if
[[
"
${
PYTHON_VERSION
}
"
==
"3.7"
]]
;
then
PY_TAGS
=
"py3-none"
else
echo
"Could not find 'Python 3.7'"
exit
1
fi
PLATFORM_TAG
=
"any"
fi
echo
"=========
${
BASEPATH
}
==================="
mk_new_dir
"
${
OUTPUT_PATH
}
"
#copy necessary file to pack_path
cp
${
BASEPATH
}
/mindspore/
*
.py
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/nn"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/_extends"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/parallel"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/mindrecord"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/train"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/model_zoo"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/common"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/ops"
"
${
PACKAGE_PATH
}
/mindspore"
cp
-rf
"
${
BUILD_PATH
}
/../mindspore/communication"
"
${
PACKAGE_PATH
}
/mindspore"
if
[[
"X
$2
"
=
"Xgpu"
]]
;
then
echo
"package _akg when gpu enable."
cp
-rf
"
${
BASEPATH
}
/mindspore/_akg"
"
${
PACKAGE_PATH
}
"
if
[[
-d
"
${
BUILD_PATH
}
/mindspore/incubator-tvm"
]]
;
then
cp
-rf
"
${
BUILD_PATH
}
/mindspore/incubator-tvm/topi/python/topi"
"
${
PACKAGE_PATH
}
/_akg"
cp
-rf
"
${
BUILD_PATH
}
/mindspore/incubator-tvm/python/tvm"
"
${
PACKAGE_PATH
}
/_akg"
fi
fi
# move dataset
if
[[
-d
"
${
BASEPATH
}
/mindspore/dataset"
]]
;
then
cp
-rf
"
${
BASEPATH
}
/mindspore/dataset"
"
${
PACKAGE_PATH
}
/mindspore"
fi
cd
"
${
PACKAGE_PATH
}
"
if
[
-n
"
$1
"
]
;
then
export
BACKEND_POLICY
=
$1
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.py"
bdist_wheel
chmod
-R
700
${
PACKAGE_PATH
}
/mindspore/
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
}
"
cp
-f
"
${
PACKAGE_PATH
}
/
${
PACKAGE_NEW_NAME
}
"
"
${
OUTPUT_PATH
}
"
find
${
OUTPUT_PATH
}
-name
"*.whl"
-print0
| xargs
-0
-I
{}
sh
-c
"sha256sum {} | awk '{printf
\$
1}' > {}.sha256"
cd
"
${
BASEPATH
}
"
echo
"------Successfully created mindspore package------"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录