Use int64 to index arrays for Registry pack/unpack routines#1919
Merged
andrew-platt merged 1 commit intoOpenFAST:dev-unstable-pointersfrom Dec 6, 2023
Merged
Conversation
This also includes a change to the NWTC_Library CMakeLists.txt which automatically regenerates NWTC_Library_Types.f90 when Registry_NWTC_Library_base.txt changes
andrew-platt
reviewed
Dec 6, 2023
| if (GENERATE_TYPES) | ||
| generate_f90_types(src/Registry_NWTC_Library_typedef_nomesh.txt ${CMAKE_CURRENT_LIST_DIR}/src/NWTC_Library_Types.f90 -noextrap) | ||
| # Generate Registry_NWTC_Library.txt by concatenating _base.txt and _mesh.txt |
Collaborator
There was a problem hiding this comment.
Clever! I like this solution.
andrew-platt
approved these changes
Dec 6, 2023
| call RegPack(Buf, InData%TimeData) | ||
| end if | ||
| call RegPack(Buf, allocated(InData%AllOutData)) | ||
| if (allocated(InData%AllOutData)) then | ||
| call RegPackBounds(Buf, 2, lbound(InData%AllOutData), ubound(InData%AllOutData)) | ||
| call RegPackBounds(Buf, 2, lbound(InData%AllOutData, kind=B8Ki), ubound(InData%AllOutData, kind=B8Ki)) |
Collaborator
There was a problem hiding this comment.
This new registry looks a bit different than the old one, but I think this is the spot we had issues in the old one.
This file contains hidden or 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
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 PR is ready to be merged
Feature or improvement description
Using int32 (IntKi) for indexing into arrays imposes a limit on the array size of approximately 2 billion elements. Most arrays in OpenFAST will never reach this size, but the
AllOutDatamatrix which contains the output data for the entire simulation, and the byte buffer array used for packing and unpacking checkpoint data can exceed this size rather easily, which results in a crash. By using int64 (B8Ki) for indexing, far larger arrays may be used (2^63 elements). Which will eliminate crashing, but may cause OpenFAST to use all of the memory in the computer.Impacted areas of the software
openfast-registryand all module_Types.f90files includingNWTC_Library_Types.f90andModMesh_Mapping.f90Test results, if applicable
No test results were affected.