Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUDA-accelerated ASE D3 calculator #152

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

dambi3613
Copy link
Contributor

It compiles libpaird3.so using nvcc when installing via pip. If the compilation fails, it is skipped.
If libpaird3.so is available, the D3Calculator can be used.

Could you review a few changes that might be aggressive?

  1. Change 'sevennet_calculator.py' to 'calculator.py'.
  2. Name the fake pair d3 implementation code for the ASE calculator to pair_d3_for_ase.cu and .h (it uses pair_d3_pars.h, which is also shared with pair_d3.cu for LAMMPS).

Additionally, I will reinforce the code related to D3 numerical tests.

@YutackPark
Copy link
Member

YutackPark commented Jan 1, 2025

We need to solve below before merge. High priority comes first.

  • Fallback implementation of CPU when CUDA is not available. It is OK to slow but we need it.
  • Optional d3 install (like pip install .[d3_ase]) or at least should not abort even if nvcc is not found.
  • D3 unit test
  • ASE SumCalculator interface (one line calculator init)

For second, currently I got this error if I didn't source cuda things:

      !!        cmd_obj.run()      CUDA is not installed or nvcc is not available.Skipping compilation of libpaird3.      error: can't copy '/tmp/tmpv1vvfpe9.build-lib/libpaird3.cpython-311-x86_64-linux-gnu.so': doesn't exist or not a regular file      [end of output]                                                                                                                                                                                                                                                                                                                                   note: This error originates from a subprocess, and is likely not a problem with pip.  ERROR: Failed building editable for sevenn                                                                                                                               Failed to build sevennERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (sevenn)

@YutackPark
Copy link
Member

git  clone {SevenNet}
cd SevenNet
pip install .
ls sevenn/

지금 setup.py에 '-o', 'sevenn/libpaird3.so', 로 되어있는데 이러면 패키지 인스톨 시 sevenn/ 아래에 libpaird3.so 를 만들고 site-packages에는 설치를 안함
그래서 클론한 폴더에서 테스트하면 다 찾아지는데 다른 폴더로 이동하면 못 찾아 editable install 안되는 이슈도 같은 이유같음

build_ext 에서 실제 사용하는 방식으로 하지 않고 subprocess.run 으로 구현되어 있어서 그런 것 같은데 대안이

  1. build_ext 가 원래 디자인 된 대로 사용한다
  2. torch 를 이용한다

2번은 torch 내장으로 유저 custom code 컴파일하고 불러오는 기능이 있는데 그걸 활용하는 거고 1번은 나도 좀 찾아봤는데 제대로 된 docs가 없는 것 같더라..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants