Skip to content

Commit 597ff6e

Browse files
sbryngelsonclaude
andcommitted
Fix WP_MOK hardcoded to 8 bytes, use storage_size for precision portability
MPI file offsets assume 8-byte reals. Single-precision builds would read from wrong offsets. Use storage_size(0._wp)/8 instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e36eb61 commit 597ff6e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/post_process/m_data_input.f90

Lines changed: 3 additions & 3 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(8._wp, MPI_OFFSET_KIND)
136+
WP_MOK = int(storage_size(0._wp)/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)
@@ -177,7 +177,7 @@ impure subroutine s_read_ib_data_files(file_loc_base, t_step)
177177
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
178178
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
179179
MOK = int(1._wp, MPI_OFFSET_KIND)
180-
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
180+
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
181181
save_index = t_step/t_step_save ! get the number of saves done to this point
182182

183183
data_size = (m + 1)*(n + 1)*(p + 1)
@@ -517,7 +517,7 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
517517
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
518518
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
519519
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
520-
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
520+
WP_MOK = int(storage_size(0._wp)/8, MPI_OFFSET_KIND)
521521
MOK = int(1._wp, MPI_OFFSET_KIND)
522522
str_MOK = int(name_len, MPI_OFFSET_KIND)
523523
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)

0 commit comments

Comments
 (0)