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

Compile with -std=f2008 #228

Merged
merged 32 commits into from
Nov 6, 2022
Merged

Compile with -std=f2008 #228

merged 32 commits into from
Nov 6, 2022

Conversation

ewu63
Copy link
Collaborator

@ewu63 ewu63 commented Aug 3, 2022

Purpose

This the last remaining repo. This fixes a number of things

  • compilation with strict -std=f2008 standard
  • compilation under GCC>= 10

I got the real build to work (there are some warnings still but it should run fine). The complex build has some extra problems that will require more investigation, in particular complexify.py probably needs to be modified. I have absolutely no idea how it works in idwarp without such fixes.

I will not continue working on this PR, but this should be done soon as it is blocking adoption of our codes with newer GCC compilers.

Expected time until merged

This is not ready to merge yet.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

Checklist

  • I have run flake8 and black to make sure the code adheres to PEP-8 and is consistently formatted
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@ewu63 ewu63 requested a review from a team as a code owner August 3, 2022 00:42
@ewu63 ewu63 requested review from joanibal and anilyil August 3, 2022 00:42
@ewu63 ewu63 marked this pull request as draft August 3, 2022 00:42
@codecov
Copy link

codecov bot commented Aug 3, 2022

Codecov Report

Merging #228 (2698301) into main (af5c32b) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #228   +/-   ##
=======================================
  Coverage   41.35%   41.35%           
=======================================
  Files          13       13           
  Lines        3794     3794           
=======================================
  Hits         1569     1569           
  Misses       2225     2225           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eirikurj
Copy link
Contributor

eirikurj commented Aug 3, 2022

@nwu63 I can have a look at the remaining issues as I wanted to update the complex build anyway.

@eirikurj eirikurj self-assigned this Aug 3, 2022
@ewu63 ewu63 changed the title Comple with -std=f2008 Compile with -std=f2008 Aug 10, 2022
@ewu63
Copy link
Collaborator Author

ewu63 commented Sep 13, 2022

Is this ready @eirikurj?

@eirikurj
Copy link
Contributor

Yeah, I think this is good for now. Will mark it ready for review. Few things to note. I created an interface for myisnan to handle both the real and complex checks. C function myisnan is removed in favor of a more modern fortran module. Previously there was not really a check for complex numbers, but here I decided just to check both real and imag parts. This is thus a change in behavior. Also, despite the name myisnan the C function also checked for INF so I retained this behavior in this implementation. Please make sure to test this thoroughly in case you have problems that you can trigger NAN or INF for complex case.

@eirikurj eirikurj marked this pull request as ready for review September 14, 2022 11:13
sseraj
sseraj previously approved these changes Sep 14, 2022
Copy link
Collaborator

@sseraj sseraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think this is fine as is so I approved, but I also have some comments:

I have a failing case that produces NaNs in complex mode. The behavior did change with this PR. Instead of crashing with returnFail during the first iteration, it continuously takes NK steps of size 0.01 where all monitor variables are NaNs. I prefer the original behavior, but this is not that big of an issue.

src/output/writeCGNSSurface.F90 Outdated Show resolved Hide resolved
sseraj and others added 2 commits October 3, 2022 14:04
Allow specified modules to be compiled without optimization
sseraj
sseraj previously approved these changes Oct 3, 2022
@ewu63 ewu63 requested a review from eirikurj October 4, 2022 01:08
@eirikurj
Copy link
Contributor

eirikurj commented Oct 6, 2022

I can approve this but, since I made large amount of changes, I would prefer that someone else reviewed, tested, and gave some feedback. @anilyil @joanibal?

@anilyil
Copy link
Contributor

anilyil commented Oct 6, 2022

I did want to take a look at this. I can review within the next 2 days if there is no urgency. I wanted to review partly also because my current open PR touches a bit of fortran and I want to see how bad the conflicts will be and if I can fix that PR as well.

@eirikurj
Copy link
Contributor

eirikurj commented Oct 6, 2022

Ok, from my point of view, that fine. Please take your time testing this, preferably on some complex cases if you have any.

Copy link
Contributor

@anilyil anilyil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes here look good. I have a few general comments:

  1. None of my cases get NaNs right now, so I cannot test this. However, if you want, we can add a test that we force to get a nan and see if we can catch it.
  2. What did you mean by try my "complex" cases? As in complicated cases or cases that use complex numbers for complex step checks?
  3. Some files only have whitespace added (adBuffer.f, adStack.c). Do we want to keep these whitespace changes or just remove them to have a cleaner diff?
  4. Will this now not work with compilation using GCC 9?

Otherwise stuff look good. I don't fully understand the implications of the compilation flags but it would be nice if one of you can give me a quick summary over a call so I dont miss any nuance. The other code changes make sense.

@eirikurj
Copy link
Contributor

eirikurj commented Oct 7, 2022

@anilyil see my comments below. We can discuss optimization flags offline if you want.

  1. I agree that a test would be great. This could be done on several levels. Fortran unit tests for the new genericISNAN.F90 would make sense to test functionality, and then unit or regression tests for larger processes. Did you have something in mind?
  2. I wanted to make sure there was no change in behavior, as the C function is now replaced by a fortran module. Previously there was not really a check for complex part, but now both real and imag parts are checked. @sseraj had a case has checked that the behavior is the same for the complex numbers and aggressive optimization flags (see Allow specified modules to be compiled without optimization #233)
  3. Based on the commit my guess is that the whitespaces came with a copy-paste from idwarp since the source there had them in. I don't see any need for them and suggest we remove them. I will push some updates.
  4. Yes, currently U18 and U20 images use GCC 7.4 and 9.4, respectively.

@joanibal
Copy link
Collaborator

joanibal commented Oct 8, 2022

Am I correct that this PR is necessary but not sufficient to get ADflow working with GCC 11?

@joanibal
Copy link
Collaborator

joanibal commented Oct 8, 2022

With a cheeky little -fallow-argument-mismatch I'm able to run it with gcc 11

Copy link
Collaborator

@joanibal joanibal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

@ewu63
Copy link
Collaborator Author

ewu63 commented Oct 8, 2022

With a cheeky little -fallow-argument-mismatch I'm able to run it with gcc 11

I would like to eventually fix these, so that we do not have to conditionally add those to the Docker builds once we update to U22 which will be using gcc>9. But I guess that does not have to happen in this PR

joanibal
joanibal previously approved these changes Oct 17, 2022
@sseraj
Copy link
Collaborator

sseraj commented Oct 27, 2022

@anilyil @eirikurj Any updates on this? We should probably merge this soon.

@eirikurj
Copy link
Contributor

@anilyil wanted to have a chat offline, but we have yet to meet. Will reach out offline so we can figure out a time and can get this merged soon.

@eirikurj
Copy link
Contributor

@sseraj, @anily plans to review this later this week.

@sseraj sseraj merged commit 83a611d into main Nov 6, 2022
@sseraj sseraj deleted the modernize-fortran branch November 6, 2022 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants