-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to compile on NVCC CUDA 11.0 #53
Comments
Would you try adding #define BOOST_PP_VARIADICS 0 at the top of your file before the include? And also try setting it to 1? I ask this because Boost.Preprocessor also has a check for CUDA in it, related to enabling variadic support. |
@fmhess Neither variation of your suggestion worked. Any other work around suggestions? |
On Tue, Feb 9, 2021 at 11:14 AM dahubley ***@***.***> wrote:
@fmhess Neither variation of your suggestion worked. Any other work around suggestions?
Well, I do development on Linux but I do have a windows machine. Is
it possible for me to download a free nvcc/msvc environment so I can
reproduce the problem? Boost doesn't seem to have any nvcc setups in
their array of test machines.
From your error message, it seems BOOST_PP_VALUE is getting set to
something strange in boost/preprocessor/slot/detail/shared.hpp . So
you could try narrowing this down to a Boost.Preprocessor issue, it
must be happening during the expansion of one of the BOOST_PP macros
used in a signals2 header.
…--
Frank
|
@fmhess I below is a link to the NVCC compiler. You can install the visual studio plugin to make the set up easier. Would it be possible to get boost to start compiling against NVCC? Heterogeneous computing (i.e. GPGPU) is growing in popularity in various fields where C++ is the dominate language. Also hiding dependencies can be a very laborious process for zero gain. Thanks for your help! |
I'll try out nvcc tomorrow. I just maintain Signals2, so you should
probably take your more general concerns to the boost-devel mailing list.
You could volunteer to run the boost regression tests on your platform (see
https://www.boost.org/development/testing.html ) then all the library
maintainers would be able to see if their tests pass on nvcc on windows.
Actually, something else you could try now would be to run the regression
tests for Boost.Preprocessor and see if they pass.
…On Tue, Feb 9, 2021, 16:56 dahubley ***@***.***> wrote:
@fmhess <https://github.com/fmhess> I below is a link to the NVCC
compiler.
NVCC Download <https://developer.nvidia.com/cuda-downloads>
You can install the visual studio plugin to make the set up easier.
Would it be possible to get boost to start compiling against NVCC?
Heterogeneous computing (i.e. GPGPU) is growing in popularity in various
fields where C++ is the dominate language. Also hiding dependencies can be
a very laborious process for zero gain.
Thanks for your help!
Drew
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#53 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARKTXYGAOMBY64BRBKZIN3S6GVRJANCNFSM4XCZNEIA>
.
|
Boost preprocessor now assumes variadic macro support so BOOST_PP_VARIADICS is always set to 1. |
@eldiener is this a recent change? |
I installed the latest nvcc 11.2, visual studio community 2019, and boost-1.75 and I couldn't reproduce your problem:
Can you try nvcc 11.2 and boost-1.75 and see if your problem still exists? |
Unfortunately we are no closer to finding the issue. I ran the compiler on the file from command line. The result was the same. I have added to cl.exe verison, CUDA verison, and compiler output for you.
|
Ok, I can reproduce the problem if I change the source code file
extension to ".cu". What I see is BOOST_PP_VALUE is set to
BOOST_PP_TUPLE_ELEM_O_1(BOOST_PP_TUPLE_ELEM_O_1(2, 0,
(3,(0,10,<boost/function/detail/function_iterate.hpp>))), 0,
BOOST_PP_TUPLE_ELEM_O_1(2, 1,
(3,(0,10,<boost/function/detail/function_iterate.hpp>))))
after preprocessing. When compiling a ".cpp" file, BOOST_PP_VALUE
evaluates to 0. So it looks like the BOOST_PP_TUPLE_ELEM_0_1 macro is
failing to evaluate, it must be undefined when compiling a cuda file?
|
The CUDA compiler will default to the MSVC compiler when asked to compile a cpp file. I think the opening message with the quote from Nvidia might be a clue to what is happening. Is there anything NVCC specific in the macros? |
There is no macro called |
The problem can be generated by preprocessing the following code with nvcc
(in a file with the ".cu" extension. The code is adapted from
boost/function.hpp
```
#include <boost/preprocessor/iterate.hpp>
# define BOOST_PP_ITERATION_PARAMS_1
(3,(0,10,<boost/function/detail/function_iterate.hpp>))
# include BOOST_PP_ITERATE()
# undef BOOST_PP_ITERATION_PARAMS_1
#endif
```
…--
Frank
|
Which version of nvcc and what is the nvcc command line ? |
And here is an unmangled and corrected version of the contents of the File.cu test program
|
The example runs fine with all compilers I have tested. Unfortunately there is no toolset for nvcc in bjam. This suggests some sort of bug in nvcc, most likely in its preprocessor. Maybe nvcc is emulating VC++ and VC++ has numerous workarounds to make its default non-standard preprocessor work with the preprocessor library. I could change the preprocessor configuration file for nvcc so that it acts like VC++. But what you are telling me is that nvcc when compiling a .cpp file works fine but when compiling a .cu it does not work fine, so this suggests something else. Maybe nvcc only emulates VC++ when compiling a .cu file, otherwise it invokes its own compiler. |
nvcc only defines
|
NVCC complies CPP files using the VC++ compiler. Thus, is why it works,
boost is tested again the underlying compiler in that case. NVCC uses it
own toolchain only when compiling .cu files or using the -x option.
…On Thu., Feb. 11, 2021, 8:40 p.m. Frank Mori Hess, ***@***.***> wrote:
nvcc only defines __CUDACC__ when compiling .cu files (see
https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html ).
There are various places in Boost.Config and one place in
Boost.Preprocessor where it checks for __CUDACC__. Also this bit from
include/boost/config/compiler/nvcc.hpp might be relevant:
//
// When compiing .cu files, there's a bunch of stuff that doesn't work with msvc:
//
#if defined(_MSC_VER)
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
# define BOOST_NO_CXX11_UNICODE_LITERALS
#endif
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#53 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIPDMWQOK6F76HVJW4SPAI3S6R2HVANCNFSM4XCZNEIA>
.
|
Also, it seems like really poor practice to add compiler switches to code
that is not testing against that toolchain. Thoughts?
…On Thu., Feb. 11, 2021, 8:40 p.m. Frank Mori Hess, ***@***.***> wrote:
nvcc only defines __CUDACC__ when compiling .cu files (see
https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html ).
There are various places in Boost.Config and one place in
Boost.Preprocessor where it checks for __CUDACC__. Also this bit from
include/boost/config/compiler/nvcc.hpp might be relevant:
//
// When compiing .cu files, there's a bunch of stuff that doesn't work with msvc:
//
#if defined(_MSC_VER)
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
# define BOOST_NO_CXX11_UNICODE_LITERALS
#endif
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#53 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIPDMWQOK6F76HVJW4SPAI3S6R2HVANCNFSM4XCZNEIA>
.
|
If I add a |
If I delete the check for |
That test was actually saying that if the VC++ default preprocessor is being used but nvcc is compiling cuda, don't use any of the many workarounds needed to deal with VC++ default's preprocessor and variadic macros. So what you are saying is that when nvcc is compiling in cuda mode, the preprocessor needs to treat it as VC++'s default preprocessor as far as dealing with variadic macro support is concerned. I am good with that change and will make it. |
I have made the change on the preprocessor 'develop' branch. |
Successfully accomplished a build of my entire project after applying the specified fix. |
The following code snippet will not compile in Nvidia's compiler.
The compiler chokes somewhere inside of the include statement without any additional code except the snippet above. The following error is returned:
C1012 unmatched parenthesis: missing ')' BoostPreprocessorHeader in C:\vcpkg\installed\x64-windows-static\include\boost\preprocessor\slot\detail\shared.hpp on line 27
I have spoken to the nvidia compiler group and they responded with the following:
The text was updated successfully, but these errors were encountered: