-
Notifications
You must be signed in to change notification settings - Fork 141
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
GEOS, FMS, Constants...and CMake #796
Comments
@mathomp4 - I think this is something we can discuss to come up with the best solution for all. |
@bensonr (and I guess @aerorahul as it sort of involves #806) - After working with @tclune, I think I can now use 2021.03 with GEOS constants with the following updates.
option(MAPL_MODE "Enable compiler definition -DMAPL_MODE" OFF)
if(MAPL_MODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND fms_defs MAPL_MODE)
endif() I'm still doing testing, but I think this is what is needed. (Note: We aren't wed to |
@mathomp4 - I think we need to be descriptive and I'd suggest the macro be NASA_GEOS. While the GFS_PHYS was chosen early purely to satisfy a need, I think it should be changed to something like UFS_GFS or UFS_SYSTEM. To make things easier to manage, I could create a separate .h for each modeling system and include the appropriate set based on the macro setting. Your thoughts? |
@bensonr - Any way you'd want to support it--different |
Well, I did some testing and, miracle of miracles, in-Baselibs CMake FMS 2021.03 built with these edits and your compile options seems to be zero-diff to our current FMS inside GEOS with our compile options. This...astounds me, honestly. I guess full kudos to @aerorahul for using, uh... |
@bensonr <https://github.com/bensonr> - Any way you'd want to support
it--different .h or .inc or .F90 files--would be fine by me! I can
definitely work with you to make sure things are in a good Doxygen-y way
and have the right MAPL/GEOS numbers.
@mathomp4 - feel free to append a file with your list of constants here or
send it to my email and I'll work to incorporate them into FMS for a future
release.
|
@bensonr - Okay. I think this is a stripped down file: You can see my I tried to clean things out so the attached file would just be pretty simple in comparison. ETA: And, of course, I didn't change any of the big Doxygen text. This would of course have to change in reality. 😄 |
@bensonr Ooh. Thanks for this! I'll take a look Monday when I have some time to be precise. I do have a test model where I'm using our fork of FMS in Baselibs and I think at the moment it only has two differences, the constants and fPIC (see #806): 2021.04...GEOS-ESM:geos/2021.04 And it's zero-diff. So if I can test this out, then we might be almost there! |
@mathomp4 - Once we get through making sure this works for you and your team, you should feel free to put in a PR to have PIC be an option in CMakeLists.txt. |
@bensonr I have a draft PR here: #930 I'll undraft it next week when I can do a build. I can't imagine I screwed it up as it's pretty brain-dead CMake code, but I want to be able to check all your boxes correctly. (Unless the CI builds effectively do this?) Of course, if any edits are needed, please let me know. |
@bensonr Welp, I took your branch, built a Baselibs with it using:
(and adding (NOTE: Annoyingly we might soon be slightly changing a few constants in GEOS/MAPL to better match CODATA 2018. I suppose the first thing is for the GEOS constants to get in FMS, then make a PR to update them.) |
@mathomp4 - thanks for he review. You've got the right procedure for updates once we get things into main. If you have the changes identified and ready now, feel free to clone my branch make the updates and put in a PR. That way your updates will get in the first time and won't be delayed until a future release. |
@bensonr The problem is those updates would be non-zero-diff. Frankly, no one but me is agitating for them, so once we have a long-term non-zero-diff update coming, then I'll make the PR. For now, if I can present an FMS update that is zero-diff and still moves us from 2019-era FMS to 2021/2022...I'm fine with having some annoyance on my side later! 😄 |
@mathomp4 - wfm |
TL;DR: GEOS uses different constants than FMS. What is the best way to handle this, especially in CMake FMS?
--
Recently, @danholdaway informed me that GEOS might need to catch up with Modern FMS. We haven't updated in a while mainly because "Don't break things that are working™" so we are sort of close to 2019.01.02.
If you look at our current constants.F90 on our fork, the main difference is that we use our GEOS/MAPL values for the constants so the FMS Earth looks like MAPL Earth and we control that via an
#ifdef
much like how the GFS constants are triggered:Now a while back, I asked about this topic in #155 but back then FMS wasn't as fully in CMake-land, but now it is. So it got me to thinking: Could we now figure out a way to handle MAPL constants in FMS in a way that is palatable to GFDL? I suppose I could ask very nicely if we could add the MAPL constants as well and add one more definition. But three sets of constants in one file is near the limit of annoying! Not impossible, but you might balk at this.
So another thought I had was maybe add an extra constants file? That is, not just
constants/constants.F90
but sayconstants/extern/MAPL_constants.F90
or something and then something like this inCMakeLists.txt
:That way, we supply a
constants_mod
just a different one?I suppose in the end my hope is that GEOS could get to the point where FMS is "just another library" rather than needing a fork which might have a single file different. (I know @tclune has thoughts on better ways to do this, i.e., supply constants as a dictionary, but that's a much longer-term project, if it's even possible.)
Note: I am currently trying to build the current FMS as "just a library" via CMake and see if I can get GEOS to use it. Obviously it'll have the wrong constants, but if I can do that, then that brings GEOS' use of FMS a lot closer!
The text was updated successfully, but these errors were encountered: