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

WIP: Add metatensor #4970

Open
wants to merge 11 commits into
base: python
Choose a base branch
from
Open

WIP: Add metatensor #4970

wants to merge 11 commits into from

Conversation

jhossbach
Copy link
Contributor

Closes #4933

@jhossbach jhossbach changed the title Add metatensor WIP: Add metatensor Aug 2, 2024
@RudolfWeeber
Copy link
Contributor

Progress:

  • Sketch of the main code for model loading and running with Lammps dependenceis removed. This will not compile. Just skteches. Also, sno Espresso specific code, yet.
  • adding dependnceis in CMake. I failed to ge fetchcontent working. In the end, I built both metatnesor-core and metatensor-torch externally.

@RudolfWeeber
Copy link
Contributor

Notes on building:

Torhc

wget "https://download.pytorch.org/libtorch/cu121/libtorch-cxx11-abi-shared-with-deps-2.4.0%2Bcu121.zip"

unzip libtorch-cxx11-abi-shared-with-deps-2.4.0+cu121.zip 

Note that this is libtorch, not torch propper.
Everything is pre-compiled. Dependencies included. the archive is huge. There is a cpu-only version of this as well, which, hopefully, is small enough to be included in CI.

Intsall rust

I used the rustup script from the rust installatoin page, which installs to ~..cargo.

Source rust config

. ~/.cargo/env

metatensor

git clone from lab-cosmo/metatensor
cd metatensor/metatensor-coe
cmake . -DCMAKE_INSTALL_PREFIX=~/es_mt_deps # or other user-owned target dir
make
make install


## metatensor-torch

cd metatensor/metatensor-torch
cmake . -DTorch_DIR=whereever/libtorch/share/cmake/Torch -dmetatensor_DIR=~/es_mt_deps/lib/cmake/metatensor
make
make install


## Espresso


Some of the following is ICP specific. Main points are torhc and metatensor dirs.

```bash
GCC_VER=12; CUDA_VER=12.0; CC=gcc-${GCC_VER} CXX=g++-${GCC_VER} CUDACXX=/usr/local/cuda-${CUDA_VER}/bin/nvcc CUDAARCHS="61;75;86" cmake ~/es -D ESPRESSO_BUILD_WITH_CUDA=ON -D CUDAToolkit_ROOT=/usr/local/cuda-${CUDA_VER} -D ESPRESSO_BUILD_WITH_CCACHE=ON -D ESPRESSO_BUILD_WITH_WALBERLA=ON -D ESPRESSO_BUILD_WITH_WALBERLA_FFT=ON -D ESPRESSO_BUILD_WITH_WALBERLA_AVX=ON ESPRESSO_BUILD_WITH_HDF5=OFF -D ESPRESSO_BUILD_WITH_GSL=ON -D CMAKE_CUDA_FLAGS="--compiler-bindir=/usr/bin/g++-${GCC_VER}" \
   -DESPRESSO_BUILD_WITH_METATENSOR=on \
   -DTorch_DIR=/ssd/weeber/libtorch/share/cmake/Torch\
   -Dmetatensor_DIR=~/es_mt_deps/lib/cmake/metatensor\
   -Dmetatensor_torch_DIR=~/es_mt_deps/lib/cmake/metatensor_torch

@RudolfWeeber
Copy link
Contributor

Forgot two points:

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.

Implement a Metatensor adaptor
2 participants