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

chgres_cube crashes with segmentation fault #584

Closed
DusanJovic-NOAA opened this issue Oct 11, 2021 · 5 comments · Fixed by #585
Closed

chgres_cube crashes with segmentation fault #584

DusanJovic-NOAA opened this issue Oct 11, 2021 · 5 comments · Fixed by #585
Assignees
Labels
bug Something isn't working

Comments

@DusanJovic-NOAA
Copy link
Contributor

chgres_cube segfaults in input_data.F90 (line 5495). Here's the backtrace:

[1]
[1] Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
[1]
[1] Backtrace for this error:
[1] #0  0x14afd2d1edfd in ???
[1] #1  0x14afd2d1e013 in ???
[1] #2  0x14afd1ffa3ff in ???
[1] #3  0x508800 in read_input_sfc_grib2_file
[1]     at /home/builder/simple-ufs/src/preproc/sorc/chgres_cube.fd/input_data.F90:5495
[1] #4  0x58b9b8 in __surface_MOD_surface_driver
[1]     at /home/builder/simple-ufs/src/preproc/sorc/chgres_cube.fd/surface.F90:189
[1] #5  0x4b9d87 in chgres
[1]     at /home/builder/simple-ufs/src/preproc/sorc/chgres_cube.fd/chgres.F90:108
[1] #6  0x4b71ac in main
[1]     at /home/builder/simple-ufs/src/preproc/sorc/chgres_cube.fd/chgres.F90:26

slmsk_save array is allocated only on task 0. It must be allocated on all tasks:

diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90
index e3f4b12..ecb65f4 100644
--- a/sorc/chgres_cube.fd/input_data.F90
+++ b/sorc/chgres_cube.fd/input_data.F90
@@ -4797,7 +4797,7 @@ else
    allocate(dummy2d_8(0,0))
    allocate(dummy2d_82(0,0))
    allocate(dummy2d(0,0))
-
+   allocate(slmsk_save(0,0))
  endif
 
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@GeorgeGayno-NOAA
Copy link
Collaborator

@DusanJovic-NOAA Thanks. Will take a look.

@GeorgeGayno-NOAA
Copy link
Collaborator

@DusanJovic-NOAA Which compiler were you using?

@DusanJovic-NOAA
Copy link
Contributor Author

@DusanJovic-NOAA Which compiler were you using?

GNU.

@GeorgeGayno-NOAA GeorgeGayno-NOAA self-assigned this Oct 12, 2021
@GeorgeGayno-NOAA GeorgeGayno-NOAA added the bug Something isn't working label Oct 12, 2021
GeorgeGayno-NOAA added a commit to GeorgeGayno-NOAA/UFS_UTILS that referenced this issue Oct 12, 2021
seg fault. Add deallocation of other variables. Fix
print message.

Fixes ufs-community#584.
@GeorgeGayno-NOAA
Copy link
Collaborator

@DusanJovic-NOAA Try my branch at 7c9cc6b

@DusanJovic-NOAA
Copy link
Contributor Author

Works fine. Thanks.

GeorgeGayno-NOAA added a commit to GeorgeGayno-NOAA/UFS_UTILS that referenced this issue Oct 15, 2021
GeorgeGayno-NOAA added a commit to GeorgeGayno-NOAA/UFS_UTILS that referenced this issue Oct 20, 2021
GeorgeGayno-NOAA added a commit that referenced this issue Oct 21, 2021
Problem happened when using GRIB2 data as input. Variable
'slmsk_save' was not being allocated on all MPI tasks in routine
'read_input_sfc_grib2_file'.

Fixes #584.
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
Development

Successfully merging a pull request may close this issue.

2 participants