conda create -p 2.2.5/gpu python==3.10.13 tensorflow=2.10.*=gpu*
Note:
- Install tensorflow with conda instead of pip will have less trouble (for example, conda will install the right cudnn for you)
- By default the tensorflow insalled by conda not support gpu, you should use the right package filter.
- tensorflow 2.9 seems to have problem, use 2.10 or above.
mkdir -p 2.2.5/gpu/app
cd 2.2.5/gpu/app
wget url_to_deepmd
wget url_to_lammps
unzip deepmd.zip
tar -xf lammps.tgz
Note:
- Create an
app
dir in conda environment to manage apps.
export _conda_root=/public/groups/ai4ec/libs/conda/dpff/2.2.5/gpu
export app_root=$_conda_root/app
export deepmd_source_dir=$app_root/dpff-v2.2.5-v1.2.1
export tensorflow_root=$deepmd_source_dir/_skbuild/tensorflow_root
export deepmd_root=$deepmd_source_dir/_skbuild/deepmd_root
export LAMMPS_PLUGIN_PATH=$deepmd_root/lib/deepmd_lmp
export LAMMPS_SOURCE_ROOT=$app_root/lammps-stable_23Jun2022_update3
module load cmake/3.21
module load cuda/11.6
module load gcc/9.3 # same of tensorflow
mkdir -p $tensorflow_root
mkdir -p $deepmd_root
mkdir -p $LAMMPS_PLUGIN_PATH
export CC=`which gcc`
export CXX=`which g++`
export FC=`which gfortran`
export LD_LIBRARY_PATH=$_conda_root/lib:$_conda_root/lib/python3.10/site-packages/tensorflow:$deepmd_root/lib:$LD_LIBRARY_PATH
export PATH=$_conda_root/bin:$LAMMPS_SOURCE_ROOT/src:$PATH
Note
- The script above will setup neccessary environment veriable to build deepmd.
- Add conda lib and tensorflow to LD_LIBRARY_PATH or else C++ build will failed.
- You can put the about script in
$conda_root/etc/conda/activate.d/build.sh
, so that whenever you runsource activate
those environment will be set automatically.
module load intel/2021.1
module load anaconda/2022.5
source activate 2.2.5/gpu
cd path_to_deepmd_source_code
export DP_VARIANT=cuda
pip install .
# in deepmd source dir
mkdir source/build
cd source/build
cmake -DLAMMPS_SOURCE_ROOT=$LAMMPS_SOURCE_ROOT -DUSE_TF_PYTHON_LIBS=TRUE -DUSE_CUDA_TOOLKIT=TRUE -DCMAKE_INSTALL_PREFIX=$deepmd_root ..
make -j 20
make install
make lammps
cp USER-DEEPMD $LAMMPS_SOURCE_ROOT/src/
cd $LAMMPS_SOURCE_ROOT/src/
make yes-extra-dump
make yes-extra-fix
make yes-user-deepmd
make yes-kspace
make yes-molecule
make -j 32 intel_cpu_intelmpi