From: BloodAxe Date: Tue, 2 Apr 2019 14:49:40 +0000 (-0700) Subject: Update cpp_extension.py (#18638) X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~488 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ade96fc8461cf40f8bddd9c1a562ebd0c657a0c;p=platform%2Fupstream%2Fpytorch.git 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 --- diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py index 94b8e71..a3492bb 100644 --- a/torch/utils/cpp_extension.py +++ b/torch/utils/cpp_extension.py @@ -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