dealii / code-gallery

A collection of codes based on deal.II contributed by deal.II users
Other
44 stars 54 forks source link

Parallel In Time c++ standard issue #122

Closed jerett-cc closed 1 year ago

jerett-cc commented 1 year ago

The Parallel in time example code does not work out of the box. On following the compilation steps listed in the documentation for the code, one gets the errors listed here.

A workaround that I used was to simply change the line SET(CMAKE_CXX_STANDARD 14) to SET(CMAKE_CXX_STANDARD 17) in the CMakeLists.txt file, and this worked.

The errors I saw before the fix are of the following flavor, and the full error I got is in the attached file. This is only a sample of the erros you get, but all are of similar composition. error: ‘apply’ is not a member of ‘dealii::std_cxx17’

error messages

bangerth commented 1 year ago

I can't reproduce this. The source file contains no mention of std::apply. Where did you have to set the CMAKE_CXX_STANDARD?

jerett-cc commented 1 year ago

I had to set it in the file

parallel_in_time/CMakeLists.txt

line 6.

I hate to speculate, but if you cannot easily reproduce this then perhaps it is an issue with my version of dealii? My impression of that error is that it is coming from inside dealii. If you read the file in the link error messages, you see that the error in fact is not originated from the source files from this project, but within dealii. I wonder if there is something strange with my build of dealii...

bangerth commented 1 year ago

I suspect that for some reason you compile deal.II in C++17 mode, but then compiled your code with C++11 or C++14. That will lead to trouble.

masterleinad commented 1 year ago

I would expect https://github.com/dealii/code-gallery/blob/4ffc151b8accfc2b44b1c04b6748e46076d9459e/parallel_in_time/CMakeLists.txt#L6 to be an issue when deal.II was configured with C++17 support.

jerett-cc commented 1 year ago

@bangerth @masterleinad seems like that was the issue, anyway everything works now on my end.

bangerth commented 1 year ago

Ah, good spot, @masterleinad! I think we should remove this line and instead inherit the language standard from deal.II. Do you agree?

masterleinad commented 1 year ago

Ah, good spot, @masterleinad! I think we should remove this line and instead inherit the language standard from deal.II. Do you agree?

Specifying the standard here additionally should work with a deal.II development version but it's redundant and causes problems with the latest release. It would only be relevant for deal.II releases before we require C++14 but I don't think we care much about that. Let's just remove it.