-
Notifications
You must be signed in to change notification settings - Fork 382
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
Add -fallow-argument-mismatch
to gfortran in MPAS standalone builds
#4821
Add -fallow-argument-mismatch
to gfortran in MPAS standalone builds
#4821
Conversation
TestingWith this fix, I was able to build with gfortran 10.3.0, whereas I got errors (see MPAS-Dev/compass#323) without it. With this fix, I successfully ran the ocean I will test on Anvil with the older gfortran there to make sure this does no harm. Update: I ran the ocean |
5a2891f
to
2092b97
Compare
This is not working for gfortran < 10, so I need to work on that. |
4937211
to
85de14d
Compare
I'm still testing this on Anvil but it does at least build with an older gfortran. |
components/mpas-framework/Makefile
Outdated
GFORTRAN_GTE_10=$$(expr `gfortran -dumpversion | cut -f1 -d.` \>= 10) ;\ | ||
if [ "$${GFORTRAN_GTE_10}" = "1" ]; then \ | ||
FFLAGS="-fallow-argument-mismatch"; \ | ||
else \ | ||
FFLAGS=""; \ | ||
fi; \ | ||
( $(MAKE) all \ | ||
"FC_PARALLEL = mpif90" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philipwjones, do you know of a more elegant way to do this? If so, I'm keen to learn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not really.
-fallow-argument-mismatch
to gfortran-fallow-argument-mismatch
to gfortran in MPAS standalone builds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might consider using a more specific FFLAG name just to avoid confusion with the final FFLAGS variable that's created later for all flags.
But I approve regardless. This appears to be needed for gnu builds.
components/mpas-framework/Makefile
Outdated
GFORTRAN_GTE_10=$$(expr `gfortran -dumpversion | cut -f1 -d.` \>= 10) ;\ | ||
if [ "$${GFORTRAN_GTE_10}" = "1" ]; then \ | ||
FFLAGS="-fallow-argument-mismatch"; \ | ||
else \ | ||
FFLAGS=""; \ | ||
fi; \ | ||
( $(MAKE) all \ | ||
"FC_PARALLEL = mpif90" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not really.
Thanks @philipwjones, I completely agree. I'll give this a different name. |
This allows MPAS to build with gfortran >=10
85de14d
to
c3ab4e6
Compare
@philipwjones, I called it |
@mark-petersen, @akturner and @matthewhoffman, this is ready for your review. |
@@ -296,6 +296,12 @@ intel-mpi: | |||
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" ) | |||
|
|||
gfortran: | |||
GFORTRAN_GTE_10=$$(expr `gfortran -dumpversion | cut -f1 -d.` \>= 10) ;\ | |||
if [ "$${GFORTRAN_GTE_10}" = "1" ]; then \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be single dollar sign? My understanding was that $$ accesses shell variables, but single dollar sign should be used for Makefile variables (https://stackoverflow.com/questions/26564825/what-is-the-meaning-of-a-double-dollar-sign-in-bash-makefile). If my understanding is correct, it is interesting that using $$ here still works.
The $$ is also used below on all the lines below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewhoffman, my understanding of Makefiles is pretty limited but the single dollar sign version definitely wasn't working.
My understanding it that the make targets are shell scripts, unlike the rest of the make file, and they require $$
to escape the dollar sign so you are actually making shell calls as you want to here.
If you want to try what you suggest and see if you can get it working, be my guest. I wasn't successful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. I tested the makefile but checking for version >=1
so it adds the flag. Compile dies with an error with gnu V6 (as expected) because the flag -fallow-argument-mismatch
is undefined. I tried to change the double dollar signs to $(GFORTRAN_GTE_10)
and $(EXTRA_FFLAGS)
and it didn't work (the variables don't contain the correct values). So @xylar did it right - I just don't understand why these are shell variables rather than makefile variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for the explanation and testing. I'm convinced. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with gnu V6 on grizzly, and it compiles fine. I also changed to check for version >= 1
and confirmed that the flag is added, since I don't have a V10 compiler to test.
@akturner I compiled and tested above. Should be the same for sea ice, since we all use the same Makefile. Can you test or approve based on my comments? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed MPAS-Seaice build and testing
merged to next |
merged to master |
Thanks @jonbob, I really appreciate it! |
1 similar comment
Thanks @jonbob, I really appreciate it! |
MPAS standalone: Add gnu >=10 support on Cori This merge adds the -fallow-argument-mismatch flag to the gnu-nersc target for MPAS standalone builds. This got missed in #4821. [BFB]
MPAS standalone: Add gnu >=10 support on Cori This merge adds the -fallow-argument-mismatch flag to the gnu-nersc target for MPAS standalone builds. This got missed in #4821. [BFB]
This allows the code to build with gfortran >=10.0.0
Related to #4817, but for standalone MPAS builds
[BFB]