pyscf / gpu4pyscf

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

CoupledCluster Support #88

Open Shahxad-Akram opened 7 months ago

Shahxad-Akram commented 7 months ago

Should we expect coupled-cluster support any soon?

wxj6000 commented 7 months ago

Good question! I believe there are several in-house implementations of CCSD(T) in different groups. But as far as I know, they either are designed for specific problems or have low speedup against the CPU version. We have no plan to add CCSD(T) in the near future. I label this as a feature request, in case anyone in the community want to contribute.

sunqm commented 7 months ago

If you just need some CC code with GPU for matrix multiplication, I'd recommend copy the code from pyscf.cc module, replacing lib.einsum with cupy.einsum (plus some conversion from numpy array to cupy array). This will give you some speedup, but not 1000x as the mean-field modules. I can upload a RCCSD implementation following the pyscf/cc/ccsd.py later. But for other CC functionalities, GPU memory size is a main restriction. I don't think more CC modules will come soon.

Shahxad-Akram commented 7 months ago

Thank you very much, you both, for your valuable responses. @sunqm I'd really appreciate it if you do this I was just curious about it and indeed I tried before you suggested this. I replaced all Numpy occurrences with Cupy. Luckily it executed without any error but I didn't find any difference and I think it wasn't even using GPU at that time. Now I'll try the trick you mentioned. BTW, thank you again, you guys are doing great work. For DFT using gpu4pyscf is just an awesome experience for me.

wxj6000 commented 7 months ago

If you just need some CC code with GPU for matrix multiplication, I'd recommend copy the code from pyscf.cc module, replacing lib.einsum with cupy.einsum (plus some conversion from numpy array to cupy array). This will give you some speedup, but not 1000x as the mean-field modules. I can upload a RCCSD implementation following the pyscf/cc/ccsd.py later. But for other CC functionalities, GPU memory size is a main restriction. I don't think more CC modules will come soon.

It would be very helpful to discuss other modules such as df ccsd, ccsd_t, and ccsd_rdm with your code.

wxj6000 commented 7 months ago

@shah-xad Qiming has uploaded his CCSD code. https://github.com/pyscf/gpu4pyscf/pull/93