utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:vmfmix 作者: askerlee 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号