From 25ff6b61276dee8f6591a474d7d108882e731c47 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Fri, 5 Aug 2016 16:36:01 +0100 Subject: [PATCH] Updated message printing for RAM. --- gprMax/input_cmds_singleuse.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gprMax/input_cmds_singleuse.py b/gprMax/input_cmds_singleuse.py index f41a59c5..56d6fb18 100644 --- a/gprMax/input_cmds_singleuse.py +++ b/gprMax/input_cmds_singleuse.py @@ -58,7 +58,7 @@ def process_singlecmds(singlecmds, G): if G.messages: print('Model title: {}'.format(G.title)) - # Number of processors to run on (OpenMP) + # Number of threads (OpenMP) to use cmd = '#num_threads' os.environ['OMP_WAIT_POLICY'] = 'ACTIVE' # What to do with threads when they are waiting os.environ['OMP_DYNAMIC'] = 'FALSE' # @@ -115,12 +115,13 @@ def process_singlecmds(singlecmds, G): print('Domain size: {:g} x {:g} x {:g}m ({:d} x {:d} x {:d} = {:g} cells)'.format(tmp[0], tmp[1], tmp[2], G.nx, G.ny, G.nz, (G.nx * G.ny * G.nz))) # Estimate memory (RAM) usage - if G.messages: - # Currently this is a pretty loose estimate but seems to match reasonably with memory usage reported when model completes. - memestimate = (((G.nx + 1) * (G.ny + 1) * (G.nz + 1) * 13 * np.dtype(floattype).itemsize + (G.nx + 1) * (G.ny + 1) * (G.nz + 1) * 18) * 1.1) + 30e6 - print('Memory (RAM) usage: ~{} required, {} available'.format(human_size(memestimate), human_size(psutil.virtual_memory().total))) + # Currently this is a pretty loose estimate but seems to match reasonably with memory usage reported when model completes. + memestimate = (((G.nx + 1) * (G.ny + 1) * (G.nz + 1) * 13 * np.dtype(floattype).itemsize + (G.nx + 1) * (G.ny + 1) * (G.nz + 1) * 18) * 1.1) + 30e6 if memestimate > psutil.virtual_memory().total: raise GeneralError('Estimated memory (RAM) required ~{} exceeds {} available!\n'.format(human_size(memestimate), human_size(psutil.virtual_memory().total))) + if G.messages: + print('Memory (RAM) required: ~{} ({} detected)'.format(human_size(memestimate), human_size(psutil.virtual_memory().total))) + # Time step CFL limit (use either 2D or 3D) and default PML thickness if G.nx == 1: