deepmd-kit icon indicating copy to clipboard operation
deepmd-kit copied to clipboard

Add Paddle support to Deepmd and Lammps

Open lidanqing-intel opened this issue 3 years ago • 7 comments

Add PaddleDeepPot and change CMakeLists.txt for Paddle inference lib

Improve Paddle custom ops

fix for training

fix output mapping

fix findTF with py and without cpp

Update README.md

lidanqing-intel avatar May 10 '22 10:05 lidanqing-intel

@njzjz Read the Docs build failed! Coule you help me solve this problem:how to fix this error?

leeleolay avatar May 16 '22 09:05 leeleolay

@njzjz Read the Docs build failed! Coule you help me solve this problem:how to fix this error?

Please cherry-pick #1409.

njzjz avatar May 16 '22 17:05 njzjz

How to compile and run: compile_paddle.sh

cd Paddle
git reset --hard eca6638c599591c69fe40aa196f5fd42db7efbe2
rm -rf build && mkdir build && cd build
cmake .. -DPY_VERSION=3.8 -DPYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -DWITH_GPU=OFF -DWITH_AVX=ON -DON_INFER=ON -DCMAKE_BUILD_TYPE=Release
make -j 32
make -j 32 inference_lib_dist

compile_deepmd.sh

rm -rf /home/deepmdroot/ && mkdir /home/deepmdroot && deepmd_root=/home/deepmdroot
cd /home/deepmd-kit/source && rm -rf build && mkdir build && cd build
cmake -DTENSORFLOW_ROOT=$tensorflow_root -DCMAKE_INSTALL_PREFIX=$deepmd_root -DPADDLE_ROOT=$paddle_root -DUSE_CUDA_TOOLKIT=FALSE -DFLOAT_PREC=low ..
make -j 4 && make install
make lammps

compile_lammps.sh

#apt install libc-dev
cd /home
rm -rf lammps-stable_29Oct2020/
tar -xzvf stable_29Oct2020.tar.gz
cd lammps-stable_29Oct2020/src/
cp -r /home/deepmd-kit/source/build/USER-DEEPMD .
make yes-kspace yes-user-deepmd
#make serial -j 20
make mpi -j 20

lidanqing-intel avatar May 18 '22 16:05 lidanqing-intel

The training and inference results of water are in example/water/train and example/water/lmp , please check and merge codes @amcadmus

leeleolay avatar Aug 26 '22 08:08 leeleolay

@wanghan-iapcm

  1. I have deleted some traning model file and upload the lcurve and log.lammps file.

2.1 the file source/api_cc/src/common.cc is needed, because I only achieve input and output funciton of paddle tensor, other function is needed to keep the whole function of api_cc 2.2 the high precision floating point format is not support by paddle now, I think this -DHIGH_PREC is used by compiling LAMMPS. To assure the correctness of this repo , I limit vector of inference to float. 2.3 I only change the compiling op part when compiling inference part of deepmd in source/CMakeList.txt and delete other compiling setting of source/CMakeList.txt except LAMMPS, because when compiling custom op of inference part , the error can't settled out and the custom ops of paddle version have been compiled during compiling trainging part.

  1. "please do not change the mode from 644 to 755 if they are not executable." I am not sure which one is the file you mentioned here

Thanks for you suggestions

leeleolay avatar Oct 11 '22 04:10 leeleolay

  • the uploaded lcurve.out has 10k lines and log.lammps has 1k lines, I do not think you need such large files for example.
  • You can easily check the mode change of the files on gitbub, plz see the attached screenshot 2022-10-12-090001_775x84_scrot

wanghan-iapcm avatar Oct 12 '22 01:10 wanghan-iapcm

@wanghan-iapcm Due to the precision of op in paddle framework, I need to transfer op of deepmd model into float32 from double 64. What should I do to make it success. Thanks!

leeleolay avatar Nov 11 '22 09:11 leeleolay