Search for Torch cmake config files

This commit is contained in:
Matthias Krack 2025-03-25 14:38:45 +01:00
parent 83fa4600d8
commit d0a89ff766
3 changed files with 8 additions and 4 deletions

View file

@ -767,8 +767,11 @@ if(CP2K_USE_LIBXC)
endif()
if(CP2K_USE_LIBTORCH)
message(" - LIBTORCH\n" # let below line separate
" - libraries: ${CP2K_LIBTORCH_LIBRARIES}\n\n")
message(
" - LIBTORCH\n"
" - extra CXX flags: ${TORCH_CXX_FLAGS} ${TORCH_VERSION}\n"
" - include directories: ${TORCH_INCLUDE_DIRS}\n"
" - libraries: ${TORCH_LIBRARY}\n")
endif()
if(CP2K_USE_HDF5)

View file

@ -93,7 +93,7 @@ RUN ln -sf cp2k.psmp cp2k && \
ln -sf cp2k.psmp cp2k_shell
# Update library search path
RUN echo "/opt/cp2k/lib\n/opt/spack/lib\n/opt/spack/lib/python3.12/site-packages/torch/lib" >/etc/ld.so.conf.d/cp2k.conf && ldconfig
RUN echo "/opt/cp2k/lib\n/opt/spack/lib\n$(dirname $(find /opt/spack/lib -name libtorch.so))" >/etc/ld.so.conf.d/cp2k.conf && ldconfig
# Create entrypoint script file
RUN printf "#!/bin/bash\n\

View file

@ -54,7 +54,8 @@ if [[ "${PROFILE}" == "spack" ]] && [[ "${VERSION}" == "psmp" ]]; then
CMAKE_EXIT_CODE=$?
elif [[ "${PROFILE}" == "spack_all" ]] && [[ "${VERSION}" == "psmp" ]]; then
export Torch_DIR="/opt/spack/lib/python3.12/site-packages/torch/share/cmake/Torch"
Torch_DIR="$(dirname "$(find /opt/spack/lib -name TorchConfig.cmake)")"
export Torch_DIR
cmake \
-GNinja \
-DCMAKE_BUILD_TYPE="Release" \