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

OBC: segment parser refactoring #1200

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

marshallward
Copy link
Collaborator

The segment configuration parser was encountering problems with GFortran
10.2, where the fields array update was being removed by the -O2
optimizer.

In fact, the parse_segment_data_str function was doing two separate
operations, where the first call would determine the number of fields
and save their names into an array, and the second call would parse the
data contents of each input field. The presence of optional arguments
were used to effectively select the preferred operation.

It is possible that the presence of these optional arguments was
interfering with optimization, causing the removal of the fields
update.

While this is most likely a bug in the GFortran compiler, we address the
problem by instead splitting this function into two independent
functions, which allows us to remove the optional arguments.

When split, the function appears to work correctly under O2
optimization.

The segment configuration parser was encountering problems with GFortran
10.2, where the `fields` array update was being removed by the -O2
optimizer.

In fact, the `parse_segment_data_str` function was doing two separate
operations, where the first call would determine the number of fields
and save their names into an array, and the second call would parse the
data contents of each input field.  The presence of optional arguments
were used to effectively select the preferred operation.

It is possible that the presence of these optional arguments was
interfering with optimization, causing the removal of the `fields`
update.

While this is most likely a bug in the GFortran compiler, we address the
problem by instead splitting this function into two independent
functions, which allows us to remove the optional arguments.

When split, the function appears to work correctly under O2
optimization.
@marshallward
Copy link
Collaborator Author

Someday it might be better to rewrite this parser to populate a more organized data structure, but I think this change is good enough for now.

@kshedstrom
Copy link
Collaborator

Either this or another recent change is causing my seamount cases to fail:
FATAL from PE 3: mpp_sync_self: size_recv does not match of data received

@marshallward
Copy link
Collaborator Author

@kshedstrom Can you either send me the experiment or revert to dev/gfdl and test again?

@kshedstrom
Copy link
Collaborator

It is definitely dev/gfdl which is the problem. I'll go to an earlier version and try your patch.

@kshedstrom
Copy link
Collaborator

If I go to origin/dev/esmg and cherry-pick your patch, all is well. It does include Andrew's tides so maybe they are at odds with one of the other updates - I'll have to investigate further.

I approve this PR.

@marshallward
Copy link
Collaborator Author

Thanks for checking Kate, there was a good chance I would make a mistake with this.

@adcroft
Copy link
Collaborator

adcroft commented Sep 4, 2020

@kshedstrom , @MJHarrison-GFDL we definitely need you to try this branch since we only have two tests that will exercise this code.

@MJHarrison-GFDL
Copy link
Contributor

MJHarrison-GFDL commented Sep 5, 2020

@marshallward . Having trouble building (cd .testing; make TEMPLATE=./linux-ubuntu-xenial-gnu.mk compile).

I was on the wrong branch. All is well.

@MJHarrison-GFDL
Copy link
Contributor

@kshedstrom . seamount cases pass with a clean build.

@MJHarrison-GFDL
Copy link
Contributor

I am OK with these changes.

Copy link
Collaborator

@adcroft adcroft left a comment

Choose a reason for hiding this comment

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

@codecov-commenter
Copy link

Codecov Report

Merging #1200 into dev/gfdl will decrease coverage by 0.00%.
The diff coverage is 38.24%.

Impacted file tree graph

@@             Coverage Diff              @@
##           dev/gfdl    #1200      +/-   ##
============================================
- Coverage     46.08%   46.07%   -0.01%     
============================================
  Files           214      224      +10     
  Lines         69399    70574    +1175     
============================================
+ Hits          31984    32519     +535     
- Misses        37415    38055     +640     
Impacted Files Coverage Δ
...g_src/external/GFDL_ocean_BGC/FMS_coupler_util.F90 0.00% <0.00%> (ø)
...fig_src/external/GFDL_ocean_BGC/generic_tracer.F90 0.00% <0.00%> (ø)
...c/external/GFDL_ocean_BGC/generic_tracer_utils.F90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/kdtree.f90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/ocean_da_core.F90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/ocean_da_types.F90 0.00% <0.00%> (ø)
config_src/external/ODA_hooks/write_ocean_obs.F90 0.00% <0.00%> (ø)
config_src/solo_driver/MESO_surface_forcing.F90 0.00% <0.00%> (ø)
config_src/solo_driver/user_surface_forcing.F90 0.00% <0.00%> (ø)
src/ALE/MOM_regridding.F90 31.47% <0.00%> (-0.17%) ⬇️
... and 201 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fae9895...d1b222b. Read the comment docs.

@adcroft adcroft merged commit 5dd727a into mom-ocean:dev/gfdl Sep 10, 2020
@marshallward marshallward deleted the obc_seg_parse_refactor branch January 18, 2021 12:42
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