Unverified Commit 74de51d6 authored by vfdev's avatar vfdev Committed by GitHub
Browse files

Added "-fopenmp" cflags (#2783) (#3006)

* Fixes #2783
- Added "-fopenmp" cflags
- Refactored cxx flags creation

* Fixed for macosx
parent dbdc7267
...@@ -175,7 +175,9 @@ def get_extensions(): ...@@ -175,7 +175,9 @@ def get_extensions():
define_macros = [] define_macros = []
extra_compile_args = {} extra_compile_args = {
'cxx': []
}
if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) \ if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) \
or os.getenv('FORCE_CUDA', '0') == '1': or os.getenv('FORCE_CUDA', '0') == '1':
extension = CUDAExtension extension = CUDAExtension
...@@ -190,16 +192,13 @@ def get_extensions(): ...@@ -190,16 +192,13 @@ def get_extensions():
else: else:
define_macros += [('WITH_HIP', None)] define_macros += [('WITH_HIP', None)]
nvcc_flags = [] nvcc_flags = []
extra_compile_args = { extra_compile_args['nvcc'] = nvcc_flags
'cxx': [],
'nvcc': nvcc_flags,
}
if sys.platform == 'win32': if sys.platform == 'win32':
define_macros += [('torchvision_EXPORTS', None)] define_macros += [('torchvision_EXPORTS', None)]
extra_compile_args.setdefault('cxx', [])
extra_compile_args['cxx'].append('/MP') extra_compile_args['cxx'].append('/MP')
elif sys.platform == 'linux':
extra_compile_args['cxx'].append('-fopenmp')
debug_mode = os.getenv('DEBUG', '0') == '1' debug_mode = os.getenv('DEBUG', '0') == '1'
if debug_mode: if debug_mode:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment