Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Pytorch-Encoding
Commits
984cce35
"src/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "6c53f351c6eb02616d74e8faa921dff2061d42b5"
Commit
984cce35
authored
May 13, 2017
by
Hang Zhang
Browse files
debuging
parent
963c408f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
20 deletions
+29
-20
build.py
build.py
+16
-6
encoding/CMakeLists.txt
encoding/CMakeLists.txt
+0
-11
encoding/cmake/FindTorch.cmake
encoding/cmake/FindTorch.cmake
+2
-2
encoding/src/encoding_lib.cpp
encoding/src/encoding_lib.cpp
+1
-1
osx_make.sh
osx_make.sh
+10
-0
No files found.
build.py
View file @
984cce35
...
@@ -10,24 +10,31 @@
...
@@ -10,24 +10,31 @@
import
os
import
os
import
torch
import
torch
import
platform
from
torch.utils.ffi
import
create_extension
from
torch.utils.ffi
import
create_extension
package_base
=
os
.
path
.
dirname
(
torch
.
__file__
)
package_base
=
os
.
path
.
dirname
(
torch
.
__file__
)
this_file
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
this_file
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
include_path
=
[
os
.
path
.
join
(
os
.
environ
[
'HOME'
],
'pytorch/torch/lib/THC'
),
include_path
=
[
os
.
path
.
join
(
os
.
environ
[
'HOME'
],
'pytorch/torch/lib/THC'
),
os
.
path
.
join
(
this_file
,
'encoding/src/
'
),
os
.
path
.
join
(
package_base
,
'lib/include/ENCODING
'
),
os
.
path
.
join
(
this_file
,
'encoding/
kernel
/'
)]
os
.
path
.
join
(
this_file
,
'encoding/
src
/'
)]
sources
=
[
'encoding/src/encoding_lib.cpp'
]
sources
=
[
'encoding/src/encoding_lib.cpp'
]
headers
=
[
'encoding/src/encoding_lib.h'
]
headers
=
[
'encoding/src/encoding_lib.h'
]
defines
=
[(
'WITH_CUDA'
,
None
)]
defines
=
[(
'WITH_CUDA'
,
None
)]
with_cuda
=
True
with_cuda
=
True
extra_objects
=
[
'lib/libENCODING.dylib'
]
if
platform
.
system
()
==
'Darwin'
:
extra_objects
=
[
os
.
path
.
join
(
package_base
,
fname
)
for
fname
in
extra_objects
]
ENCODING_LIB
=
os
.
path
.
join
(
package_base
,
'lib/libENCODING.dylib'
)
else
:
ENCODING_LIB
=
os
.
path
.
join
(
package_base
,
'lib/libENCODING.so'
)
print
(
extra_objects
)
def
make_relative_rpath
(
path
):
if
platform
.
system
()
==
'Darwin'
:
return
'-Wl,-rpath,'
+
path
else
:
return
'-Wl,-rpath,'
+
path
ffi
=
create_extension
(
ffi
=
create_extension
(
'encoding._ext.encoding_lib'
,
'encoding._ext.encoding_lib'
,
...
@@ -38,7 +45,10 @@ ffi = create_extension(
...
@@ -38,7 +45,10 @@ ffi = create_extension(
relative_to
=
__file__
,
relative_to
=
__file__
,
with_cuda
=
with_cuda
,
with_cuda
=
with_cuda
,
include_dirs
=
include_path
,
include_dirs
=
include_path
,
extra_objects
=
extra_objects
,
extra_link_args
=
[
make_relative_rpath
(
os
.
path
.
join
(
package_base
,
'lib'
)),
ENCODING_LIB
,
],
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
encoding/CMakeLists.txt
View file @
984cce35
...
@@ -11,17 +11,6 @@
...
@@ -11,17 +11,6 @@
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8 FATAL_ERROR
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8 FATAL_ERROR
)
CMAKE_POLICY
(
VERSION 2.8
)
CMAKE_POLICY
(
VERSION 2.8
)
OPTION
(
NDEBUG
"disable asserts (WARNING: this may result in silent UB e.g. with out-of-bound indices)"
)
IF
(
NOT NDEBUG
)
MESSAGE
(
STATUS
"Removing -DNDEBUG from compile flags"
)
STRING
(
REPLACE
"-DNDEBUG"
""
CMAKE_C_FLAGS
""
${
CMAKE_C_FLAGS
}
)
STRING
(
REPLACE
"-DNDEBUG"
""
CMAKE_C_FLAGS_DEBUG
""
${
CMAKE_C_FLAGS_DEBUG
}
)
STRING
(
REPLACE
"-DNDEBUG"
""
CMAKE_C_FLAGS_RELEASE
""
${
CMAKE_C_FLAGS_RELEASE
}
)
STRING
(
REPLACE
"-DNDEBUG"
""
CMAKE_CXX_FLAGS
""
${
CMAKE_CXX_FLAGS
}
)
STRING
(
REPLACE
"-DNDEBUG"
""
CMAKE_CXX_FLAGS_DEBUG
""
${
CMAKE_CXX_FLAGS_DEBUG
}
)
STRING
(
REPLACE
"-DNDEBUG"
""
CMAKE_CXX_FLAGS_RELEASE
""
${
CMAKE_CXX_FLAGS_RELEASE
}
)
ENDIF
()
INCLUDE
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/FindTorch.cmake
)
INCLUDE
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/FindTorch.cmake
)
#IF(NOT Torch_FOUND)
#IF(NOT Torch_FOUND)
...
...
encoding/cmake/FindTorch.cmake
View file @
984cce35
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
FILE
(
GLOB TORCH_LIB_HINTS
FILE
(
GLOB TORCH_LIB_HINTS
"/anaconda/lib/python3.6/site-packages/torch/lib"
"/anaconda/lib/python3.6/site-packages/torch/lib"
"/anaconda2/lib/python3.6/site-packages/torch/lib"
"/anaconda2/lib/python3.6/site-packages/torch/lib"
"
${
HOME
}
/anaconda/lib/python2.7/site-packages/torch/lib"
"$
ENV
{HOME}/anaconda/lib/python2.7/site-packages/torch/lib"
"
${
HOME
}
/anaconda2/lib/python2.7/site-packages/torch/lib"
"$
ENV
{HOME}/anaconda2/lib/python2.7/site-packages/torch/lib"
)
)
FIND_PATH
(
TORCH_BUILD_DIR
FIND_PATH
(
TORCH_BUILD_DIR
NAMES
"THNN.h"
NAMES
"THNN.h"
...
...
encoding/src/encoding_lib.cpp
View file @
984cce35
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
*/
#include <THC/THC.h>
#include <THC/THC.h>
#include
"
thc_encoding.h
"
#include
<
thc_encoding.h
>
extern
THCState
*
state
;
extern
THCState
*
state
;
...
...
osx_make.sh
0 → 100644
View file @
984cce35
#!/usr/bin/env bash
cd
encoding/
mkdir
-p
build
&&
cd
build
cmake ..
make
install
cd
../..
MACOSX_DEPLOYMENT_TARGET
=
10.9
CC
=
clang
CXX
=
clang++ python setup.py
install
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