Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8647 closed Patches (fixed)

Incorrect Identification of CUDA NVCC with User-Defined Backend

Reported by: ryo-nishimura@… Owned by: John Maddock
Milestone: To Be Determined Component: config
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Boost does not identify the CUDA NVCC compiler with user-defined backend compilers correctly. Boost assumes that either GCC or Visual C++ that is the default backend of NVCC is the only available backend. However NVCC has the -ccbin option changing backend compilers to what you want, and may compile CUDA programs with backends unexpected by Boost.

So I wrote a patch that all of the compilers supported by Boost get valid as a backend of NVCC. It ports the generic identification routine of select_compiler_config.hpp to nvcc.hpp.

I heard that CUDA 5.5 will support Clang as a backend for OS X. This patch would be needed for the upcoming next version.

Attachments (2)

nvcc.hpp.patch (3.1 KB ) - added by ryo-nishimura@… 9 years ago.
nvcc.hpp.johnmaddock.patch (1.6 KB ) - added by ryo-nishimura@… 9 years ago.

Download all attachments as: .zip

Change History (8)

by ryo-nishimura@…, 9 years ago

Attachment: nvcc.hpp.patch added

comment:1 by viboes, 9 years ago

Component: Noneconfig
Owner: set to John Maddock

comment:2 by John Maddock, 9 years ago

I'm wondering - since nvcc.hpp basically does next to nothing - whether it would be better to simply remove it, and let select_compiler_config.hpp select on the basis of the underlying compiler?

by ryo-nishimura@…, 9 years ago

Attachment: nvcc.hpp.johnmaddock.patch added

comment:3 by ryo-nishimura@…, 9 years ago

johnmaddock, thank you for your advising. I have revised the patch with your concept.

My new patch is to make the NVCC compiler's branch of select_compiler_config.hpp independent from the other compilers' tree and to remove the existing duplicated tree of nvcc.hpp.

I have checked this patch working fine as the old patch. Would it become a more smart solution for my purpose?

comment:4 by John Maddock, 9 years ago

Resolution: fixed
Status: newclosed

(In [85154]) Apply patch from #8647. Fixes #8647.

comment:5 by robert.maynard@…, 9 years ago

I apologize if it is bad behavior to comment on closed bugs.

These changes to detecting the backend for nvcc has had the side effect of making it not possible to use the clang backend with CUDA 5.5. My testbed machine is a Mac Lion with CUDA 5.5 and XCode 5.0.2.

The problem is that the nvcc with the clang backend is expecting clang to be emulating gcc 4.2.

The solution is that select_compiler_config.hpp should have the following guard:

#elif defined __clang__ && !defined(__CUDACC__)
//  Clang C++ emulates GCC, so it has to appear early.
#   define BOOST_COMPILER_CONFIG "boost/config/compiler/clang.hpp"

comment:6 by ryo-nishimura@…, 9 years ago

Hi Robert Maynard,

Thank you for your reporting a bug of my patch.

The user-defined backend trouble I really had was on Linux, and CUDA 5.5 on OS X was used as only my sophism in order to persuade necessity of my patch. Really I have never understood nor tested the implementation of OS X CUDA 5.5 released after my patch committed.

I apologize for my irresponsible and thank you again.

Note: See TracTickets for help on using tickets.