Bug 1530828 - Cuda 9 fails to compile when using boost
Summary: Cuda 9 fails to compile when using boost
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: boost
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jonathan Wakely
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-03 23:06 UTC by Sean Happel
Modified: 2018-04-29 21:22 UTC (History)
4 users (show)

Fixed In Version: boost-1.64.0-6.fc27 boost-1.63.0-12.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-27 01:19:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Recommended Patch (896 bytes, patch)
2018-01-03 23:06 UTC, Sean Happel
no flags Details | Diff
Example test code (fails to compile without patch) (56 bytes, text/x-csrc)
2018-01-03 23:07 UTC, Sean Happel
no flags Details

Description Sean Happel 2018-01-03 23:06:41 UTC
Created attachment 1376623 [details]
Recommended Patch

Description of problem:

Cuda 9.0 removed a macro (__CUDACC_VER__) without first deprecating it in the newly released Cuda 9.0.  This macro is used by boost, and causes compilations to fail.  This bug has been noted by boost, caffe, tensorflow, and other cuda libraries.
See:  <https://svn.boost.org/trac10/ticket/13152#no2>, <https://github.com/BVLC/caffe/issues/5994>, <https://github.com/tensorflow/tensorflow/issues/12489>

A quick patch could fix the issue until boost hotfixes the release themselves (if they do).  An example patch is attached.

Version-Release number of selected component (if applicable):  Boost 1.64
How reproducible: always

Steps to Reproduce:
1.  Install NVidia Cuda 9.0
2.  Create main.cu:
---
#include <boost/shared_ptr.hpp>
int main(){ return 0; }
---
3.  Try to compile:  /usr/local/cuda/bin/nvcc main.cu

Actual results:  Compilation fails.

[happest1@happest1-ll1 System]$ /usr/local/cuda/bin/nvcc -ccbin /usr/local/cuda-gcc-6/bin/compat-gcc65a-g++ main.cu
In file included from /usr/local/cuda/bin/..//include/common_functions.h:50:0,
                 from /usr/local/cuda/bin/..//include/cuda_runtime.h:115,
                 from <command-line>:0:
/usr/local/cuda/bin/..//include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^
/usr/local/cuda/bin/..//include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."


Expected results:  No warnings
[happest1@happest1-ll1 System]$ sudo patch /usr/include/boost/config/compiler/nvcc.hpp -i boost.patch 
[sudo] password for happest1: 
patching file /usr/include/boost/config/compiler/nvcc.hpp
[happest1@happest1-ll1 System]$ /usr/local/cuda/bin/nvcc -ccbin /usr/local/cuda-gcc-6/bin/compat-gcc65a-g++ main.cu
[happest1@happest1-ll1 System]$

Additional info:

Comment 1 Sean Happel 2018-01-03 23:07:47 UTC
Created attachment 1376625 [details]
Example test code (fails to compile without patch)

Comment 2 Jonathan Wakely 2018-02-27 18:40:19 UTC
I can't use Cuda 9.0 on F27 anyway, as it doesn't work with GCC 7. Where does the /usr/local/cuda-gcc-6/bin/compat-gcc65a-g++ compiler come from?

Comment 3 Sean Happel 2018-03-08 16:10:59 UTC
There are various places you can download or compile GCC 6 to get it working with Cuda 9.0.  Below are the instructions I used to build it.

# Installing GCC 6.x

Gcc 6.4 has a bug that prevents it from compiling with glibc-2.26.  A patch has been applied to the upstream gcc-6 branch, but has not made its way into an official release yet (next release will be 6.5).  So for now, we need to download the "trunk" for gcc 6, and compile that.

* sudo dnf install flex texinfo gmp-devel mpfr-devel libmpc-devel #Needed to compile GCC.  Flex is only needed when downloading from svn/git instead of an official source
* git clone https://github.com/gcc-mirror/gcc.git
* cd gcc
* git checkout gcc-6-branch
* ./configure --prefix=/usr/local/cuda-gcc-6 --program-prefix=compat-gcc65a- --disable-multilib
* make -j 8
* sudo make install
* sudo dnf remove flex texinfo gmp-devel mpfr-devel libmpc-devel #Remove compile-time dependencies
* cd ..
* rm -r gcc #Cleanup our build!

Note that the new GCC version (including libraries, includes, etc) will be installed in /usr/local/cuda-gcc, where it shouldn't interfere with any other toolchains you might have, and will be easy to cleanup once NVidia releases a compatible version of CUDA.

Comment 4 Jonathan Wakely 2018-03-08 16:35:16 UTC
Oh I see, so I can just point it at my existing gcc-6 builds, I assumed it was part of your Cuda installation. Let me try to reproduce this again then ...

Comment 5 Fedora Update System 2018-04-18 23:26:56 UTC
boost-1.64.0-6.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-97c275d576

Comment 6 Fedora Update System 2018-04-18 23:27:11 UTC
boost-1.63.0-12.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-b73bfea3af

Comment 7 Fedora Update System 2018-04-19 17:12:03 UTC
boost-1.63.0-12.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-b73bfea3af

Comment 8 Fedora Update System 2018-04-19 17:38:22 UTC
boost-1.64.0-6.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-97c275d576

Comment 9 Fedora Update System 2018-04-27 01:19:44 UTC
boost-1.64.0-6.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2018-04-29 21:22:38 UTC
boost-1.63.0-12.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.