-
Notifications
You must be signed in to change notification settings - Fork 375
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
Convert p3_init from f90 to CXX #6845
Conversation
This removes the last f90 from P3. Change list: * Move table read/write implementation to CXX in p3_init_impl.hpp * p3_init now returns a P3LookupTables object with all the views inside containing the tables. * Rename init_kokkos_tables to get_global_tables * Rename init_kokkos_ice_lookup_tables to get_global_ice_lookup_tables * Remove all f90 bridge code * p3_tables_setup is now built by default and ran when baseline gen is on. This gives us the ability to generate these tables through GH actions which will be needed for this PR. * Move p3_tables_setup to tests dir, cleans up top p3 directory * Fix p3_tables_setup implementation; it got broken in recent PRs but we didn't notice because it didn't get built by default * Remove P3GlobalForFortran test struct, just call p3_init! * Remove P3InitAP3Data test struct Debatable change: I really wanted to have `P3LookupTables lookup_tables` be static in p3_init so they would not have to be re-created on every p3_init call. Unfortunately, Kokkos does not allow static views to be active on program shutdown, since this occurs after Kokkos::finalize, so we would need add a p3_finalize method and ensure it was called at the end of p3. This seems burdensome and error prone, so I just decided to re-read all the tables every time p3_init is called. [non-BFB]
Reviewers, please see "Debatable change" section in the description. |
|
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.
NICE! I love PRs where the # of rm-ed lines is larger than the # of added lines...
I have a few suggestions, in case you want to take this a step further. Not blocking though.
As for the debatable change: I think leaving as is (init for every test) is fine. No need to add complexity just to make the tests a bit faster. Our tests are reasonably fast anyways, so unless they suddenly got slow, and need the speedup of a single read, I think it's fine.
Simplify io action using if constexpr. Remove fortran module stuff from cmake Remove fortran from comment
@jgfouca Before merging this, we should decide how to handle tables. Once merged, we will need to regenerate the tables, right? But old e3sm versions will still need the "old" f90-major tables. Replacing the old files with the new will cause folks running old code to get diffs. I think we should change the tables names, so that we can have both old and new tables on the server. Maybe we should add v0.1 and v1.0 at the end of names, or something like that. |
@bartgol , crap, I did not think of that. Yes, this change probably requires a new table version... |
@bartgol , I made the changes we discussed and uploaded the v2 dat8 and dat4 files to ANL. |
I think all the fails are expected DIFFs, so I will go ahead and merge. |
This removes the last f90 from P3. Change list: 1) Move table read/write implementation to CXX in p3_init_impl.hpp 2) p3_init now returns a P3LookupTables object with all the views inside containing the tables. 3) Rename init_kokkos_tables to get_global_tables 4) Rename init_kokkos_ice_lookup_tables to get_global_ice_lookup_tables 5) Remove all f90 bridge code 6) Move p3_tables_setup to tests dir, cleans up top p3 directory 7) Fix p3_tables_setup implementation; it got broken in recent PRs but we didn't notice because it didn't get built by default 8) Remove P3GlobalForFortran test struct, just call p3_init! 9) Remove P3InitAP3Data test struct Debatable change: I really wanted to have P3LookupTables lookup_tables be static in p3_init so they would not have to be re-created on every p3_init call. Unfortunately, Kokkos does not allow static views to be active on program shutdown, since this occurs after Kokkos::finalize, so we would need add a p3_finalize method and ensure it was called at the end of p3. This seems burdensome and error prone, so I just decided to re-read all the tables every time p3_init is called. There are some round-off level diffs in P3, so: [non-BFB] * jgfouca/p3_cxx_init: GPU fixes: need to use host views for init stuff Update PAM submodule Change new table names to not conflict with older tables Github feedback Convert p3_init from f90 to CXX
This removes the last f90 from P3.
Change list:
Debatable change:
I really wanted to have
P3LookupTables lookup_tables
be static in p3_init so they would not have to be re-created on every p3_init call. Unfortunately, Kokkos does not allow static views to be active on program shutdown, since this occurs after Kokkos::finalize, so we would need add a p3_finalize method and ensure it was called at the end of p3. This seems burdensome and error prone, so I just decided to re-read all the tables every time p3_init is called.There are some round-off level diffs in P3, so:
[non-BFB]