Update cpp_extension.py (#18638)

Summary:
Hi. It seems that when building CPP-extensions with CUDA for Windows, an `extra_cuda_cflags` options are not properly forwarded to `nvcc`.

Use of extra CUDA options is necessary to build, for instance, a InplaceABN (https://github.com/mapillary/inplace_abn), which requires `--expt-extended-lambda` option.

This PR adds one line that correctly appends `extra_cuda_cflags`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18638

Differential Revision: D14704270

Pulled By: ezyang

fbshipit-source-id: e1e330d193d9afd5707a5437a74c0499460d2b90
This commit is contained in:
BloodAxe
2019-04-02 07:49:40 -07:00
committed by Facebook Github Bot
parent fba89b2ae1
commit 5ade96fc84

View File

@ -1026,6 +1026,7 @@ def _write_ninja_file(path,
cuda_flags = common_cflags + COMMON_NVCC_FLAGS
if IS_WINDOWS:
cuda_flags = _nt_quote_args(cuda_flags)
cuda_flags += _nt_quote_args(extra_cuda_cflags)
else:
cuda_flags += ['--compiler-options', "'-fPIC'"]
cuda_flags += extra_cuda_cflags