Skip to content

Instantly share code, notes, and snippets.

@Yi-FanLi
Last active January 10, 2023 19:32
Show Gist options
  • Select an option

  • Save Yi-FanLi/cb79146cb71b71ec94e7811d43daa4e3 to your computer and use it in GitHub Desktop.

Select an option

Save Yi-FanLi/cb79146cb71b71ec94e7811d43daa4e3 to your computer and use it in GitHub Desktop.
## WORKS AS TESTED ON Sep 17, 2022.
conda create -n dpdev python=3.10
conda activate dpdev
export CONDA_OVERRIDE_CUDA=11.6
# install libtensorflow_cc gpu version (Note that only libtensorflow_cc in the deepmodeling channel enables GPU. The libtensorflow_cc library in the conda-forge channel can only be used on GPU.)
conda install -c deepmodeling libtensorflow_cc=*=cuda11*
# install gcc compiler (Note that only pkgs/main works. The conda-forge does not work due to GLIBC version issues. Do not include openmpi-mpicc and openmpi-mpicxx here, or only the cos6 gcc will be installed, and then DeePMD-kitv2.0.3 will not be successfully built. 10/29/2021)
conda install -c pkgs/main gcc_linux-64 gxx_linux-64 gfortran_linux-64 openmpi
# install cudatoolkit-dev (Note that cudatoolkit package does not include an nvcc compiler. To have nvcc installed, cudatoolkit-dev is needed.)
conda install -c conda-forge cudatoolkit-dev cudnn
conda install numpy cmake fftw
conda install -c deepmodeling tensorflow=*=*cuda*
git clone https://github.com/deepmodeling/deepmd-kit.git
git clone https://github.com/lammps/lammps.git
git clone https://github.com/plumed/plumed2.git
cd deepmd-kit
git checkout devel
# install dp python interface
pip install .
# install dp C++ interface
cd source
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DTENSORFLOW_ROOT=$CONDA_PREFIX -DUSE_CUDA_TOOLKIT=true -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX -DLAMMPS_VERSION_NUMBER=20220915
make -j32 install
make lammps
cp -r USER-DEEPMD ../../../lammps/src/DEEPMD
cd ../../../
# install plumed
cd plumed2
./configure --prefix=$CONDA_PREFIX CXX=mpic++ CXXFLAGS="-O3 -Wl,-rpath=$CONDA_PREFIX/lib -Wl,-rpath-link=$CONDA_PREFIX/lib"
make -j 32
make install
cd ../
# install lammps
cd lammps
sed -i '/set(STANDARD_PACKAGES/a\ DEEPMD' cmake/CMakeLists.txt
mkdir build
cd build
cmake ../cmake -DPKG_KSPACE=on -DPKG_REPLICA=on -DPKG_DEEPMD=on -DPKG_MANYBODY=on -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_CXX_FLAGS="-std=c++14 -DHIGH_PREC -I${CONDA_PREFIX}/include -L${CONDA_PREFIX}/lib -Wl,--no-as-needed -lrt -ldeepmd_op -ldeepmd_op_cuda -ldeepmd -ldeepmd_cc -ltensorflow_cc -ltensorflow_framework -Wl,-rpath=${CONDA_PREFIX}/lib -Wl,-rpath-link=${CONDA_PREFIX}/lib -DLAMMPS_VERSION_NUMBER=20220915" -DPKG_PLUMED=on -DPLUMED_MODE=runtime
make -j32 install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment