pyscf / gpu4pyscf

A plugin to use Nvidia GPU in PySCF package
GNU General Public License v3.0
117 stars 21 forks source link

Limit GPU memory usage? #75

Closed sef43 closed 8 months ago

sef43 commented 8 months ago

Hello,

When running on a GPU that might be doing something else I am sometimes seeing out of memory errors: CUDA Error of GINTint2e_jk_kernel: out of memory

Is it possible to specify a hard limit on the amount of memory used by these kernels?

wxj6000 commented 8 months ago

GPU memory is mostly allocated via CuPy. You can set the memory limit via CuPy if you hope GPU can do something else. https://docs.cupy.dev/en/stable/user_guide/memory.html#limiting-gpu-memory-usage

Although GINT* kernels do not allocate global memory explicitly, those kernels allocate a lot of local memory for high angular momentums. Those local memory are eventually allocated on global memory. So for high angular momentums, you probably still have the 'out of memory' issue.

sef43 commented 8 months ago

thank you for the explanation