extension-cpp icon indicating copy to clipboard operation
extension-cpp copied to clipboard

cuda compile error

Open xyecoding opened this issue 6 years ago • 4 comments

PyTorch GitHub Issues Guidelines

/home/yexiang/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/pytypes.h:1165:206:error: expansion pattern ‘pybind11::detail::negation<std::is_same<pybind11::detail::bools<pybind11::detail::negation<std::is_base_of<pybind11::arg, Args> >::value ..., pybind11::detail::negation<std::is_same<pybind11::detail::kwargs_proxy, Args> >::value ..., true>, pybind11::detail::bools<true, pybind11::detail::negation<std::is_base_of<pybind11::arg, Args> >::value ..., pybind11::detail::negation<std::is_same<pybind11::detail::kwargs_proxy, Args> >::value ...> > >::value’ contains no argument packs /home/yexiang/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/pytypes.h:1165:215:error: template argument 1 is invalid /home/yexiang/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/pytypes.h:1165:392:error: expansion pattern ‘pybind11::detail::negation<std::is_same<pybind11::detail::bools<pybind11::detail::negation<std::is_base_of<pybind11::arg, Args> >::value ..., pybind11::detail::negation<std::is_same<pybind11::detail::kwargs_proxy, Args> >::value ..., true>, pybind11::detail::bools<true, pybind11::detail::negation<std::is_base_of<pybind11::arg, Args> >::value ..., pybind11::detail::negation<std::is_same<pybind11::detail::kwargs_proxy, Args> >::value ...> > >::value’ contains no argument packs /home/yexiang/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/pytypes.h:1165:395:error: template argument 2 is invalid /home/yexiang/anaconda3/lib/python3.6/site-packages/torch/lib/include/pybind11/pytypes.h:

I can't compile the cuda version. When torch/extension.h is included in the .cu file, this error is reported. How to solve this problem.

xyecoding avatar May 14 '19 02:05 xyecoding

@xyegithub https://discuss.pytorch.org/t/compiling-cpp-cuda-extension-composed-of-multiple-files/30685/4 use #include <torch/types.h> in *.cu rather than <torch/extension.h>

fangwei123456 avatar Jun 01 '19 11:06 fangwei123456

@goldsborough @soumith any thoughts on this ? Should this solution be enforced in good practice ? Encountered the same issue with a user on my own module, so it's apparently not an isolated problem.

ClementPinard avatar Jun 11 '19 09:06 ClementPinard

same issue! fixed by replacing extension.h with types.h

hadifar avatar Jul 09 '19 13:07 hadifar

@xyegithub https://discuss.pytorch.org/t/compiling-cpp-cuda-extension-composed-of-multiple-files/30685/4 use #include <torch/types.h> in *.cu rather than <torch/extension.h>

replace '#include <torch/extensions.h>' with '#include <torch/types.h>' in lltm_cuda_kernel.cpp. It works. Thanks for your suggestions. ^^

alanzhai219 avatar Aug 27 '19 03:08 alanzhai219