Skip to content

Commit b06ed51

Browse files
sbryngelsonclaude
andcommitted
Fix WP_MOK to use stp instead of wp for main field data I/O
MPI-IO displacement (WP_MOK) must match the storage precision of the data being read/written. Main field variables are written with mpi_io_p (which tracks stp), not mpi_p (which tracks wp). In mixed-precision mode stp = half (2 bytes) while wp = double (8 bytes), so using storage_size(0._wp) gives a 4× wrong displacement. Change all main-data WP_MOK assignments from storage_size(0._wp) to storage_size(0._stp) across all three I/O paths: - src/simulation/m_data_output.fpp (write, two call sites) - src/simulation/m_start_up.fpp (restart read, two call sites) - src/post_process/m_data_input.f90 (post-process read, two call sites) IB marker I/O (MPI_INTEGER, 4 bytes) was already fixed to use storage_size(0)/8 in the previous commit and is not changed here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 50e9df4 commit b06ed51

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/post_process/m_data_input.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impure subroutine s_setup_mpi_io_params(data_size, m_MOK, n_MOK, p_MOK, WP_MOK,
133133
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
134134
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
135135
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
136-
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
136+
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
137137
MOK = int(1._wp, MPI_OFFSET_KIND)
138138
str_MOK = int(name_len, MPI_OFFSET_KIND)
139139
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
@@ -521,7 +521,7 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
521521
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
522522
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
523523
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
524-
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
524+
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
525525
MOK = int(1._wp, MPI_OFFSET_KIND)
526526
str_MOK = int(name_len, MPI_OFFSET_KIND)
527527
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)

src/simulation/m_data_output.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ contains
908908
m_MOK = int(m_glb_save + 1, MPI_OFFSET_KIND)
909909
n_MOK = int(n_glb_save + 1, MPI_OFFSET_KIND)
910910
p_MOK = int(p_glb_save + 1, MPI_OFFSET_KIND)
911-
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
911+
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
912912
MOK = int(1._wp, MPI_OFFSET_KIND)
913913
str_MOK = int(name_len, MPI_OFFSET_KIND)
914914
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
@@ -976,7 +976,7 @@ contains
976976
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
977977
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
978978
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
979-
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
979+
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
980980
MOK = int(1._wp, MPI_OFFSET_KIND)
981981
str_MOK = int(name_len, MPI_OFFSET_KIND)
982982
NVARS_MOK = int(alt_sys, MPI_OFFSET_KIND)

src/simulation/m_start_up.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ contains
575575
m_MOK = int(m_glb_read + 1, MPI_OFFSET_KIND)
576576
n_MOK = int(m_glb_read + 1, MPI_OFFSET_KIND)
577577
p_MOK = int(m_glb_read + 1, MPI_OFFSET_KIND)
578-
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
578+
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
579579
MOK = int(1._wp, MPI_OFFSET_KIND)
580580
str_MOK = int(name_len, MPI_OFFSET_KIND)
581581
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
@@ -652,7 +652,7 @@ contains
652652
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
653653
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
654654
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
655-
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
655+
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
656656
MOK = int(1._wp, MPI_OFFSET_KIND)
657657
str_MOK = int(name_len, MPI_OFFSET_KIND)
658658
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)

0 commit comments

Comments
 (0)