mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Output timing results in statepoint files
This commit is contained in:
parent
a6ff94551c
commit
fa3b28f737
4 changed files with 123 additions and 16 deletions
|
|
@ -4,7 +4,7 @@
|
|||
State Point File Format
|
||||
=======================
|
||||
|
||||
The current revision of the statepoint file format is 15.
|
||||
The current revision of the statepoint file format is 16.
|
||||
|
||||
**/filetype** (*char[]*)
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ if run_mode == 'k-eigenvalue':
|
|||
Accumulated sum and sum-of-squares for each global tally. The compound type
|
||||
has fields named ``sum`` and ``sum_sq``.
|
||||
|
||||
**tallies_present** (*int*)
|
||||
**/tallies_present** (*int*)
|
||||
|
||||
Flag indicated if tallies are present in the file.
|
||||
|
||||
|
|
@ -260,3 +260,69 @@ if (run_mode == 'k-eigenvalue' and source_present > 0)
|
|||
``wgt``, ``xyz``, ``uvw``, ``E``, ``g``, and ``delayed_group``, which
|
||||
represent the weight, position, direction, energy, energy group, and
|
||||
delayed_group of the source particle, respectively.
|
||||
|
||||
**/runtime/total initialization** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent reading inputs, allocating
|
||||
arrays, etc.
|
||||
|
||||
**/runtime/reading cross sections** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent loading cross section
|
||||
libraries (this is a subset of initialization).
|
||||
|
||||
**/runtime/simulation** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent between initialization and
|
||||
finalization.
|
||||
|
||||
**/runtime/transport** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent transporting particles.
|
||||
|
||||
**/runtime/inactive batches** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent in the inactive batches
|
||||
(including non-transport activities like communcating sites).
|
||||
|
||||
**/runtime/active batches** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent in the active batches
|
||||
(including non-transport activities like communcating sites).
|
||||
|
||||
**/runtime/synchronizing fission bank** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent sampling source particles
|
||||
from fission sites and communicating them to other processes for load
|
||||
balancing.
|
||||
|
||||
**/runtime/sampling source sites** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent sampling source particles
|
||||
from fission sites.
|
||||
|
||||
**/runtime/SEND-RECV source sites** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent communicating source sites
|
||||
between processes for load balancing.
|
||||
|
||||
**/runtime/accumulating tallies** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent communicating tally results
|
||||
and evaluating their statistics.
|
||||
|
||||
**/runtime/CMFD** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent evaluating CMFD.
|
||||
|
||||
**/runtime/CMFD building matrices** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent buliding CMFD matrices.
|
||||
|
||||
**/runtime/CMFD solving matrices** (*double*)
|
||||
|
||||
Time (in seconds on the master processor) spent solving CMFD matrices.
|
||||
|
||||
**/runtime/total** (*double*)
|
||||
|
||||
Total time spent (in seconds on the master processor) in the program.
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ class StatePoint(object):
|
|||
Working directory for simulation
|
||||
run_mode : str
|
||||
Simulation run mode, e.g. 'k-eigenvalue'
|
||||
runtime : dict
|
||||
Dictionary whose keys are strings describing various runtime metrics
|
||||
and whose values are time values in seconds.
|
||||
seed : Integral
|
||||
Pseudorandom number generator seed
|
||||
source : ndarray of compound datatype
|
||||
|
|
@ -101,13 +104,14 @@ class StatePoint(object):
|
|||
raise IOError('{} is not a statepoint file.'.format(filename))
|
||||
except AttributeError:
|
||||
raise IOError('Could not read statepoint file. This most likely '
|
||||
'means the statepoint file was produced by a different '
|
||||
'version of OpenMC than the one you are using.')
|
||||
if self._f['revision'].value != 15:
|
||||
'means the statepoint file was produced by a '
|
||||
'different version of OpenMC than the one you are '
|
||||
'using.')
|
||||
if self._f['revision'].value != 16:
|
||||
raise IOError('Statepoint file has a file revision of {} '
|
||||
'which is not consistent with the revision this '
|
||||
'version of OpenMC expects ({}).'.format(
|
||||
self._f['revision'].value, 15))
|
||||
self._f['revision'].value, 16))
|
||||
|
||||
# Set flags for what data has been read
|
||||
self._meshes_read = False
|
||||
|
|
@ -311,6 +315,13 @@ class StatePoint(object):
|
|||
def run_mode(self):
|
||||
return self._f['run_mode'].value.decode()
|
||||
|
||||
@property
|
||||
def runtime(self):
|
||||
out = dict()
|
||||
for key in self._f['runtime'].keys():
|
||||
out[key] = self._f['runtime/' + key].value
|
||||
return out
|
||||
|
||||
@property
|
||||
def seed(self):
|
||||
return self._f['seed'].value
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module constants
|
|||
integer, parameter :: VERSION_RELEASE = 1
|
||||
|
||||
! Revision numbers for binary files
|
||||
integer, parameter :: REVISION_STATEPOINT = 15
|
||||
integer, parameter :: REVISION_STATEPOINT = 16
|
||||
integer, parameter :: REVISION_PARTICLE_RESTART = 1
|
||||
integer, parameter :: REVISION_TRACK = 1
|
||||
integer, parameter :: REVISION_SUMMARY = 3
|
||||
|
|
|
|||
|
|
@ -49,10 +49,8 @@ contains
|
|||
integer, allocatable :: id_array(:)
|
||||
integer, allocatable :: key_array(:)
|
||||
integer(HID_T) :: file_id
|
||||
integer(HID_T) :: cmfd_group
|
||||
integer(HID_T) :: tallies_group, tally_group
|
||||
integer(HID_T) :: meshes_group, mesh_group
|
||||
integer(HID_T) :: filter_group
|
||||
integer(HID_T) :: cmfd_group, tallies_group, tally_group, meshes_group, &
|
||||
mesh_group, filter_group, runtime_group
|
||||
character(20), allocatable :: str_array(:)
|
||||
character(MAX_FILE_LEN) :: filename
|
||||
type(RegularMesh), pointer :: meshp
|
||||
|
|
@ -405,13 +403,45 @@ contains
|
|||
end if
|
||||
|
||||
call close_group(tallies_group)
|
||||
|
||||
! Write out the runtime metrics.
|
||||
runtime_group = create_group(file_id, "runtime")
|
||||
call write_dataset(runtime_group, "total initialization", &
|
||||
time_initialize % get_value())
|
||||
call write_dataset(runtime_group, "reading cross sections", &
|
||||
time_read_xs % get_value())
|
||||
call write_dataset(runtime_group, "simulation", &
|
||||
time_inactive % get_value() + time_active % get_value())
|
||||
call write_dataset(runtime_group, "transport", &
|
||||
time_transport % get_value())
|
||||
if (run_mode == MODE_EIGENVALUE) then
|
||||
call write_dataset(runtime_group, "inactive batches", &
|
||||
time_inactive % get_value())
|
||||
end if
|
||||
call write_dataset(runtime_group, "active batches", &
|
||||
time_active % get_value())
|
||||
if (run_mode == MODE_EIGENVALUE) then
|
||||
call write_dataset(runtime_group, "synchronizing fission bank", &
|
||||
time_bank % get_value())
|
||||
call write_dataset(runtime_group, "sampling source sites", &
|
||||
time_bank_sample % get_value())
|
||||
call write_dataset(runtime_group, "SEND-RECV source sites", &
|
||||
time_bank_sendrecv % get_value())
|
||||
end if
|
||||
call write_dataset(runtime_group, "accumulating tallies", &
|
||||
time_tallies % get_value())
|
||||
if (cmfd_run) then
|
||||
call write_dataset(runtime_group, "CMFD", time_cmfd % get_value())
|
||||
call write_dataset(runtime_group, "CMFD building matrices", &
|
||||
time_cmfdbuild % get_value())
|
||||
call write_dataset(runtime_group, "CMFD solving matrices", &
|
||||
time_cmfdsolve % get_value())
|
||||
end if
|
||||
call write_dataset(runtime_group, "total", time_total % get_value())
|
||||
call close_group(runtime_group)
|
||||
|
||||
call file_close(file_id)
|
||||
end if
|
||||
|
||||
if (master .and. n_tallies > 0) then
|
||||
deallocate(id_array)
|
||||
end if
|
||||
|
||||
end subroutine write_state_point
|
||||
|
||||
!===============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue