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
vision
Commits
5e9ebe8d
Unverified
Commit
5e9ebe8d
authored
Aug 21, 2020
by
vfdev
Committed by
GitHub
Aug 21, 2020
Browse files
Added DEBUG=1 option to build torchvision (#2603)
- can be helpful for debugging C++ extensions
parent
baa592b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
setup.py
setup.py
+14
-2
No files found.
setup.py
View file @
5e9ebe8d
import
os
import
io
import
re
import
sys
import
csv
from
setuptools
import
setup
,
find_packages
from
pkg_resources
import
parse_version
,
get_distribution
,
DistributionNotFound
import
subprocess
...
...
@@ -208,6 +206,20 @@ def get_extensions():
extra_compile_args
.
setdefault
(
'cxx'
,
[])
extra_compile_args
[
'cxx'
].
append
(
'/MP'
)
debug_mode
=
os
.
getenv
(
'DEBUG'
,
'0'
)
==
'1'
if
debug_mode
:
print
(
"Compile in debug mode"
)
extra_compile_args
[
'cxx'
].
append
(
"-g"
)
extra_compile_args
[
'cxx'
].
append
(
"-O0"
)
if
"nvcc"
in
extra_compile_args
:
# we have to remove "-OX" and "-g" flag if exists and append
nvcc_flags
=
extra_compile_args
[
"nvcc"
]
extra_compile_args
[
"nvcc"
]
=
[
f
for
f
in
nvcc_flags
if
not
(
"-O"
in
f
or
"-g"
in
f
)
]
extra_compile_args
[
"nvcc"
].
append
(
"-O0"
)
extra_compile_args
[
"nvcc"
].
append
(
"-g"
)
sources
=
[
os
.
path
.
join
(
extensions_dir
,
s
)
for
s
in
sources
]
include_dirs
=
[
extensions_dir
]
...
...
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