espressomd / espresso

The ESPResSo package
https://espressomd.org
GNU General Public License v3.0
226 stars 183 forks source link

WIP: Add metatensor #4970

Open jhossbach opened 2 months ago

jhossbach commented 2 months ago

Closes #4933

espresso-ci commented 1 month ago

Your pull request does not meet our code documentation rules. The Doxygen documentation generated 2 unique warnings (total: 4, ignored: 2):

src/core/ml_metatensor/system.hpp:
  line 13: Found ';' while parsing initializer list! ()
  line 17: Found ';' while parsing initializer list! ()

You can generate these warnings with make -t; make doxygen; ../maintainer/CI/dox_warnings.sh using the maxset config. This is the same command that I have executed to generate the log above.

RudolfWeeber commented 1 month ago

Progress:

RudolfWeeber commented 1 month ago

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 commented 1 month ago

Forgot two points:

espresso-ci commented 1 month ago

Your pull request does not meet our code formatting rules. To fix this, please do one of the following:

You can run gitlab-runner exec docker style afterwards to check if your changes worked out properly.

Please note that there are often multiple ways to correctly format code. As I am just a robot, I sometimes fail to identify the most aesthetically pleasing way. So please look over my suggested changes and adapt them where the style does not make sense.