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

Use int64 to index arrays for Registry pack/unpack routines #1919

Merged

Conversation

deslaughter
Copy link
Collaborator

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 AllOutData matrix 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-registry and all module _Types.f90 files including NWTC_Library_Types.f90 and ModMesh_Mapping.f90

Test results, if applicable

No test results were affected.

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
@deslaughter deslaughter self-assigned this Dec 5, 2023
@deslaughter deslaughter added this to the v4.0.0 milestone Dec 5, 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clever! I like this solution.

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))
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

@andrew-platt andrew-platt merged commit 13e4c61 into OpenFAST:dev-unstable-pointers Dec 6, 2023
21 checks passed
@andrew-platt andrew-platt mentioned this pull request Dec 24, 2024
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants