Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
d06f248d
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
404
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d06f248d
编写于
9月 05, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(whl/mgb/imperative): fix symbols conflict runtime crash
GitOrigin-RevId: d60c4052c1ac1c4f2b9879c60069d232c8efcd13
上级
1b2194cd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
54 addition
and
41 deletion
+54
-41
imperative/CMakeLists.txt
imperative/CMakeLists.txt
+6
-6
imperative/python/test/run.sh
imperative/python/test/run.sh
+1
-1
scripts/cmake-build/utils/utils.sh
scripts/cmake-build/utils/utils.sh
+8
-24
scripts/whl/macos/macos_build_whl.sh
scripts/whl/macos/macos_build_whl.sh
+16
-0
scripts/whl/manylinux2010/do_build.sh
scripts/whl/manylinux2010/do_build.sh
+13
-10
src/CMakeLists.txt
src/CMakeLists.txt
+10
-0
未找到文件。
imperative/CMakeLists.txt
浏览文件 @
d06f248d
...
@@ -52,15 +52,15 @@ add_custom_target(_version_ld SOURCES ${VERSION_SCRIPT})
...
@@ -52,15 +52,15 @@ add_custom_target(_version_ld SOURCES ${VERSION_SCRIPT})
add_subdirectory
(
${
PROJECT_SOURCE_DIR
}
/third_party/pybind11
${
PROJECT_BINARY_DIR
}
/third_party/pybind11
)
add_subdirectory
(
${
PROJECT_SOURCE_DIR
}
/third_party/pybind11
${
PROJECT_BINARY_DIR
}
/third_party/pybind11
)
pybind11_add_module
(
${
MODULE_NAME
}
NO_EXTRAS
${
SRCS
}
)
pybind11_add_module
(
${
MODULE_NAME
}
NO_EXTRAS
${
SRCS
}
)
if
(
APPLE OR MSVC OR WIN32
)
if
(
APPLE
)
target_link_libraries
(
${
MODULE_NAME
}
PRIVATE megengine_export
)
elseif
(
MSVC OR WIN32
)
# Windows does not support implicitly importing data members from DLL.
target_link_libraries
(
${
MODULE_NAME
}
PRIVATE megbrain megdnn
)
target_link_libraries
(
${
MODULE_NAME
}
PRIVATE megbrain megdnn
)
else
()
else
()
target_link_libraries
(
${
MODULE_NAME
}
PRIVATE megbrain megdnn -Wl,--version-script=
${
VERSION_SCRIPT
}
)
target_link_libraries
(
${
MODULE_NAME
}
PRIVATE megengine_export -Wl,--version-script=
${
VERSION_SCRIPT
}
)
endif
()
if
(
MGE_WITH_DISTRIBUTED
)
message
(
"Imperative configured to link megray"
)
target_link_libraries
(
${
MODULE_NAME
}
PRIVATE megray
)
endif
()
endif
()
target_include_directories
(
${
MODULE_NAME
}
PUBLIC src/include PRIVATE
${
PYTHON_INCLUDE_DIRS
}
${
NUMPY_INCLUDE_DIR
}
)
target_include_directories
(
${
MODULE_NAME
}
PUBLIC src/include PRIVATE
${
PYTHON_INCLUDE_DIRS
}
${
NUMPY_INCLUDE_DIR
}
)
target_compile_definitions
(
${
MODULE_NAME
}
PRIVATE MODULE_NAME=
${
MODULE_NAME
}
)
target_compile_definitions
(
${
MODULE_NAME
}
PRIVATE MODULE_NAME=
${
MODULE_NAME
}
)
target_compile_options
(
${
MODULE_NAME
}
PRIVATE -Wno-unused-parameter
)
target_compile_options
(
${
MODULE_NAME
}
PRIVATE -Wno-unused-parameter
)
...
...
imperative/python/test/run.sh
浏览文件 @
d06f248d
...
@@ -8,7 +8,7 @@ if [[ "$TEST_PLAT" == cpu ]]; then
...
@@ -8,7 +8,7 @@ if [[ "$TEST_PLAT" == cpu ]]; then
elif
[[
"
$TEST_PLAT
"
==
cuda
]]
;
then
elif
[[
"
$TEST_PLAT
"
==
cuda
]]
;
then
echo
"test both cpu and gpu pytest"
echo
"test both cpu and gpu pytest"
else
else
log
"Argument must cpu or cuda"
echo
"Argument must cpu or cuda"
exit
1
exit
1
fi
fi
...
...
scripts/cmake-build/utils/utils.sh
浏览文件 @
d06f248d
...
@@ -15,26 +15,15 @@ function build_flatc() {
...
@@ -15,26 +15,15 @@ function build_flatc() {
REMOVE_OLD_BUILD
=
$2
REMOVE_OLD_BUILD
=
$2
if
[
$REMOVE_OLD_BUILD
=
"true"
]
;
then
if
[
$REMOVE_OLD_BUILD
=
"true"
]
;
then
if
[
-e
$BUILD_DIR
]
;
then
echo
"remove old build/install dir"
echo
"clean old dir:
$BUILD_DIR
"
rm
-rf
$INSTALL_DIR
rm
-rf
$BUILD_DIR
rm
-rf
$BUILD_DIR
fi
if
[
-e
$INSTALL_DIR
]
;
then
echo
"clean old dir:
$INSTALL_DIR
"
rm
-rf
$INSTALL_DIR
fi
else
else
echo
"strip remove old build"
echo
"strip remove old build"
fi
fi
if
[
!
-e
$BUILD_DIR
]
;
then
mkdir
-p
$BUILD_DIR
echo
"create build:
$BUILD_DIR
"
mkdir
-p
$INSTALL_DIR
mkdir
-p
$BUILD_DIR
fi
if
[
!
-e
$INSTALL_DIR
]
;
then
echo
"create install
$INSTALL_DIR
"
mkdir
-p
$INSTALL_DIR
fi
cd
$BUILD_DIR
cd
$BUILD_DIR
cmake
-G
"
$MAKEFILE_TYPE
Makefiles"
\
cmake
-G
"
$MAKEFILE_TYPE
Makefiles"
\
...
@@ -57,14 +46,9 @@ function try_remove_old_build() {
...
@@ -57,14 +46,9 @@ function try_remove_old_build() {
INSTALL_DIR
=
$3
INSTALL_DIR
=
$3
if
[
$REMOVE_OLD_BUILD
=
"true"
]
;
then
if
[
$REMOVE_OLD_BUILD
=
"true"
]
;
then
if
[
-e
$BUILD_DIR
]
;
then
echo
"remove old build/install dir"
echo
"clean old dir:
$BUILD_DIR
"
rm
-rf
${
BUILD_DIR
}
rm
-rf
$BUILD_DIR
rm
-rf
${
INSTALL_DIR
}
fi
if
[
-e
$INSTALL_DIR
]
;
then
echo
"clean old dir:
$INSTALL_DIR
"
rm
-rf
$INSTALL_DIR
fi
else
else
echo
"strip remove old build"
echo
"strip remove old build"
fi
fi
...
...
scripts/whl/macos/macos_build_whl.sh
浏览文件 @
d06f248d
...
@@ -84,6 +84,13 @@ function config_python_env() {
...
@@ -84,6 +84,13 @@ function config_python_env() {
fi
fi
}
}
MEGENGINE_LIB
=
"
${
SRC_DIR
}
/build_dir/host/MGE_WITH_CUDA_OFF/MGE_INFERENCE_ONLY_OFF/Release/build/src/libmegengine_export.dylib"
function
depend_real_copy
()
{
REAL_DST
=
$1
echo
"real copy lib to
$1
"
cp
"
${
MEGENGINE_LIB
}
"
${
REAL_DST
}
}
function
do_build
()
{
function
do_build
()
{
for
ver
in
${
ALL_PYTHON
}
for
ver
in
${
ALL_PYTHON
}
do
do
...
@@ -142,6 +149,15 @@ function do_build() {
...
@@ -142,6 +149,15 @@ function do_build() {
echo
"valid..."
echo
"valid..."
fi
fi
#handle dlopen path
install_name_tool
-change
@rpath/libmegengine_export.dylib @loader_path/lib/libmegengine_export.dylib _imperative_rt.so
#copy megbrain_export lib
DEPEND_LIB
=
${
BUILD_DIR
}
/staging/megengine/core/lib/
rm
-rf
${
DEPEND_LIB
}
mkdir
${
DEPEND_LIB
}
depend_real_copy
${
DEPEND_LIB
}
cd
${
BUILD_DIR
}
/staging
cd
${
BUILD_DIR
}
/staging
${
PYTHON_DIR
}
/bin/python3 setup.py bdist_wheel
${
PYTHON_DIR
}
/bin/python3 setup.py bdist_wheel
...
...
scripts/whl/manylinux2010/do_build.sh
浏览文件 @
d06f248d
...
@@ -16,17 +16,22 @@ BUILD_DIR=${SRC_DIR}/build_dir/host/MGE_WITH_CUDA_OFF/MGE_INFERENCE_ONLY_OFF/Rel
...
@@ -16,17 +16,22 @@ BUILD_DIR=${SRC_DIR}/build_dir/host/MGE_WITH_CUDA_OFF/MGE_INFERENCE_ONLY_OFF/Rel
if
[
${
BUILD_WHL_CPU_ONLY
}
=
"OFF"
]
;
then
if
[
${
BUILD_WHL_CPU_ONLY
}
=
"OFF"
]
;
then
BUILD_DIR
=
${
SRC_DIR
}
/build_dir/host/MGE_WITH_CUDA_ON/MGE_INFERENCE_ONLY_OFF/Release/build/
BUILD_DIR
=
${
SRC_DIR
}
/build_dir/host/MGE_WITH_CUDA_ON/MGE_INFERENCE_ONLY_OFF/Release/build/
fi
fi
SO_NAME
=
_imperative_rt
SO_PATH
=
megengine/core
NEW_LIB_PATH
=
core/lib
NEW_LIB_PATH
=
core/lib
function
handle_strip
()
{
echo
"now handle strip
$1
"
objcopy
--only-keep-debug
$1
$1
.dbg
strip
-s
$1
objcopy
--add-gnu-debuglink
=
$1
.dbg
$1
rm
$1
.dbg
}
for
ver
in
${
ALL_PYTHON
}
for
ver
in
${
ALL_PYTHON
}
do
do
python_ver
=
${
ver
:0:2
}
python_ver
=
${
ver
:0:2
}
MAJOR
=
${
python_ver
:0:1
}
MAJOR
=
${
python_ver
:0:1
}
MINOR
=
${
ver
:1
}
MINOR
=
${
ver
:1
}
PYTHON_DIR
=
/opt/python/cp
${
python_ver
}
-cp
${
ver
}
/
PYTHON_DIR
=
/opt/python/cp
${
python_ver
}
-cp
${
ver
}
/
EXT_NAME
=
${
SO_NAME
}
.cpython-
${
ver
}
-x86_64-linux-gnu
.so
export
EXTRA_CMAKE_ARGS
=
"
${
EXTRA_CMAKE_ARGS
}
-DCMAKE_BUILD_TYPE=RelWithDebInfo"
export
EXTRA_CMAKE_ARGS
=
"
${
EXTRA_CMAKE_ARGS
}
-DCMAKE_BUILD_TYPE=RelWithDebInfo"
export
EXTRA_CMAKE_ARGS
=
"
${
EXTRA_CMAKE_ARGS
}
-DCMAKE_PREFIX_PATH=
${
PYTHON_DIR
}
"
export
EXTRA_CMAKE_ARGS
=
"
${
EXTRA_CMAKE_ARGS
}
-DCMAKE_PREFIX_PATH=
${
PYTHON_DIR
}
"
export
EXTRA_CMAKE_ARGS
=
"
${
EXTRA_CMAKE_ARGS
}
-DPYTHON_EXECUTABLE=
${
PYTHON_DIR
}
/bin/python3"
export
EXTRA_CMAKE_ARGS
=
"
${
EXTRA_CMAKE_ARGS
}
-DPYTHON_EXECUTABLE=
${
PYTHON_DIR
}
/bin/python3"
...
@@ -51,17 +56,15 @@ do
...
@@ -51,17 +56,15 @@ do
ln
-sf
libcuda.so libcuda.so.1
ln
-sf
libcuda.so libcuda.so.1
fi
fi
cd
${
BUILD_DIR
}
/staging/
${
SO_PATH
}
handle_strip
${
BUILD_DIR
}
/src/libmegengine_export.so
SO_NAME_EXT
=
${
SO_NAME
}
.so
objcopy
--only-keep-debug
${
SO_NAME_EXT
}
${
EXT_NAME
}
.dbg
cd
${
BUILD_DIR
}
/staging/megengine/core
strip
-s
${
SO_NAME_EXT
}
handle_strip _imperative_rt.so
objcopy
--add-gnu-debuglink
=
${
EXT_NAME
}
.dbg
${
SO_NAME_EXT
}
mkdir
-p
lib/ucx
mkdir
-p
lib/ucx
if
[
${
BUILD_WHL_CPU_ONLY
}
=
"OFF"
]
;
then
if
[
${
BUILD_WHL_CPU_ONLY
}
=
"OFF"
]
;
then
cp
-L
/usr/local/cuda/lib
*
/libnvrtc-builtins.so lib
cp
-L
/usr/local/cuda/lib
*
/libnvrtc-builtins.so lib
cp
-L
${
BUILD_DIR
}
/third_party/MegRay/third_party/ucx/lib/ucx/
*
.so lib/ucx/
strip
-s
lib/ucx/
*
.so
fi
fi
cd
${
BUILD_DIR
}
/staging/
cd
${
BUILD_DIR
}
/staging/
...
...
src/CMakeLists.txt
浏览文件 @
d06f248d
...
@@ -174,6 +174,16 @@ else()
...
@@ -174,6 +174,16 @@ else()
set
(
_VER_FILE
${
PROJECT_SOURCE_DIR
}
/imperative/src/version.ld
)
set
(
_VER_FILE
${
PROJECT_SOURCE_DIR
}
/imperative/src/version.ld
)
endif
()
endif
()
if
(
MGE_BUILD_IMPERATIVE_RT
)
message
(
"-- create a export SHARED lib for python use"
)
add_library
(
megengine_export SHARED
)
target_link_libraries
(
megengine_export PUBLIC megbrain megdnn
)
if
(
MGE_WITH_DISTRIBUTED
)
message
(
"megengine_export configured to link megray"
)
target_link_libraries
(
megengine_export PUBLIC megray
)
endif
()
endif
()
# Build as SHARED or STATIC depending on BUILD_SHARED_LIBS=ON/OFF
# Build as SHARED or STATIC depending on BUILD_SHARED_LIBS=ON/OFF
add_library
(
megengine
)
add_library
(
megengine
)
target_link_libraries
(
megengine PUBLIC megbrain megdnn
)
target_link_libraries
(
megengine PUBLIC megbrain megdnn
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录