2.3. Install from pre-compiled C library TensorFlow PyTorch JAX#

Note

Supported backends: TensorFlow TensorFlow, PyTorch PyTorch, JAX JAX

DeePMD-kit provides pre-compiled C library package (libdeepmd_c.tar.gz) in each release. It can be used to build the LAMMPS plugin and the i-PI driver, as well as many third-party software packages, without building TensorFlow and DeePMD-kit on one’s own. It can be downloaded via the shell command:

wget https://github.com/deepmodeling/deepmd-kit/releases/latest/download/libdeepmd_c.tar.gz
tar xzf libdeepmd_c.tar.gz

The library is built in Linux (GLIBC 2.28) with CUDA 12.9 (libdeepmd_c.tar.gz). It’s noted that this package does not contain CUDA Toolkit, cuDNN, or PyTorch runtime libraries. To use the PyTorch C/C++ backend on Linux, install a libtorch runtime that exactly matches the PyTorch version used to build the package. The PyTorch version must match exactly, while the CUDA variant may be omitted only when the target runtime is compatible. Make the libtorch lib directory discoverable by the dynamic linker, for example by adding it to LD_LIBRARY_PATH. The C library package includes download_libtorch.sh, which downloads and unpacks the matching libtorch runtime and writes libtorch_env.sh:

cd libdeepmd_c
./download_libtorch.sh
. ./libtorch_env.sh

2.3.1. Use Pre-compiled C Library to build the LAMMPS plugin and i-PI driver#

When one installs DeePMD-kit’s C++ interface, one can use the CMake argument DEEPMD_C_ROOT to the path libdeepmd_c.

cd $deepmd_source_dir/source
mkdir build
cd build
cmake -DDEEPMD_C_ROOT=/path/to/libdeepmd_c -DCMAKE_INSTALL_PREFIX=$deepmd_root ..
make -j8
make install

Then the i-PI driver dp_ipi will be built and installed. One can also follow the manual Install LAMMPS. For historical GROMACS context, see the deprecation notice.

DEEPMD_C_ROOT#

Type: Path

Prefix to the pre-compiled C library.