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
ModelZoo
SOLOv2-pytorch
Commits
f3768bcd
Commit
f3768bcd
authored
Oct 17, 2018
by
Kai Chen
Browse files
bug fix for compiling nms op
parent
8cf4be73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
26 deletions
+9
-26
mmdet/ops/nms/Makefile
mmdet/ops/nms/Makefile
+1
-1
mmdet/ops/nms/setup.py
mmdet/ops/nms/setup.py
+8
-25
No files found.
mmdet/ops/nms/Makefile
View file @
f3768bcd
...
...
@@ -5,4 +5,4 @@ all:
$(PYTHON)
setup.py build_ext
--inplace
clean
:
rm
*
.so
rm
-f
*
.so
mmdet/ops/nms/setup.py
View file @
f3768bcd
import
os
from
distutils.core
import
setup
from
distutils.extension
import
Extension
import
os.path
as
osp
from
distutils.core
import
setup
,
Extension
import
numpy
as
np
from
Cython.Build
import
cythonize
from
Cython.Distutils
import
build_ext
CUDA_ROOT
=
'/usr/local/cuda'
CUDA
=
{
"include"
:
os
.
path
.
join
(
CUDA_ROOT
,
'include'
),
"lib"
:
os
.
path
.
join
(
CUDA_ROOT
,
'lib64'
),
"nvcc"
:
os
.
path
.
join
(
CUDA_ROOT
,
'bin'
,
"nvcc"
)
}
inc_dirs
=
[
CUDA
[
'include'
],
np
.
get_include
()]
lib_dirs
=
[
CUDA
[
'lib'
]]
# extensions
ext_args
=
dict
(
include_dirs
=
inc_dirs
,
library_dirs
=
lib_dirs
,
include_dirs
=
[
np
.
get_include
()],
language
=
'c++'
,
libraries
=
[
'cudart'
],
extra_compile_args
=
{
"cc"
:
[
'-Wno-unused-function'
,
'-Wno-write-strings'
],
"nvcc"
:
[
'-arch=sm_52'
,
'--ptxas-options=-v'
,
'-c'
,
'--compiler-options'
,
'-fPIC'
],
'cc'
:
[
'-Wno-unused-function'
,
'-Wno-write-strings'
],
'nvcc'
:
[
'-c'
,
'--compiler-options'
,
'-fPIC'
],
},
)
extensions
=
[
Extension
(
'cpu_nms'
,
[
'cpu_nms.pyx'
],
**
ext_args
),
Extension
(
'gpu_nms'
,
[
'gpu_nms.pyx'
,
'nms_kernel.cu'
],
**
ext_args
),
Extension
(
'cpu_soft_nms'
,
[
'cpu_soft_nms.pyx'
],
**
ext_args
),
Extension
(
'gpu_nms'
,
[
'gpu_nms.pyx'
,
'nms_kernel.cu'
],
**
ext_args
),
]
...
...
@@ -59,9 +42,9 @@ def customize_compiler_for_nvcc(self):
# object but distutils doesn't have the ability to change compilers
# based on source extension: we add it.
def
_compile
(
obj
,
src
,
ext
,
cc_args
,
extra_postargs
,
pp_opts
):
if
os
.
path
.
splitext
(
src
)[
1
]
==
'.cu'
:
if
os
p
.
splitext
(
src
)[
1
]
==
'.cu'
:
# use the cuda for .cu files
self
.
set_executable
(
'compiler_so'
,
CUDA
[
'nvcc'
]
)
self
.
set_executable
(
'compiler_so'
,
'nvcc'
)
# use only a subset of the extra_postargs, which are 1-1 translated
# from the extra_compile_args in the Extension class
postargs
=
extra_postargs
[
'nvcc'
]
...
...
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