MPAS | Memory allocated

1
2
3
4
5
6
7
8
9
10
11
12
Report in log file the total memory allocated for fields by the block creator
This commit adds code to the mpas_block_creator module to track and
report the total number of bytes allocated for fields by the
mpas_block_creator_allocate_pool_fields routine. Allocated bytes are
reported for both the MPI task itself as well as the sum across all MPI
tasks. The report of the number of allocated bytes is written to the log
file, for example:

Allocating fields ...
284 MB allocated for fields on this task
3408 MB total allocated for fields across all tasks
----- done allocating fields -----
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
call mpas_log_write('Allocating fields ...')
allocated_bytes = 0_I8KIND

call mpas_block_creator_allocate_pool_fields(block_ptr % structs, block_ptr % dimensions, allocated_bytes, ierr)
if (ierr /= 0) then
call mpas_log_write('Allocation of fields failed for core ' // trim(block_ptr % domain % core % coreName), MPAS_LOG_CRIT)
end if

call mpas_log_write(' $i MB allocated for fields on this task', intArgs=[int(allocated_bytes / 1000000_I8KIND)])
if (domain % dminfo % nprocs > 1) then
call mpas_dmpar_sum_int(domain % dminfo, int(allocated_bytes / 1000000_I8KIND), total_allocated_mb)
call mpas_log_write(' $i MB total allocated for fields across all tasks', intArgs=[total_allocated_mb])
end if
call mpas_log_write(' ----- done allocating fields -----')
call mpas_log_write('')

MPAS | Memory allocated
https://waipangsze.github.io/2026/10/29/MPAS-Memory-allocated/
Author
wpsze
Posted on
October 29, 2026
Updated on
October 29, 2026
Licensed under