From df199e8327cfaeb3b816b64256d886ad2f7b9015 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Wed, 21 Nov 2018 09:38:26 +0000 Subject: [PATCH] Finalising changes to improve reporting of GPU memory usage. --- gprMax/model_build_run.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gprMax/model_build_run.py b/gprMax/model_build_run.py index 01af3913..278056a0 100644 --- a/gprMax/model_build_run.py +++ b/gprMax/model_build_run.py @@ -164,7 +164,10 @@ def run_model(args, currentmodelrun, modelend, numbermodelruns, inputfile, usern G.memory_estimate_basic() G.memory_check() if G.messages: - print('\nTotal memory (RAM) required: ~{}\n'.format(human_size(G.memoryusage))) + if G.gpu is None: + print('\nMemory (RAM) required: ~{}\n'.format(human_size(G.memoryusage))) + else: + print('\nMemory (RAM) required: ~{} host + ~{} GPU\n'.format(human_size(G.memoryusage), human_size(G.memoryusage))) # Initialise an array for volumetric material IDs (solid), boolean # arrays for specifying materials not to be averaged (rigid), @@ -243,7 +246,7 @@ def run_model(args, currentmodelrun, modelend, numbermodelruns, inputfile, usern G.memoryusage += int(3 * Material.maxpoles * (G.nx + 1) * (G.ny + 1) * (G.nz + 1) * np.dtype(complextype).itemsize) G.memory_check() if G.messages: - print('\nTotal memory (RAM) required, updated (dispersive): ~{}\n'.format(human_size(G.memoryusage))) + print('\nMemory (RAM) required - updated (dispersive): ~{}\n'.format(human_size(G.memoryusage))) G.initialise_dispersive_arrays() @@ -256,7 +259,7 @@ def run_model(args, currentmodelrun, modelend, numbermodelruns, inputfile, usern G.memoryusage += int(snapsmemsize) G.memory_check(snapsmemsize=int(snapsmemsize)) if G.messages: - print('\nTotal memory (RAM) required, updated (snapshots): ~{}\n'.format(human_size(G.memoryusage))) + print('\nMemory (RAM) required - updated (snapshots): ~{}\n'.format(human_size(G.memoryusage))) # Process complete list of materials - calculate update coefficients, # store in arrays, and build text list of materials/properties @@ -376,10 +379,9 @@ def run_model(args, currentmodelrun, modelend, numbermodelruns, inputfile, usern if G.messages: if G.gpu is None: - print('Total memory (RAM) used: ~{}'.format(human_size(p.memory_info().rss))) + print('Memory (RAM) used: ~{}'.format(human_size(p.memory_info().rss))) else: - print(human_size(memsolve)) - print('Total memory (RAM) used: ~{}'.format(human_size(p.memory_info().rss + memsolve))) + print('Memory (RAM) used: ~{} host + ~{} GPU'.format(human_size(p.memory_info().rss), human_size(memsolve))) print('Solving time [HH:MM:SS]: {}'.format(datetime.timedelta(seconds=tsolve))) # If geometry information to be reused between model runs then FDTDGrid