CP2K-2024-1 compialtion with libtorch

169 views
Skip to first unread message

Guilherme da Silva

unread,
Feb 22, 2024, 7:13:50 PM2/22/24
to cp2k
Hi folks,

Hope everything is fine at your site.

I am trying to perform the compilation on an ubuntu 22.04.

I compiled the code many times, there is only one library i didnt manage to make it work and it was libtorch.

I tried a few different way:

1. following the instructions using the static download - here we have a problem. the static download doesnt have the cuda.h headers since it is prebuilt for cpu-only use. Because of that compilation fails in:

/src/torch_c_api.cpp:10:10: fatal error: 'torch/csrc/api/include/torch/cuda.h' file not found

2. Then i tried to modified the version of the prebuilt with one gpu-compatible. It also fails with the same error.

Thus, i was thinking there might me some linking problems or headers addresses.

So i tried 3. compile libtorch from scratch. Although i managed to do the compilation, i couldnt find a way to correct point for all the headers.

The only way i manage to advance in the compilation was to manually edit each header it complains about not finding another header. Well... given the amount of header i need to edit i gave up?

Since i have no experience with libtorch whatsoever, i am probably doing something wrong.

Could someone please give me some directions on how to compile cp2k-2024-1 with libtorch?

Thank you in advance!


Guilherme da Silva

unread,
Mar 14, 2024, 8:48:46 AM3/14/24
to cp2k
Some updates I got with the issue.

I tried to ask toolchain to compile the gcc-compiler and this seems to have solved the problem:

./install_cp2k_toolchain.sh --with-gcc=install --with-spglib=no --with-cosma=no --with-libxsmm=no --with-libvori=no --with-libxc=no --with-plumed=no --with-sirius=no --with-libint=no --with-fftw=no --with-libvdwxc=no --with-gsl=no --with-elpa=no --with-libtorch --with-intel=no --with-intelmpi=no

It was an ubuntu 22.04 and the care that I really needed to take was to be sure inteloneapi suite was not loaded. From here I will try to compile with more features to see if everything works.
Reply all
Reply to author
Forward
0 new messages