abinit / abipy

Open-source library for analyzing the results produced by ABINIT
http://abinit.github.io/abipy
Other
117 stars 96 forks source link

MemoryError #190

Closed Aplaus228 closed 4 years ago

Aplaus228 commented 4 years ago

Hello I just started study abinit and abipy and I am going through first base tutorial from abinit and when I wrote ( abiopen.py tbase1_1.out --expose) or something similar to it I will take memory error. I have ubuntu 16.04 LTS also 8 gb RAW memory. (base) vova@bobik:~/Abinit/abinit-8.10.3/tests/tutorial/Input/work$ abiopen.py tbase1_1.out --expose Traceback (most recent call last): File "/home/vova/miniconda3/bin/abiopen.py", line 15, in from abipy import abilab File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/abilab.py", line 43, in from abipy.electrons.ebands import (ElectronBands, ElectronBandsPlotter, ElectronDos, ElectronDosPlotter, File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/electrons/init.py", line 4, in from .gsr import File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/electrons/gsr.py", line 20, in from abipy.tools.tensors import Stress File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/tools/tensors.py", line 9, in from pymatgen.analysis.elasticity.elastic import ElasticTensor # flake8: noqa File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/init.py", line 5, in from .elastic import File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/elastic.py", line 20, in import sympy as sp File "/home/vova/miniconda3/lib/python3.7/site-packages/sympy/init.py", line 19, in import mpmath File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/init.py", line 5, in from .ctx_fp import FPContext File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/ctx_fp.py", line 1, in from .ctx_base import StandardBaseContext File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/ctx_base.py", line 3, in from .libmp.backend import xrange File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/init.py", line 17, in from .libmpc import (mpc_one, mpc_zero, mpc_two, mpc_half, File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/libmpc.py", line 23, in from .libelefun import (\ File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/libelefun.py", line 76, in cache_prec_steps += [min(2k,LOG_TAYLOR_PREC)+20] * 2(k-1) MemoryError (base) vova@bobik:~/Abinit/abinit-8.10.3/tests/tutorial/Input/work$ abiopen.py tbase1_1.out --seaborn Traceback (most recent call last): File "/home/vova/miniconda3/bin/abiopen.py", line 15, in from abipy import abilab File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/abilab.py", line 43, in from abipy.electrons.ebands import (ElectronBands, ElectronBandsPlotter, ElectronDos, ElectronDosPlotter, File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/electrons/init.py", line 4, in from .gsr import File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/electrons/gsr.py", line 20, in from abipy.tools.tensors import Stress File "/home/vova/miniconda3/lib/python3.7/site-packages/abipy/tools/tensors.py", line 9, in from pymatgen.analysis.elasticity.elastic import ElasticTensor # flake8: noqa File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/init.py", line 5, in from .elastic import File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/elastic.py", line 20, in import sympy as sp File "/home/vova/miniconda3/lib/python3.7/site-packages/sympy/init.py", line 19, in import mpmath File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/init.py", line 5, in from .ctx_fp import FPContext File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/ctx_fp.py", line 1, in from .ctx_base import StandardBaseContext File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/ctx_base.py", line 3, in from .libmp.backend import xrange File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/init.py", line 17, in from .libmpc import (mpc_one, mpc_zero, mpc_two, mpc_half, File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/libmpc.py", line 23, in from .libelefun import (\ File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/libelefun.py", line 76, in cache_prec_steps += [min(2k,LOG_TAYLOR_PREC)+20] * 2(k-1) MemoryError

gmatteo commented 4 years ago

The MemoryError is raised inside one of the modules used by sympy thus it's not directly related to AbiPy.

Could you try to increase the stack size with the shell command:

ulimit -s unlimited

and rerun abiopen?

If ulimit does not fix the problem, you may want to remove the sympy import at

File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/elastic.py", line 20, in
import sympy as sp

sympy is not a hard dependencies, only a small part of AbiPy requires this package.

Aplaus228 commented 4 years ago

I did what are you wrote and I have taken another mistake( File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/elastic.py", line 1061, in v_diff = np.vectorize(sp.diff) NameError: name 'sp' is not defined ) I understand that I can delete this line but I think it's not will solve this problem. Thank you

gmatteo commented 4 years ago

Did you try ulimit -s unlimited first?

On Fri, 24 Jan 2020 at 23:00, Aplaus228 notifications@github.com wrote:

I did what are you wrote and I have taken another mistake( File "/home/vova/miniconda3/lib/python3.7/site-packages/pymatgen/analysis/elasticity/elastic.py", line 1061, in v_diff = np.vectorize(sp.diff) NameError: name 'sp' is not defined ) I understand that I can delete this line but I think it's not will solve this problem. Thank you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/abinit/abipy/issues/190?email_source=notifications&email_token=AA5CTI5FWGBMYDXLLZPA7H3Q7NQHZA5CNFSM4KLL5LM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ4HDNY#issuecomment-578318775, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5CTI7WN45HEOOVUMYSUDTQ7NQHZANCNFSM4KLL5LMQ .

Aplaus228 commented 4 years ago

yes, didn't work

gmatteo commented 4 years ago

Ok, try to remove also:

v_diff = np.vectorize(sp.diff)

in the pymatgen package as this statement is executed at the module level:

BTW: Can you print the length of cache_prec_steps and the value of k before this line?

File "/home/vova/miniconda3/lib/python3.7/site-packages/mpmath/libmp/libelefun.py", line 76, in
cache_prec_steps += [min(2k,LOG_TAYLOR_PREC)+20] * 2(k-1)
Aplaus228 commented 4 years ago

I have deleted (v_diff = np.vectorize(sp.diff) this line and all work. Thank you a lot. You are the best. also, the information that you asked. LOG_TAYLOR_PREC = 2500 cache_prec_steps = [22,22] for k in xrange(1, bitcount(LOG_TAYLOR_PREC)+1):