forked from ESMCI/cime
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix wrong math in dynamic_vector allocation. #125
Merged
jedwards4b
merged 1 commit into
CESM-Development:master
from
quantheory:dynamic_vector_stride_fix
Aug 27, 2015
Merged
Fix wrong math in dynamic_vector allocation. #125
jedwards4b
merged 1 commit into
CESM-Development:master
from
quantheory:dynamic_vector_stride_fix
Aug 27, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There were two problems with this expression. First, the order of operations was wrong (missing parentheses). Second, the size of a strided subsection of an array is the size over the stride rounded up, rather than down, as in typical integer division. This bug showed up in unit tests with some compiler flag modifications, but the affected code is not exercised in CESM (or probably anywhere else, other than unit tests). The reason that unit tests did not catch this issue earlier is that the bug has no effect under Fortran 2003 automatic allocation rules. If the array is too small, automatic re-allocation prevents a segfault. If the array is too big, this is not a problem, since the vector type is deliberately designed to reserve extra space. However, we currently use some compilers without Fortran 2003 allocation rules enabled. This seems true of PGI and Cray in particular. On these compilers, it seems to be worth fixing the issue in case the strided access feature of the dynamic vector is used in the future. Testing: Unit tested only (this code is not currently exercised). Status: bit for bit
jedwards4b
added a commit
that referenced
this pull request
Aug 27, 2015
Fix wrong math in dynamic_vector allocation.
rljacob
added a commit
to E3SM-Project/cime
that referenced
this pull request
Aug 31, 2015
Update ACMEs cime to cime 2.1.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development#140 Update pio2 cmake build CESM-Development#137 cime unit tests now work when dot is not in path CESM-Development#141 update summarize_cprn_diffs to work with new scripts CESM-Development#131 Change cesm_setup to get list of models from env_run CESM-Development#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development#120 Move lnd <-> glc coupling into coupler CESM-Development#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development#138 Increase compatability with pio2 build system. CESM-Development#137 Use more general location for pfUnit CESM-Development#134 Replace large array in shr_expr_parser_mod CESM-Development#130 Fix (unused) dynamic_vector allocation CESM-Development#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development#123 Add cray compiler on edison CESM-Development#120 Fix mpi_unit_tests on yellowstone CESM-Development#87 Update hobart pelayouts CESM-Development#62 Allow fire emission fluxes CESM-Development#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
rljacob
added a commit
to E3SM-Project/cime
that referenced
this pull request
Sep 2, 2015
Update ACMEs cime to cime 2.0.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development#140 Update pio2 cmake build CESM-Development#137 cime unit tests now work when dot is not in path CESM-Development#141 update summarize_cprn_diffs to work with new scripts CESM-Development#131 Change cesm_setup to get list of models from env_run CESM-Development#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development#120 Move lnd <-> glc coupling into coupler CESM-Development#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development#138 Increase compatability with pio2 build system. CESM-Development#137 Use more general location for pfUnit CESM-Development#134 Replace large array in shr_expr_parser_mod CESM-Development#130 Fix (unused) dynamic_vector allocation CESM-Development#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development#123 Add cray compiler on edison CESM-Development#120 Fix mpi_unit_tests on yellowstone CESM-Development#87 Update hobart pelayouts CESM-Development#62 Allow fire emission fluxes CESM-Development#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
rljacob
added a commit
to E3SM-Project/cimemctcomps
that referenced
this pull request
Apr 15, 2021
Update ACMEs cime to cime 2.1.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development/cime#140 Update pio2 cmake build CESM-Development/cime#137 cime unit tests now work when dot is not in path CESM-Development/cime#141 update summarize_cprn_diffs to work with new scripts CESM-Development/cime#131 Change cesm_setup to get list of models from env_run CESM-Development/cime#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development/cime#120 Move lnd <-> glc coupling into coupler CESM-Development/cime#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development/cime#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development/cime#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development/cime#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development/cime#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development/cime#138 Increase compatability with pio2 build system. CESM-Development/cime#137 Use more general location for pfUnit CESM-Development/cime#134 Replace large array in shr_expr_parser_mod CESM-Development/cime#130 Fix (unused) dynamic_vector allocation CESM-Development/cime#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development/cime#123 Add cray compiler on edison CESM-Development/cime#120 Fix mpi_unit_tests on yellowstone CESM-Development/cime#87 Update hobart pelayouts CESM-Development/cime#62 Allow fire emission fluxes CESM-Development/cime#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
rljacob
added a commit
to E3SM-Project/cimemctcomps
that referenced
this pull request
Apr 15, 2021
Update ACMEs cime to cime 2.0.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development/cime#140 Update pio2 cmake build CESM-Development/cime#137 cime unit tests now work when dot is not in path CESM-Development/cime#141 update summarize_cprn_diffs to work with new scripts CESM-Development/cime#131 Change cesm_setup to get list of models from env_run CESM-Development/cime#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development/cime#120 Move lnd <-> glc coupling into coupler CESM-Development/cime#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development/cime#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development/cime#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development/cime#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development/cime#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development/cime#138 Increase compatability with pio2 build system. CESM-Development/cime#137 Use more general location for pfUnit CESM-Development/cime#134 Replace large array in shr_expr_parser_mod CESM-Development/cime#130 Fix (unused) dynamic_vector allocation CESM-Development/cime#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development/cime#123 Add cray compiler on edison CESM-Development/cime#120 Fix mpi_unit_tests on yellowstone CESM-Development/cime#87 Update hobart pelayouts CESM-Development/cime#62 Allow fire emission fluxes CESM-Development/cime#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
rljacob
added a commit
to E3SM-Project/cimemctcomps
that referenced
this pull request
Apr 16, 2021
Update ACMEs cime to cime 2.1.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development/cime#140 Update pio2 cmake build CESM-Development/cime#137 cime unit tests now work when dot is not in path CESM-Development/cime#141 update summarize_cprn_diffs to work with new scripts CESM-Development/cime#131 Change cesm_setup to get list of models from env_run CESM-Development/cime#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development/cime#120 Move lnd <-> glc coupling into coupler CESM-Development/cime#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development/cime#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development/cime#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development/cime#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development/cime#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development/cime#138 Increase compatability with pio2 build system. CESM-Development/cime#137 Use more general location for pfUnit CESM-Development/cime#134 Replace large array in shr_expr_parser_mod CESM-Development/cime#130 Fix (unused) dynamic_vector allocation CESM-Development/cime#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development/cime#123 Add cray compiler on edison CESM-Development/cime#120 Fix mpi_unit_tests on yellowstone CESM-Development/cime#87 Update hobart pelayouts CESM-Development/cime#62 Allow fire emission fluxes CESM-Development/cime#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
rljacob
added a commit
to E3SM-Project/cimemctcomps
that referenced
this pull request
Apr 16, 2021
Update ACMEs cime to cime 2.0.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development/cime#140 Update pio2 cmake build CESM-Development/cime#137 cime unit tests now work when dot is not in path CESM-Development/cime#141 update summarize_cprn_diffs to work with new scripts CESM-Development/cime#131 Change cesm_setup to get list of models from env_run CESM-Development/cime#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development/cime#120 Move lnd <-> glc coupling into coupler CESM-Development/cime#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development/cime#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development/cime#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development/cime#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development/cime#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development/cime#138 Increase compatability with pio2 build system. CESM-Development/cime#137 Use more general location for pfUnit CESM-Development/cime#134 Replace large array in shr_expr_parser_mod CESM-Development/cime#130 Fix (unused) dynamic_vector allocation CESM-Development/cime#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development/cime#123 Add cray compiler on edison CESM-Development/cime#120 Fix mpi_unit_tests on yellowstone CESM-Development/cime#87 Update hobart pelayouts CESM-Development/cime#62 Allow fire emission fluxes CESM-Development/cime#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
billsacks
pushed a commit
to billsacks/cprnc
that referenced
this pull request
Dec 2, 2023
Update ACMEs cime to cime 2.1.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development/cime#140 Update pio2 cmake build CESM-Development/cime#137 cime unit tests now work when dot is not in path CESM-Development/cime#141 update summarize_cprn_diffs to work with new scripts CESM-Development/cime#131 Change cesm_setup to get list of models from env_run CESM-Development/cime#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development/cime#120 Move lnd <-> glc coupling into coupler CESM-Development/cime#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development/cime#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development/cime#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development/cime#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development/cime#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development/cime#138 Increase compatability with pio2 build system. CESM-Development/cime#137 Use more general location for pfUnit CESM-Development/cime#134 Replace large array in shr_expr_parser_mod CESM-Development/cime#130 Fix (unused) dynamic_vector allocation CESM-Development/cime#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development/cime#123 Add cray compiler on edison CESM-Development/cime#120 Fix mpi_unit_tests on yellowstone CESM-Development/cime#87 Update hobart pelayouts CESM-Development/cime#62 Allow fire emission fluxes CESM-Development/cime#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
billsacks
pushed a commit
to billsacks/cprnc
that referenced
this pull request
Dec 2, 2023
Update ACMEs cime to cime 2.0.12 conflicts resolved: use our version of config_compsets.xml Needed or useful for ACME: BatchMaker.pm: more robust mpirun selection, don't ignore -project, CESM-Development/cime#140 Update pio2 cmake build CESM-Development/cime#137 cime unit tests now work when dot is not in path CESM-Development/cime#141 update summarize_cprn_diffs to work with new scripts CESM-Development/cime#131 Change cesm_setup to get list of models from env_run CESM-Development/cime#133 Fix uninitialized value bug in create_test Various build fixes CESM-Development/cime#120 Move lnd <-> glc coupling into coupler CESM-Development/cime#106 Update batch configuration for edison Fix finding component history files for baseline gen,comp CESM-Development/cime#86 Change shr_flux_mods to support CAM aquaplanet CESM-Development/cime#64 Improve cesm_clean and add compiler options helpful for pop/cice CESM-Development/cime#63 and 88 Fix Batch* to allow machines that don't allow direct queue submissions and output the qsub command. configure uses -cimeroot even with -list CESM-Development/cime#55 Have preview_namelists load modules for chemistry preprocessor. Fix minor compiler complaints for NAG. Add environment variable CIME_MODULES_LOADED to prevent module evnironment being loaded more than once Update dirunal shr_flux code and diurnal ocean feature in docn. Don't hardwire 30 minute coupling period. No impact (yet) on ACME: Workaround for bug in cism-test_coupling cases. CESM-Development/cime#138 Increase compatability with pio2 build system. CESM-Development/cime#137 Use more general location for pfUnit CESM-Development/cime#134 Replace large array in shr_expr_parser_mod CESM-Development/cime#130 Fix (unused) dynamic_vector allocation CESM-Development/cime#125 Add -qfloat=nomaf for mira/cetus Update hobart and edison/cray compiles. Read in namelists for new modules on task 0 only CESM-Development/cime#123 Add cray compiler on edison CESM-Development/cime#120 Fix mpi_unit_tests on yellowstone CESM-Development/cime#87 Update hobart pelayouts CESM-Development/cime#62 Allow fire emission fluxes CESM-Development/cime#61 Update ExpectedTestFails.xml Fix hobart path for cprnc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a very low impact bug, because the affected code is not currently exercised in CESM. But the issue is easy to fix.
Under some compilers, using the strided subsection feature of dynamic vectors could cause a heap array to be allocated with too small of a size, causing an out-of-bounds access issue. No one is accessing dynamic vectors with strides yet, so this does not currently cause an issue in CESM runs. We also don't run unit tests on the affected compilers, so the bug was not caught until I noticed this while trying to create a test driver for debugging an issue with the Cray compiler.