Skip to content
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

GCC 10.3.0 internal compiler error #575

Closed
ptheywood opened this issue Jun 23, 2021 · 2 comments · Fixed by #577 or #661
Closed

GCC 10.3.0 internal compiler error #575

ptheywood opened this issue Jun 23, 2021 · 2 comments · Fixed by #577 or #661

Comments

@ptheywood
Copy link
Member

ptheywood commented Jun 23, 2021

gcc: internal compiler error: Segmentation fault signal terminated program cc1plus

Occurs during compilation of DeviceAgentVector_impl.cu.o, when using GCC 10.3.0 and CUDA 11.3 under ubuntu. This is also causing CI failurse since the ubuntu image updated GCC version.

Based on the cuda linux installation guide for 11.3, GCC 9.x is the supported GCC version for CUDA 11.3 on x86 hosts.

I'll leave this issue open for now, until we decide if we should warn / error at CMake configiuration time is GCC >= 10.3 is used (in conjunction with CUDA 11.3, and any others that do not error already at configure time). This may not effect arm / power hosts where GCC 10.2 is the supported / recommended host compiler.

@ptheywood
Copy link
Member Author

ptheywood commented Jun 24, 2021

Looks like GCC have already patched this, with users confirming it has already been resolved by building their own gcc 10.3.x from version control.
It looks like this also effected the GCC 11.1 minor release, however I do not believe gcc 11 and cuda 11 are in any way supported so probably not as much of a concern.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100102
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=5357ab75dedef403b0eebf9277d61d1cbeb5898f

Depending on what happens with the GCC releases we probably just want to drop in a little bit of cmake which prevents gcc 10.3.0 being used, lesser and newer versions are fine (as long as CMakes' checking that nvcc works in general with that version passes).

Based on comments discussed in the bugzilla linked above, it seems that:

Fixed for GCC 10.4, 11.2 and 12.

So GCC 10.3 is always going to be bad, as is 11.1 so we probably just want to explicitly block those from configuring (or issue a dev warning as a minimum?
This might not be correct though in case patch releases are issued (doesn't appear that they are by gcc directly, but potentially by platforms which re-package versions such as ubuntu?)

@ptheywood
Copy link
Member Author

ptheywood commented Aug 31, 2021

GCC 10.3.0 included with Ubuntu 21.04 doesn't appear to suffer from this issue, so must be patched.

We should add a compiler test to check if this is triggered or not at cmake configuration time (via try-compile with a very small snippet) rather than simply blocking based on version number.

Based on the gcc bug discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100102#c17

reproducer.cpp

#include <chrono>

template<int()> struct ratio;
template<class, class> struct duration {
  static constexpr int _S_gcd();
  template<class> using __is_harmonic = ratio<_S_gcd>;
  using type = __is_harmonic<int>;
};
g++ -c -o reproducer.o reproducer.cpp

Under GCC 10.3.0 on Ubuntu 20.04:

gcc -c -o reproducer.o reproducer.cpp 
reproducer.cpp: In substitution of ‘template<class, class> template<class> using __is_harmonic = ratio<duration< <template-parameter-1-1>, <template-parameter-1-2> >::_S_gcd> [with <template-parameter-2-1> = int; <template-parameter-1-1> = <template-parameter-1-1>; <template-parameter-1-2> = <template-parameter-1-2>]’:
reproducer.cpp:7:33:   required from here
reproducer.cpp:5:24: internal compiler error: Segmentation fault
    5 |   static constexpr int _S_gcd();
      |                        ^~~~~~

This is however still failing on ubuntu 21.04 with gcc 10.3 and 11.1, even though flamegpu is now building correctly, so this might be the wrong test (i.e. checking for something that will always fail, not that chrono is broken?)

Current master, with the docs only build for 10.3 check disabled on 20.04 still fails when it gets to EnvironmentDescription.cu, while ubuntu 21.04 doesn't suffer from this.

Just #include <chrono> in a .cu file appears to be sufficient to trigger the issue.

Confirmed that the following works to demonstrate the issue on 20.04 gcc 10.3, while working on 21.04 10.3

echo "#include <chrono>" > reproducer.cu && nvcc -c -o reproducer.cu.o reproducer.cu

@ptheywood ptheywood reopened this Aug 31, 2021
ptheywood added a commit that referenced this issue Aug 31, 2021
This allows working (patched) versions of gcc 10.3.0 and 11.1.0 to be used

Closes #575
mondus pushed a commit that referenced this issue Sep 1, 2021
* Update Visualiser repository commit and do not install GLU on CI

* Add override specifiers to overrides of virtual functions in util::Timer

This allows an additional warning to be enabled

* Remove CMake < 3.18 support and modernise CMake

CMake < 3.18 was already deprecated as 3.18 is required for c++17 CUDA

+ Updates the readme version requirements
+ Updates CMake Minimum required statements
+ Removes workarounds for old CMake versions
+ Use FindCUDAToolkit now it is always available
+ Switch to linking against the shared cuda runtime library, rather than implicit default of static on some platforms
+ Create INTERFACE library targets for header only libraries. This enforces the use of SYSTEM on includes
+ Create ALIAS library targets for 3rd party dependencies, for consistency
+ Stops the modification of CMAKE_<LANGUAGE>_FLAGS which is poor form
+ Switches from global defines/includes/links to per-target through the use of target specific functions
+ Ensure packages are available where they are used
+ Prevent in-source CMake builds
+ Use PUBLIC/INTERFACE/PRIVATE for link libraries etc. This may currently be excessivly public
+ Inherit visualisation dependency from target, required vis repo update.
+ Cmake organisation
+ Adjusts swig/python CMake to re-use components from elsewhere more
    + This file could do with work still
+ Misc other CMake changes

* Use Cmake try_compile to check for <chrono> nvcc+gcc support

This allows working (patched) versions of gcc 10.3.0 and 11.1.0 to be used

Closes #575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant