-
Notifications
You must be signed in to change notification settings - Fork 363
Add CI runner building with LLVM Flang #739
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
Conversation
|
Some tests seem to be failing with Flang as the Fortran compiler. I don't know if that is an issue with the compiler, with its runtime or if it actually points at something that might be suspicious in ElmerFEM. |
|
Would it make sense to split the PR into two parts so that you could merge that part that fixes building with support for quadruple-precision floating point number, and leave the part with the CI using LLVM Flang for later? |
|
Rebased on a current head after #745 was merged. |
Yes, this seems definitely a bug, i'll give it a try. Thanks! |
|
I worked last week a little on this and at least some problems seemed to be from non-explicit range when using GetReal. |
|
I rebased on a current head of the devel branch. And the number of failing tests reduced from 25 to 11. The remaining test errors seem to be in different categories than the "mismatching element counts" errors. |
These failures seem to be because the stack (8M) is not large enough on my laptop. |
|
The patch below fixes the stack size problem for me. My first impression is that the compiler diff --git a/fem/src/ElmerSolver.F90 b/fem/src/ElmerSolver.F90
+#if 1
+#else
+#endif |
|
... and I wasn't even using the introduced new 's' variable for anything there (as i intended). So just |
|
Just adding the |
2941 this also runs smoothly (on my laptop) with added stack space: "ulimit -s unlimited" |
|
The patch is hard to read (using triple backticks for blocks of unformatted text might help). |
|
Yes, sorry 'bout the formatting, should have used something to prevent the default. Anyway, closing the call
within the BLOCK-construct was the key. Removing or adding TRIM doesn't do anything (and hasn't mostly
been required for a few years now - after compilers really started supporting fortran allocatable
character string -construct ...)
|
|
I committed the BLOCK-END BLOCK thing to devel branch, shouldn't do any harm ... |
|
After a recompilation, also tests "Contact3DLevelProj" and "Contact3DNormalProj" exceed the default 8M main stack |
|
Thanks for looking into this. But the diff is unreadable with the default formatting. You need to use triple backticks for blocks of plain text in comment. Single backticks only work inside paragraphs of formatted text. |
|
Ok, thanks. I'll do that next, time, for now I attached the patch... |
|
Thanks for attaching the patch file. Yeah. Explicitly allocating these potentially large arrays on the heap instead of on the stack looks reasonable to me. |
|
Yes, I think so too, I'll commit these changes (... and similar changes in the complex version of IDRS implementation) to "devel". |
|
I rebased again (on top of b44300d). Good progress. 👍 |
|
Yep, thanks! The reason for the last 3 is known (small elmer bugs). I'll try to see where the first
(mis)uses its stack space.
|
|
For reference, gfortran has this (which is why we haven't seen this type of problems in a while) |
|
Apparently, there is no support for
Matching the documentation for gfortran, they follow up with:
Apparently, they implemented If you have a reproducer, it might make sense to open an issue on their tracker: https://github.com/llvm/llvm-project/issues |
|
Below is a very simple test case, it reads a number "n", gives it the to subroutine "msum", which uses it to allocate an automatic variable "w". flang compiled image crashes when n=~1100000 (running on my laptop, with 8mb default stack size), gfortran compiled image will accept anything that fits to central memory, f.ex. 1000000000 (1e9), again running my laptop I think elmer is now mostly good with flang, given the changes I made to source code. Can't explain the "circuit_harmonic*" test cases though, with the BLOCK-END BLOCK around the one subroutine call (somewhat dramatically) reducing stack usage . |
Disable MPI because Ubuntu does not provide Fortran bindings for LLVM Flang. Disable quadruple precision math because Ubuntu distributes a Flang runtime without support for it.
|
I rebased on a current head (e11e6fb). With that, the following three tests are failing for the runner that builds with LLVM Flang: |
|
Nice work! All tests should pass now... |
Disable MPI because Ubuntu does not provide Fortran bindings for LLVM Flang.
Disable quadruple-precision math because Ubuntu distributes a Flang compiler runtime without support for it. (And reportedly [1], the upstream support for quadruple-precision floating-point math in Flang isn't ready yet either if I understood correctly.)
Also fix some build errors after configuring with(Addressed in #745.)-DHAVE_QP=ONand enable it by default (like until recently).