comp-phys-marc / hartree-fock

Hartree-fock self-consistent field theory
0 stars 0 forks source link

Unable to allocate memory #1

Open comp-phys-marc opened 7 months ago

comp-phys-marc commented 7 months ago

Getting the following error message whenallocating space for an identity matrix with K=50.

/usr/bin/python3.10 -X pycache_prefix=/home/marcuse/.cache/JetBrains/PyCharm2023.3/cpython-cache /home/marcuse/Downloads/pycharm-professional-2023.3.3.tar/pycharm-2023.3.3/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 33747 --file /home/marcuse/Documents/hartree-fock-main/a4refactor.py 
Connected to pydev debugger (build 233.13763.11)
Traceback (most recent call last):
  File "/home/marcuse/Downloads/pycharm-professional-2023.3.3.tar/pycharm-2023.3.3/plugins/python/helpers/pydev/pydevd.py", line 1534, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/marcuse/Downloads/pycharm-professional-2023.3.3.tar/pycharm-2023.3.3/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/marcuse/Documents/hartree-fock-main/a4refactor.py", line 177, in <module>
    S = np.diag([1 for i in range(K ** 3)]).astype(float)  # We know our basis is diagonal.
  File "<__array_function__ internals>", line 5, in diag
  File "/usr/lib/python3/dist-packages/numpy/lib/twodim_base.py", line 293, in diag
    res = zeros((n, n), v.dtype)
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 116. GiB for an array with shape (125000, 125000) and data type int64
python-BaseException
comp-phys-marc commented 7 months ago

Tried to follow the steps provided here (https://stackoverflow.com/questions/57507832/unable-to-allocate-array-with-shape-and-data-type) in order to allow commitments of large amounts of memory. The attempt is provided below.

(base) marcuse@redblue:~/Documents/hartree-fock-main$ echo 1 > /proc/sys/vm/overcommit_memory
bash: /proc/sys/vm/overcommit_memory: Permission denied
(base) marcuse@redblue:~/Documents/hartree-fock-main$ sudo chmod 775 /proc/sys/vm/overcommit_memory
[sudo] password for marcuse: 
chmod: changing permissions of '/proc/sys/vm/overcommit_memory': Operation not permitted