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

"orog" program seg faults on MACOS #550

Closed
GeorgeGayno-NOAA opened this issue Jul 19, 2021 · 0 comments · Fixed by #545
Closed

"orog" program seg faults on MACOS #550

GeorgeGayno-NOAA opened this issue Jul 19, 2021 · 0 comments · Fixed by #545
Assignees
Labels
bug Something isn't working

Comments

@GeorgeGayno-NOAA
Copy link
Collaborator

When adapting the develop branch of the ufs-srweather-app to the MACOS platform, I found that the orog program would consistently exhibit segmentation faults for unknown reasons with my compiler (GNU 9.4.0 homebrew). We have seen this before for certain older fortran programs using GNU compilers when declaring variables as a size of a variable value in certain instances (e.g. #245). I was able to determine this was occurring during the variable declaration/allocation step in the "TERSUB" subroutine.

Solution:
Given the impressively discombobulated state of that code, I decided it was best to reorganize the variable declaration section, change all variable-sized declared arrays to allocatable arrays, and allocate/deallocate those arrays as needed. This fixed the segmentation fault issue for MACOS, and had the added benefit of reducing the peak memory usage of this program by ~30%!

I also removed some unnecessary looping through indices for the assignment of values in matrices; I expected this would speed up the code but it ended up having no effect. Still is better coding practice so I left those changes in.

@GeorgeGayno-NOAA GeorgeGayno-NOAA added the bug Something isn't working label Jul 19, 2021
GeorgeGayno-NOAA pushed a commit that referenced this issue Jul 23, 2021
Change all variable-sized declared arrays to allocatable arrays, 
and allocate/deallocate those arrays as needed. 

Removed some unnecessary looping through indices for the assignment 
of values in matrices.

Fixes #550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants