Updated message printing for RAM.

这个提交包含在:
Craig Warren
2016-08-05 16:36:01 +01:00
父节点 b867cc371d
当前提交 25ff6b6127

查看文件

@@ -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: