Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test_horiz_interp: Don't over-allocate arrays#1607

Merged
rem1776 merged 1 commit into
NOAA-GFDL:mainfrom
J-Lentz:test_horiz_interp-fix
Oct 31, 2024
Merged

test_horiz_interp: Don't over-allocate arrays#1607
rem1776 merged 1 commit into
NOAA-GFDL:mainfrom
J-Lentz:test_horiz_interp-fix

Conversation

@J-Lentz

@J-Lentz J-Lentz commented Oct 28, 2024

Copy link
Copy Markdown
Contributor

Description
In the horiz_interp_type assignment 1x2d bicubic test, there are four allocatable arrays for which the number of elements allocated exceeds the number that get initialized:

  • lon_src_1d
  • lat_src_1d
  • lon_out_1d
  • lat_out_1d

This PR shortens the sizes of the arrays to match the number of elements that get initialized.

Fixes horiz_interp tests 23-24 with ifort using strict debug flags. It also fixes the tests with the Cray compiler. I'm requesting a careful review from @rem1776, because while this change does make the tests pass, I'm not sure whether or not the over-allocation may be a deliberate part of the test.

How Has This Been Tested?
horiz_interp tests build, run, and pass with CCE 18 on C5 and with ifort using the following debug flags:

-check all -fpe0 -fp-stack-check -fstack-security-check -ftrapuv -init=arrays,minus_huge,snan

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

In the horiz_interp_type assignment 1x2d bicubic test, there are four
allocatable arrays for which the number of elements allocated exceeds the number
that get initialized:

* `lon_src_1d`
* `lat_src_1d`
* `lon_out_1d`
* `lat_out_1d`

This PR shortens the sizes of the arrays to match the number of elements that
get initialized.

@rem1776 rem1776 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@J-Lentz Yeah this wasn't intentional, not sure why exactly they have one extra index. Thanks for the fix!

@rem1776 rem1776 merged commit 7a73eaa into NOAA-GFDL:main Oct 31, 2024
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.

3 participants