def isMemEnoughEigen(D, extraVarsRatio=5):
mem = virtual_memory()
installedMemGB = round( mem.total * 1.0 / (1<<30) )
# 15 is an empirical estimation. when D=30K, it takes around 50GB mem
requiredMemGB = D * D * 4.0 * ( extraVarsRatio + 8 ) / 1000000000
# installed mem is enough
if requiredMemGB <= installedMemGB:
isEnough = 2
# give a warning, will use some paging file and make the computer very slow
elif requiredMemGB <= installedMemGB * 1.2:
isEnough = 1
# not enough
else:
isEnough = 0
return isEnough, installedMemGB, requiredMemGB
评论列表
文章目录