mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Add wrapped timed_deplete method for providing process time
Simple wrapper function that passes all arguments to openmc.deplete.integrator.deplete and returns a two-item tuple. The first item is the process time spent depleting all materials (can be on one of many MPI processes). The second item is what is returned directly from the deplete function.
This commit is contained in:
parent
a31e6ced65
commit
2ecca7bff6
1 changed files with 19 additions and 0 deletions
|
|
@ -53,6 +53,25 @@ def deplete(chain, x, rates, dt, print_out=True, matrix_func=None):
|
|||
return x_result
|
||||
|
||||
|
||||
def timed_deplete(*args, **kwargs):
|
||||
"""Wrapper over :func:`deplete` that also returns process time
|
||||
|
||||
All arguments and keyword arguments are passed onto
|
||||
:func:`deplete` directly.
|
||||
|
||||
Returns
|
||||
-------
|
||||
proc_time: float
|
||||
Process time required to return from deplete
|
||||
results: list of numpy arrays
|
||||
Output from :func:`deplete` call
|
||||
"""
|
||||
|
||||
start = time.time()
|
||||
results = deplete(*args, **kwargs)
|
||||
return time.time() - start, results
|
||||
|
||||
|
||||
def _cram_wrapper(chain, n0, rates, dt, matrix_func=None):
|
||||
"""Wraps depletion matrix creation / CRAM solve for multiprocess execution
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue