Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
6e32a4fa
Commit
6e32a4fa
authored
Aug 25, 2017
by
ziheng
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[LIBINFO] Enable load .dylib on darwin (#142)
* [LIBINFO] Enable load .dylib on darwin * Fix makefile
parent
1edf680c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
nnvm/Makefile
+9
-8
nnvm/python/nnvm/libinfo.py
+10
-4
No files found.
nnvm/Makefile
View file @
6e32a4fa
...
...
@@ -39,22 +39,23 @@ include $(NNVM_PLUGINS)
# specify tensor path
.PHONY
:
clean all test lint doc cython cython3 cyclean
all
:
lib/libnnvm.a lib/libnnvm_example.so
SRC
=
$
(
wildcard src/
*
.cc src/
*
/
*
.cc
)
ALL_OBJ
=
$
(
patsubst %.cc, build/%.o,
$(SRC)
)
ALL_DEP
=
$(ALL_OBJ)
$(PLUGIN_OBJ)
UNAME_S
:=
$(
shell
uname
-s
)
ifeq
($(UNAME_S),
Darwin)
SHARED_LIBRARY_SUFFIX
:=
dylib
WHOLE_ARCH
=
-all_load
NO_WHOLE_ARCH
=
-noall_load
else
SHARED_LIBRARY_SUFFIX
:=
so
WHOLE_ARCH
=
--whole-archive
NO_WHOLE_ARCH
=
--no-whole-archive
endif
all
:
lib/libnnvm.a lib/libnnvm_example.$(SHARED_LIBRARY_SUFFIX)
SRC
=
$
(
wildcard src/
*
.cc src/
*
/
*
.cc
)
ALL_OBJ
=
$
(
patsubst %.cc, build/%.o,
$(SRC)
)
ALL_DEP
=
$(ALL_OBJ)
$(PLUGIN_OBJ)
include
tests/cpp/unittest.mk
...
...
@@ -74,7 +75,7 @@ lib/libnnvm.a: $(ALL_DEP)
@
mkdir
-p
$
(
@D
)
ar crv
$@
$
(
filter %.o,
$?
)
lib/libnnvm_example.
so
:
example/src/operator.cc lib/libnnvm.a
lib/libnnvm_example.
$(SHARED_LIBRARY_SUFFIX)
:
example/src/operator.cc lib/libnnvm.a
@
mkdir
-p
$
(
@D
)
$(CXX)
$(CFLAGS)
-shared
-o
$@
$
(
filter %.cc,
$^
)
$(LDFLAGS)
-Wl
,
${
WHOLE_ARCH
}
lib/libnnvm.a
-Wl
,
${
NO_WHOLE_ARCH
}
...
...
@@ -85,7 +86,7 @@ cython3:
cd
python
;
python3 setup.py build_ext
--inplace
cyclean
:
rm
-rf
python/nnvm/
*
/
*
.so python/nnvm/
*
/
*
.cpp
rm
-rf
python/nnvm/
*
/
*
.so python/nnvm/
*
/
*
.
dylib python/nnvm/
*
/
*
.
cpp
lint
:
python2 dmlc-core/scripts/lint.py nnvm cpp include src
...
...
nnvm/python/nnvm/libinfo.py
View file @
6e32a4fa
...
...
@@ -31,7 +31,13 @@ def find_lib_path():
api_path
=
os
.
path
.
join
(
base_path
,
'../../lib/'
)
cmake_build_path
=
os
.
path
.
join
(
base_path
,
'../../build/Release/'
)
dll_path
=
[
base_path
,
api_path
,
cmake_build_path
]
if
os
.
name
==
'nt'
:
if
sys
.
platform
.
startswith
(
'linux'
)
and
os
.
environ
.
get
(
'LD_LIBRARY_PATH'
,
None
):
dll_path
.
extend
([
p
.
strip
()
for
p
in
os
.
environ
[
'LD_LIBRARY_PATH'
]
.
split
(
":"
)])
elif
sys
.
platform
.
startswith
(
'darwin'
)
and
os
.
environ
.
get
(
'DYLD_LIBRARY_PATH'
,
None
):
dll_path
.
extend
([
p
.
strip
()
for
p
in
os
.
environ
[
'DYLD_LIBRARY_PATH'
]
.
split
(
":"
)])
if
sys
.
platform
.
startswith
(
'win32'
):
vs_configuration
=
'Release'
if
platform
.
architecture
()[
0
]
==
'64bit'
:
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'../../build'
,
vs_configuration
))
...
...
@@ -39,12 +45,12 @@ def find_lib_path():
else
:
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'../../build'
,
vs_configuration
))
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'../../windows'
,
vs_configuration
))
elif
os
.
name
==
"posix"
and
os
.
environ
.
get
(
'LD_LIBRARY_PATH'
,
None
):
dll_path
.
extend
([
p
.
strip
()
for
p
in
os
.
environ
[
'LD_LIBRARY_PATH'
]
.
split
(
":"
)])
if
os
.
name
==
'nt'
:
dll_path
=
[
os
.
path
.
join
(
p
,
'
%
s.dll'
%
lib_name
)
for
p
in
dll_path
]
elif
sys
.
platform
.
startswith
(
'darwin'
):
dll_path
=
[
os
.
path
.
join
(
p
,
'
%
s.dylib'
%
lib_name
)
for
p
in
dll_path
]
else
:
dll_path
=
[
os
.
path
.
join
(
p
,
'
%
s.so'
%
lib_name
)
for
p
in
dll_path
]
lib_path
=
[
p
for
p
in
dll_path
if
os
.
path
.
exists
(
p
)
and
os
.
path
.
isfile
(
p
)]
if
len
(
lib_path
)
==
0
:
raise
RuntimeError
(
'Cannot find the files.
\n
'
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment