Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Paddle support to Deepmd and Lammps #1699

Open
wants to merge 11 commits into
base: paddle-backup
Choose a base branch
from

Conversation

lidanqing-intel
Copy link

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

…d inference part with lammps/gromacs

Add PaddleDeepPot

add & fix

add pairpaddledeepmd

lmp_compile add paddle_inference

Add PaddleDeepPot and change CMakeLists.txt

not compile ipi

fix compile error

add nlist

finish nlist case

move input tensor to paddle_common

add multi model

fix half

fix

fix 2

fix 3

fix error

fix error2

fix error3

fix error3

fix error

fix error

fix error

finish fixes (multi model issue commented)

fix last compiling issue

fix pair_paddledeepmd issues

updatet

fix

fix error

fix

fix

fix

rename pair files

remove unnecessary files

change some wrong float back to double

remove tf

fix env.sh.in

add custom op, change c++11 to c++14

add pd_infer_custom_op lib

task

fix linking env.sh.in

update

add deeppot UT

CPU native run works in lmp_serial!

remove test_copy folder

update paddle lib path

improve math lib function

add compiling scripts

remove logging

update

update

improve cmake custom ops

fix for training

fix output mapping

update

fix findTF with py and without cpp

Update README.md

remove settig folder
update bash script

add test files

fixed training and inference for same commit sha

remove setting

update model path
@leeleolay
Copy link

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

@njzjz
Copy link
Member

njzjz commented May 16, 2022

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

Please cherry-pick #1409.

@lidanqing-intel
Copy link
Author

lidanqing-intel commented May 18, 2022

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 and others added 3 commits May 18, 2022 16:44
update

Fix default LOW_PREC
Update in.lammps

revise in script

Delete model.pdiparams

Delete model.pdiparams.info

Delete model.pdmodel

Delete .bashrc

test

Delete compile_paddle.sh

Delete compile_lammps.sh

Delete compile_deepmd.sh

Update env.sh.in

Update FindFluid.cmake

revise pd_ops install location

change absolute path to $paddle_root

update

Update .gitmodules

update
@leeleolay
Copy link

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

Copy link
Collaborator

@wanghan-iapcm wanghan-iapcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please do not add large models (example/water/lmp/model.ckpt/model.pdiaparams, example/water/lmp/model.ckpt/model.pdiaparams) to the source code.
  • please do not commit format change of source/CMakeList.txt in this PR.
  • please do not change the mode from 644 to 755 if they are not executable.
  • codes in source/api_cc/src/common.cc are commented out. If they are not needed, please remove them.
  • the high precision floating point format is change from double to float, this may not be necessary. Removing -DHIGH_PREC should work?

@leeleolay
Copy link

@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

#define FLOAT_PREC double
#define FLOAT_PREC float
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type change can be handle by setting the option -DHIGH_PREC

@wanghan-iapcm
Copy link
Collaborator

  • 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

@leeleolay
Copy link

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants