问题
So, if you try to use nvcc when the system GCC is version 5 and up, you get an "unsupported version" error. But - I've heard people report that they've just commented this out and that CUDA 7.5 "works for them" with GCC 5.x .
When I do the same, however (the check is in $CUDA_DIR/host_config.h
), and compile something, I get the following errors:
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/mwaitxintrin.h(36): error: identifier "__builtin_ia32_monitorx" is undefined
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/mwaitxintrin.h(42): error: identifier "__builtin_ia32_mwaitx" is undefined
and a bunch of others, but those may be dependent on these. Now, these are MMX-related intrinsics for X86 architectures. I don't use them directly, so I'm guessing they're opted-in somehow. Perhaps this can be avoided?
Is there a way to overcome these errors and actually get GCC 5 to coexist with CUDA 7.5? And for code to build and run?
Notes:
- I've read a suggestion to use
-D__STRICT_ANSI__
. I have, and it doesn't seem to help. - I'm on Fedora 22 in case it matters.
回答1:
I think a -D_MWAITXINTRIN_H_INCLUDED
option should fix the issue. Actually I employed a slightly different approach, commenting out the #include <mwaitxintrin.h>
line in x86intrin.h
, and successfully built TensorFlow with CUDA 7.5 and GCC 5.2.1.
UPDATE
For the latest version of TensorFlow (v0.8.0), simply choose to use gcc 4.x when invoking the configure
script.
回答2:
Consider installing and temporary selecting an older version of the gcc
:
apt-get install gcc-4.8
Then update your alternatives:
update-alternatives --remove-all gcc
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
After compiling TensorFlow you can use previous version of gcc
calling above command with proper path to /usr/bin/gcc-5.x
.
回答3:
It's essentially futile to try to get GCC 5.x to work with CUDA 7.5 - there are some (or many?) incompatiblity issues which you simply can't resolve. Instead, just upgrade to CUDA 8.0 which has become available since this question was asked.
来源:https://stackoverflow.com/questions/34996295/trying-to-get-cuda-7-5-to-work-with-gcc-5-x