File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 2727
2828"""
2929from __future__ import print_function
30- import os
30+ from psutil import virtual_memory
3131import numpy as np
3232from textwrap import dedent
3333from six .moves import range
@@ -268,18 +268,20 @@ def check_size(self, system_memory_fake_for_testing=None):
268268
269269 """
270270 bytes_per_float_numpy = 8
271- size_coordinates_bytes = self .nx * self .ny * self .nz * 3 * bytes_per_float_numpy
271+ size_coordinates_bytes = self .nx * self .ny * \
272+ self .nz * 3 * bytes_per_float_numpy
272273 size_coordinates_GiB = size_coordinates_bytes / (1024. ** 3 )
273274
274275 if system_memory_fake_for_testing is None :
275- mem_bytes = os .sysconf ('SC_PAGE_SIZE' ) * os .sysconf ('SC_PHYS_PAGES' )
276- mem_GiB = mem_bytes / (1024. ** 3 )
276+ mem = virtual_memory () / (1024.0 ** 3 )
277277 else :
278278 mem_GiB = system_memory_fake_for_testing
279279
280280 if 2 * size_coordinates_GiB > mem_GiB :
281281 # print because no logging yet
282- print ("Warning! Size of mesh coordinates i {} GiB." .format (size_coordinates_GiB ))
283- print ("You have {} GiB system memory. Possible halt." .format (mem_GiB ))
282+ print ("Warning! Size of mesh coordinates i {} GiB." .format (
283+ size_coordinates_GiB ))
284+ print (
285+ "You have {} GiB system memory. Possible halt." .format (mem_GiB ))
284286 return 1
285287 return 0
You can’t perform that action at this time.
0 commit comments