Author: 徐克 (kickhsu[at]gmail.com)
Author: 卜河凯 (hekai_bu[at]whu.edu.cn)
WeChat Official Account: 微纳计算 (nanocomp)
- Currently only supports orthogonal box systems
- The type list of setting file and potential file must be the same.
- Only potential function files ending with .pb in deepmd are supported, that is, the potential function files of the tensorflow version generated using
dp --tffreeze.
- You must ensure that the new version of DP is installed and can run normally. This program contains DP-related dependencies.
- The installation environment requirements of GPUMD itself must be met.
Use the instance in AutoDL (https://www.autodl.com/) for testing。
If you need testing use AutoDL, please contact us.
And we have created an image in AutoDL that can run GPUMD-DP directly, which can be shared with the account that provides the user ID. Then, you will not require the following process and can be used directly.
Use the latest version of DP installation steps:
>> $ # Copy data and unzip files.
>> $ cd /root/autodl-tmp/
>> $ wget https://mirror.nju.edu.cn/github-release/deepmodeling/deepmd-kit/v3.0.0/deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0 -O deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0
>> $ wget https://mirror.nju.edu.cn/github-release/deepmodeling/deepmd-kit/v3.0.0/deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1 -O deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1
>> $ cat deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0 deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1 > deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh
>> $ # rm deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0 deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1 # Please use with caution "rm"
>> $ sh deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh -p /root/autodl-tmp/deepmd-kit -u # Just keep pressing Enter/yes.
>> $ source /root/autodl-tmp/deepmd-kit/bin/activate /root/autodl-tmp/deepmd-kit
>> $ dp -h
After running according to the above steps, using dp -h can successfully display no errors.
The github link is Here.
>> $ wget https://codeload.github.com/brucefan1983/GPUMD/zip/refs/heads/master
>> $ unzip master
>> $ cd GPUMD-master/src
>> $ export deepmd_source_dir=/root/autodl-tmp/deepmd-kit
>> $ conda deactivate ; conda deactivate
>> $ make -f makefile.dp -j
Type the command which nvcc to make sure NVCC is in the following default path: /usr/local/cuda/bin/nvcc.
>> $ cd ../examples/14-DP/compare_with_lammps
>> $ bash run-test.sh
Create a new conda environment with python and activate it.
>> $ conda create -n tf-gpu2 python=3.9
>> $ conda activate tf-gpu2
Install CMake, CUDA-toolkit and Tensorflow. Please make sure the versions of CUDA-toolkit and Tensorflow is COMPATIBLE. My tensorflow version is 2.18.0.
>> $ pip install --upgrade cmake
>> $ conda install -c conda-forge cudatoolkit=11.8
>> $ pip install --upgrade tensorflow
Download DP source code and compile the source files following DP docs. Here is cmake commands:
>> $ git clone https://github.com/deepmodeling/deepmd-kit.git
>> $ cd deepmd-kit/source
>> $ mkdir build
>> $ cd build
>> $ cmake -DENABLE_TENSORFLOW=TRUE -DUSE_CUDA_TOOLKIT=TRUE -DCMAKE_INSTALL_PREFIX=`path_to_install` -DUSE_TF_PYTHON_LIBS=TRUE ../
>> $ make -j
>> $ make install
We just need DP C++ interface, so we don't source all DP environment. The libraries will be installed in path_to_install.
The github link is Here.
>> $ wget https://codeload.github.com/brucefan1983/GPUMD/zip/refs/heads/master
>> $ unzip master
>> $ cd GPUMD-master/src
>> $ export deepmd_source_dir=/root/miniconda3/deepmd-kit/source/build/path_to_install
Configure the makefile of GPUMD. The DP code is included by macro definition USE_TENSORFLOW. So add it to CFLAGS
CFLAGS = -std=c++14 -O3 $(CUDA_ARCH) -DUSE_TENSORFLOW
Then we need to link the DP C++ libraries. Add this two lines to update the include and link paths and compile GPUMD.
INC += -Ipath_to_install/include/deepmd
LDFLAGS += -Lpath_to_install/lib -ldeepmd_cc
>> $ make -f makefile.dp -j
When run GPUMD, I get an error that could not find libraries of DP. So I need to add it to my library path. I choose a temporary method. Here is the run code:
LD_LIBRARY_PATH=path_to_install/lib:$LD_LIBRARY_PATH
Or you can add the environment to the ~/.bashrc
>> $ sudo echo "export LD_LIBRARY_PATH=/root/miniconda3/deepmd-kit/source/build/path_to_install/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
>> $ source ~/.bashrc
This DP interface need two files: setting file and DP potential file. The first file is very easy, used to make GPUMD know the atom number and types. For example:
dp 2 O H
>> $ cd ../examples/14-DP/compare_with_lammps
>> $ bash run-test.sh
Notice:
- This speed is inaccurate. The actual computing speed can only be reflected when the number of CPU cores is limited to 1.
- The DP potential file is from ref, the download link is: (https://zenodo.org/records/7577034), one can find it from the link(https://github.com/Kick-H/NEP-water/blob/main/GPUMD-DP/)