Skip to content

Commit 62dd83f

Browse files
update .bashrc
update bash script add test files fixed training and inference for same commit sha remove setting update model path
1 parent d93b7e8 commit 62dd83f

15 files changed

+152
-71
lines changed

.bashrc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# .bashrc
2+
3+
# User specific aliases and functions
4+
5+
alias rm='rm -i'
6+
alias cp='cp -i'
7+
alias mv='mv -i'
8+
9+
# Source global definitions
10+
if [ -f /etc/bashrc ]; then
11+
. /etc/bashrc
12+
fi
13+
export http_proxy=http://child-prc.intel.com:913
14+
export https_proxy=http://child-prc.intel.com:913
15+
16+
export PADDLEPADDLE_TP_CACHE="/home/guest/tp_cache"
17+
#export LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/deepmd_kit-1.2.3.dev530+g8d8f289.d20220512-py3.8-linux-x86_64.egg/deepmd/op:$LD_LIBRARY_PATH
18+
#export LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/deepmd_kit-1.2.3.dev530+g8d8f289.d20220512-py3.8-linux-x86_64.egg/deepmd/op:$LIBRARY_PATH
19+
#export DEEP_MD_PATH=/usr/local/lib/python3.8/dist-packages/deepmd_kit-1.2.3.dev530+g8d8f289.d20220512-py3.8-linux-x86_64.egg/deepmd/op
20+
#export LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/deepmd_kit-1.2.3.dev491+g1a06aa4-py3.8-linux-x86_64.egg/deepmd/op:$LD_LIBRARY_PATH
21+
#export LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/deepmd_kit-1.2.3.dev491+g1a06aa4-py3.8-linux-x86_64.egg/deepmd/op:$LIBRARY_PATH
22+
#export DEEP_MD_PATH=/usr/local/lib/python3.8/dist-packages/deepmd_kit-1.2.3.dev491+g1a06aa4-py3.8-linux-x86_64.egg/deepmd/op
23+
#
24+
#1.2.3.dev530+g8d8f289.d20220512
25+
export tensorflow_root=/home/tensorflowroot
26+
export deepmd_root=/home/deepmdroot
27+
# >>> conda initialize >>>
28+
# !! Contents within this block are managed by 'conda init' !!
29+
__conda_setup="$('/root/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
30+
if [ $? -eq 0 ]; then
31+
eval "$__conda_setup"
32+
else
33+
if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then
34+
. "/root/anaconda3/etc/profile.d/conda.sh"
35+
else
36+
export PATH="/root/anaconda3/bin:$PATH"
37+
fi
38+
fi
39+
unset __conda_setup
40+
# <<< conda initialize <<<
41+
export PATH=/home/jessie/cmake-3.21.0-linux-x86_64/bin:$PATH
42+
43+
export PATH=/home/lammps-stable_29Oct2020/src:$PATH
44+
#export LD_LIBRARY_PATH=/home/paddle-deepmd/source/build/lib:$LD_LIBRARY_PATH
45+
export LD_LIBRARY_PATH=/home/deepmd-kit/source/build/lib:$LD_LIBRARY_PATH
46+
export LD_LIBRARY_PATH=/home/Paddle/build/paddle_inference_install_dir/paddle/lib:$LD_LIBRARY_PATH
47+
export LD_LIBRARY_PATH=/home/Paddle/build/paddle_inference_install_dir/third_party/install/mkldnn/lib:$LD_LIBRARY_PATH
48+
export LD_LIBRARY_PATH=/home/Paddle/build/paddle_inference_install_dir/third_party/install/mklml/lib:$LD_LIBRARY_PATH
49+
export LD_LIBRARY_PATH=/home/Paddle/build/paddle/fluid/pybind/:$LD_LIBRARY_PATH
50+
#export LD_LIBRARY_PATH=/home/paddle-deepmd/source/build:$LD_LIBRARY_PATH
51+
export LD_LIBRARY_PATH=/home/deepmd-kit/source/build:$LD_LIBRARY_PATH
52+

compile_deepmd.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
rm -rf /home/deepmdroot/ && mkdir /home/deepmdroot && deepmd_root=/home/deepmdroot
2-
cd /home/paddle-deepmd/source && rm -rf build && mkdir build && cd build
3-
#cmake -DTENSORFLOW_ROOT=$tensorflow_root -DCMAKE_INSTALL_PREFIX=$deepmd_root -DPADDLE_ROOT=/home/Paddle/build/paddle_inference_install_dir -DUSE_CUDA_TOOLKIT=FALSE ..
2+
cd /home/deepmd-kit/source && rm -rf build && mkdir build && cd build
43
cmake -DPADDLE_ROOT=/home/Paddle/build/paddle_inference_install_dir -DUSE_CUDA_TOOLKIT=FALSE ..
54
make -j 4 && make install
65
make lammps

compile_lammps.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ cd /home
33
rm -rf lammps-stable_29Oct2020/
44
tar -xzvf stable_29Oct2020.tar.gz
55
cd lammps-stable_29Oct2020/src/
6-
cp -r /home/paddle-deepmd/source/build/USER-DEEPMD .
6+
cp -r /home/deepmd-kit/source/build/USER-DEEPMD .
7+
#cp -r /home/paddle-deepmd/source/build/USER-DEEPMD .
78
make yes-kspace yes-user-deepmd
8-
make serial -j 20
9+
#make serial -j 20
10+
make mpi -j 20

examples/water/lmp/in.lammps

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# bulk water
2-
2+
echo screen
33
units metal
44
boundary p p p
55
atom_style atomic
@@ -11,7 +11,7 @@ read_data water.lmp
1111
mass 1 16
1212
mass 2 2
1313

14-
pair_style deepmd frozen_model.pb
14+
pair_style deepmd /home/deepmd-kit/examples/water/lmp/model.pdmodel /home/deepmd-kit/examples/water/lmp/model.pdiparams
1515
pair_coeff
1616

1717
velocity all create 330.0 23456789

examples/water/lmp/model.pdiparams

55.5 MB
Binary file not shown.
4.08 KB
Binary file not shown.

examples/water/lmp/model.pdmodel

2.62 MB
Binary file not shown.

source/CMakeLists.txt

Lines changed: 66 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ set(CMAKE_LINK_WHAT_YOU_USE TRUE)
55
# build cpp or python interfaces
66
if (NOT DEFINED BUILD_CPP_IF)
77
set(BUILD_CPP_IF TRUE)
8-
endif (NOT DEFINED BUILD_CPP_IF)
8+
message(WARNING "WARNING! -DON_INFER is set")
9+
add_definitions("-DON_INFER")
10+
endif()
11+
912
if (NOT DEFINED BUILD_PY_IF)
1013
set(BUILD_PY_IF FALSE)
1114
endif (NOT DEFINED BUILD_PY_IF)
@@ -72,72 +75,72 @@ if (USE_CUDA_TOOLKIT)
7275
add_definitions("-D GOOGLE_CUDA")
7376
endif()
7477

75-
# find paddle
78+
if(BUILD_PY_IF)
79+
find_package(tensorflow REQUIRED)
80+
else()
7681
find_package(Fluid REQUIRED)
77-
78-
# find tensorflow, I need tf abi info
79-
if (BUILD_PY_IF)
80-
find_package(tensorflow REQUIRED)
81-
endif (BUILD_PY_IF)
82+
endif()
8283

8384
# find threads
8485
find_package(Threads)
8586

8687
# auto op_cxx_abi
87-
#if (NOT DEFINED OP_CXX_ABI)
88-
# if (BUILD_PY_IF)
89-
# if (DEFINED TENSORFLOW_ROOT)
90-
# set(FIND_ABI_CMD "import sys,os; sys.path.insert(0, os.path.join('${TENSORFLOW_ROOT}', '..')); import tensorflow; print(tensorflow.CXX11_ABI_FLAG if 'CXX11_ABI_FLAG' in tensorflow.__dict__ else tensorflow.sysconfig.CXX11_ABI_FLAG, end = '')" )
91-
# else()
92-
# set(FIND_ABI_CMD "import tensorflow; print(tensorflow.CXX11_ABI_FLAG if 'CXX11_ABI_FLAG' in tensorflow.__dict__ else tensorflow.sysconfig.CXX11_ABI_FLAG, end = '')")
93-
# endif()
94-
# execute_process(
95-
# COMMAND ${PYTHON_EXECUTABLE} "-c" "${FIND_ABI_CMD}"
96-
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
97-
# OUTPUT_VARIABLE PY_CXX_ABI
98-
# RESULT_VARIABLE PY_CXX_ABI_RESULT_VAR
99-
# ERROR_VARIABLE PY_CXX_ABI_ERROR_VAR
100-
# )
101-
# if (NOT ${PY_CXX_ABI_RESULT_VAR} EQUAL 0)
102-
# message(FATAL_ERROR "Cannot determine cxx abi, error message: ${PY_CXX_ABI_ERROR_VAR}")
103-
# endif()
104-
# set(OP_CXX_ABI ${PY_CXX_ABI})
105-
# endif()
106-
# if (BUILD_CPP_IF)
107-
# try_run(
108-
# CPP_CXX_ABI_RUN_RESULT_VAR CPP_CXX_ABI_COMPILE_RESULT_VAR
109-
# ${CMAKE_CURRENT_BINARY_DIR}/tf_cxx_abi
110-
# "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tf_cxx_abi.cpp"
111-
# LINK_LIBRARIES ${TensorFlowFramework_LIBRARY}
112-
# CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${TensorFlow_INCLUDE_DIRS}"
113-
# RUN_OUTPUT_VARIABLE CPP_CXX_ABI
114-
# COMPILE_OUTPUT_VARIABLE CPP_CXX_ABI_COMPILE_OUTPUT_VAR
115-
# )
116-
# if (NOT ${CPP_CXX_ABI_COMPILE_RESULT_VAR})
117-
# message(FATAL_ERROR "Failed to compile: \n ${CPP_CXX_ABI_COMPILE_OUTPUT_VAR}" )
118-
# endif()
119-
# if (NOT ${CPP_CXX_ABI_RUN_RESULT_VAR} EQUAL "0")
120-
# message(FATAL_ERROR "Failed to run, return code: ${CPP_CXX_ABI}" )
121-
# endif()
122-
# if (DEFINED PY_CXX_ABI)
123-
# if (NOT (${CPP_CXX_ABI} EQUAL ${PY_CXX_ABI}))
124-
# message (WARNNING "NOT consistent CXX_ABIs: python interface of tf uses ${PY_CXX_ABI}, while c++ interface of tf uses ${CPP_CXX_ABI}, we follow c++ interface ")
125-
# endif()
126-
# endif()
127-
# set(OP_CXX_ABI ${CPP_CXX_ABI})
128-
# endif()
129-
# message (STATUS "Automatically determined OP_CXX_ABI=${OP_CXX_ABI} ")
130-
#else()
131-
# message (STATUS "User set OP_CXX_ABI=${OP_CXX_ABI} ")
132-
#endif()
133-
# message (STATUS "No set OP_CXX_ABI=${OP_CXX_ABI} ")
134-
# # message the cxx_abi used during compiling
135-
# if (${OP_CXX_ABI} EQUAL 0)
136-
# message (STATUS "Set GLIBCXX_USE_CXX_ABI=0 when compiling ops")
137-
# else ()
138-
# set (OP_CXX_ABI 1)
139-
# message (STATUS "Set GLIBCXX_USE_CXX_ABI=1 when compiling ops")
140-
# endif ()
88+
if (BUILD_PY_IF)
89+
if (NOT DEFINED OP_CXX_ABI)
90+
if (BUILD_PY_IF)
91+
if (DEFINED TENSORFLOW_ROOT)
92+
set(FIND_ABI_CMD "import sys,os; sys.path.insert(0, os.path.join('${TENSORFLOW_ROOT}', '..')); import tensorflow; print(tensorflow.CXX11_ABI_FLAG if 'CXX11_ABI_FLAG' in tensorflow.__dict__ else tensorflow.sysconfig.CXX11_ABI_FLAG, end = '')" )
93+
else()
94+
set(FIND_ABI_CMD "import tensorflow; print(tensorflow.CXX11_ABI_FLAG if 'CXX11_ABI_FLAG' in tensorflow.__dict__ else tensorflow.sysconfig.CXX11_ABI_FLAG, end = '')")
95+
endif()
96+
execute_process(
97+
COMMAND ${PYTHON_EXECUTABLE} "-c" "${FIND_ABI_CMD}"
98+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
99+
OUTPUT_VARIABLE PY_CXX_ABI
100+
RESULT_VARIABLE PY_CXX_ABI_RESULT_VAR
101+
ERROR_VARIABLE PY_CXX_ABI_ERROR_VAR
102+
)
103+
if (NOT ${PY_CXX_ABI_RESULT_VAR} EQUAL 0)
104+
message(FATAL_ERROR "Cannot determine cxx abi, error message: ${PY_CXX_ABI_ERROR_VAR}")
105+
endif()
106+
set(OP_CXX_ABI ${PY_CXX_ABI})
107+
endif()
108+
if (BUILD_CPP_IF)
109+
try_run(
110+
CPP_CXX_ABI_RUN_RESULT_VAR CPP_CXX_ABI_COMPILE_RESULT_VAR
111+
${CMAKE_CURRENT_BINARY_DIR}/tf_cxx_abi
112+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/tf_cxx_abi.cpp"
113+
LINK_LIBRARIES ${TensorFlowFramework_LIBRARY}
114+
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${TensorFlow_INCLUDE_DIRS}"
115+
RUN_OUTPUT_VARIABLE CPP_CXX_ABI
116+
COMPILE_OUTPUT_VARIABLE CPP_CXX_ABI_COMPILE_OUTPUT_VAR
117+
)
118+
if (NOT ${CPP_CXX_ABI_COMPILE_RESULT_VAR})
119+
message(FATAL_ERROR "Failed to compile: \n ${CPP_CXX_ABI_COMPILE_OUTPUT_VAR}" )
120+
endif()
121+
if (NOT ${CPP_CXX_ABI_RUN_RESULT_VAR} EQUAL "0")
122+
message(FATAL_ERROR "Failed to run, return code: ${CPP_CXX_ABI}" )
123+
endif()
124+
if (DEFINED PY_CXX_ABI)
125+
if (NOT (${CPP_CXX_ABI} EQUAL ${PY_CXX_ABI}))
126+
message (WARNNING "NOT consistent CXX_ABIs: python interface of tf uses ${PY_CXX_ABI}, while c++ interface of tf uses ${CPP_CXX_ABI}, we follow c++ interface ")
127+
endif()
128+
endif()
129+
set(OP_CXX_ABI ${CPP_CXX_ABI})
130+
endif()
131+
message (STATUS "Automatically determined OP_CXX_ABI=${OP_CXX_ABI} ")
132+
else()
133+
message (STATUS "User set OP_CXX_ABI=${OP_CXX_ABI} ")
134+
endif()
135+
message (STATUS "No set OP_CXX_ABI=${OP_CXX_ABI} ")
136+
# message the cxx_abi used during compiling
137+
if (${OP_CXX_ABI} EQUAL 0)
138+
message (STATUS "Set GLIBCXX_USE_CXX_ABI=0 when compiling ops")
139+
else ()
140+
set (OP_CXX_ABI 1)
141+
message (STATUS "Set GLIBCXX_USE_CXX_ABI=1 when compiling ops")
142+
endif ()
143+
endif()
141144

142145
# define USE_TTM
143146
if (NOT DEFINED USE_TTM)
@@ -193,7 +196,7 @@ endif (BUILD_CPP_IF)
193196

194197
# include
195198
include_directories(${DeePMD_INCLUDE_DIRS})
196-
#include_directories(${TensorFlow_INCLUDE_DIRS})
199+
include_directories(${TensorFlow_INCLUDE_DIRS})
197200

198201
# define names of libs
199202
set (LIB_DEEPMD "deepmd")
@@ -216,6 +219,7 @@ endif (BUILD_CPP_IF)
216219
# add_subdirectory (op/)
217220
add_subdirectory (lib/)
218221
if (BUILD_PY_IF)
222+
add_subdirectory (op/)
219223
add_subdirectory (config/)
220224
# add_subdirectory (tests/)
221225
endif (BUILD_PY_IF)

source/cmake/FindFluid.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ function(third_party_library TARGET_NAME TARGET_DIRNAME)
127127
set(PADDLE_THIRD_PARTY_LIBRARIES ${PADDLE_THIRD_PARTY_LIBRARIES} ${local_third_party_libraries} PARENT_SCOPE)
128128
endfunction()
129129

130+
if(NOT BUILD_PY_IF)
130131
set(OP_DIR "${PROJECT_SOURCE_DIR}/op/paddle_ops/srcs")
131132
if(USE_CUDA_TOOLKIT)
132133
file(GLOB CUSTOM_OPERATOR_FILES ${OP_DIR}/*.cc)
@@ -135,6 +136,7 @@ else()
135136
# set(CUSTOM_OPERATOR_FILES "${OP_DIR}/pd_prod_env_mat_multi_devices_cpu.cc;${OP_DIR}/pd_prod_force_se_a_multi_devices_cpu.cc;${OP_DIR}/pd_prod_virial_se_a_multi_devices_cpu.cc;")
136137
endif()
137138
add_library(pd_infer_custom_op SHARED ${CUSTOM_OPERATOR_FILES})
139+
endif()
138140

139141
third_party_library(mklml ${THIRD_PARTY_ROOT}/install/mklml/lib libiomp5.so libmklml_intel.so)
140142
third_party_library(mkldnn ${THIRD_PARTY_ROOT}/install/mkldnn/lib libmkldnn.so.0)

source/op/paddle_ops/srcs/pd_prod_env_mat_multi_devices_cpu.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
//#include "paddle/extension.h"
1+
#ifdef ON_INFER
22
#include "paddle/include/experimental/ext_all.h"
3+
#else
4+
#include "paddle/extension.h"
5+
#endif
6+
// #include "paddle/include/experimental/ext_all.h"
37
#include "utilities.h"
48
#include "coord.h"
59
#include "region.h"

0 commit comments

Comments
 (0)