Skip to content

Commit d248f8a

Browse files
LuLu
authored andcommitted
fix conflict between master and devel branch
1 parent 7dbe3e0 commit d248f8a

File tree

3 files changed

+24
-33
lines changed

3 files changed

+24
-33
lines changed

setup.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
from os import path, makedirs
77
import os, imp, sys, platform, sysconfig
88

9-
def get_dp_install_path() :
10-
site_packages_path = sysconfig.get_paths()['purelib']
11-
dp_scm_version = get_version(root=".", relative_to=__file__)
12-
python_version = 'py' + str(sys.version_info.major + sys.version_info.minor * 0.1)
13-
os_info = sys.platform
14-
machine_info = platform.machine()
15-
dp_pip_install_path = os.path.join(site_packages_path, 'deepmd')
16-
dp_setup_install_path = os.path.join(site_packages_path, 'deepmd_kit-' + dp_scm_version + '-' + python_version + '-' + os_info + '-' + machine_info + '.egg', 'deepmd')
17-
return dp_pip_install_path, dp_setup_install_path
189

1910
readme_file = path.join(path.dirname(path.abspath(__file__)), 'README.md')
2011
try:
@@ -31,7 +22,7 @@ def get_dp_install_path() :
3122
tf_install_dir = imp.find_module('tensorflow', [site_packages_path])[1]
3223

3324
install_requires=['numpy', 'scipy']
34-
setup_requires=['setuptools_scm', 'scikit-build']
25+
setup_requires=['setuptools_scm', 'scikit-build', 'cmake']
3526

3627
# add cmake as a build requirement if cmake>3.0 is not installed
3728
try:
@@ -45,7 +36,6 @@ def get_dp_install_path() :
4536
except OSError:
4637
pass
4738

48-
dp_pip_install_path, dp_setup_install_path = get_dp_install_path()
4939

5040
setup(
5141
name="deepmd-kit",
@@ -69,8 +59,6 @@ def get_dp_install_path() :
6959
'-DBUILD_PY_IF:BOOL=TRUE',
7060
'-DBUILD_CPP_IF:BOOL=FALSE',
7161
'-DFLOAT_PREC:STRING=high',
72-
'-DDP_PIP_INSTALL_PATH=%s' % dp_pip_install_path,
73-
'-DDP_SETUP_INSTALL_PATH=%s' % dp_setup_install_path,
7462
],
7563
cmake_source_dir='source',
7664
cmake_minimum_required_version='3.0',

source/op/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ endif (BUILD_CPP_IF)
2525

2626
if (BUILD_PY_IF)
2727
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
28-
set(CMAKE_INSTALL_RPATH DESTINATION ${DP_PIP_INSTALL_PATH} ${DP_SETUP_INSTALL_PATH} ${CMAKE_BINARY_DIR}/op/cuda)
28+
set(CMAKE_INSTALL_RPATH $ORIGIN)
2929
if (USE_CUDA_TOOLKIT)
3030
add_library(op_abi SHARED ${OP_PY_CUDA_SRC} ${OP_LIB})
3131
add_library(op_grads SHARED ${OP_GRADS_SRC})

source/op/cuda/descrpt_se_a.cu

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ limitations under the License.
2424
typedef float VALUETYPE;
2525
#endif
2626

27+
typedef double compute_t;
28+
2729
typedef unsigned long long int_64;
2830

2931
#define cudaErrcheck(res) { cudaAssert((res), __FILE__, __LINE__); }
@@ -132,12 +134,12 @@ __global__ void format_nlist_fill_a_se_a(const VALUETYPE * coord,
132134

133135
int_64 * key_in = key + idx * MAGIC_NUMBER;
134136

135-
VALUETYPE diff[3];
137+
compute_t diff[3];
136138
const int & j_idx = nei_idx[idy];
137139
for (int dd = 0; dd < 3; dd++) {
138140
diff[dd] = coord[j_idx * 3 + dd] - coord[idx * 3 + dd];
139141
}
140-
VALUETYPE rr = sqrt(dev_dot(diff, diff));
142+
compute_t rr = sqrt(dev_dot(diff, diff));
141143
if (rr <= rcut) {
142144
key_in[idy] = type[j_idx] * 1E15+ (int_64)(rr * 1.0E13) / 100000 * 100000 + j_idx;
143145
}
@@ -179,18 +181,19 @@ __global__ void format_nlist_fill_b_se_a(int * nlist,
179181
}
180182
//it's ok!
181183

182-
__global__ void compute_descriptor_se_a (VALUETYPE* descript,
184+
template<typename FPTYPE>
185+
__global__ void compute_descriptor_se_a (FPTYPE* descript,
183186
const int ndescrpt,
184-
VALUETYPE* descript_deriv,
187+
FPTYPE* descript_deriv,
185188
const int descript_deriv_size,
186-
VALUETYPE* rij,
189+
FPTYPE* rij,
187190
const int rij_size,
188191
const int* type,
189-
const VALUETYPE* avg,
190-
const VALUETYPE* std,
192+
const FPTYPE* avg,
193+
const FPTYPE* std,
191194
int* nlist,
192195
const int nlist_size,
193-
const VALUETYPE* coord,
196+
const FPTYPE* coord,
194197
const float rmin,
195198
const float rmax,
196199
const int sec_a_size)
@@ -203,24 +206,24 @@ __global__ void compute_descriptor_se_a (VALUETYPE* descript,
203206
if (idy >= sec_a_size) {return;}
204207

205208
// else {return;}
206-
VALUETYPE * row_descript = descript + idx * ndescrpt;
207-
VALUETYPE * row_descript_deriv = descript_deriv + idx * descript_deriv_size;
208-
VALUETYPE * row_rij = rij + idx * rij_size;
209+
FPTYPE * row_descript = descript + idx * ndescrpt;
210+
FPTYPE * row_descript_deriv = descript_deriv + idx * descript_deriv_size;
211+
FPTYPE * row_rij = rij + idx * rij_size;
209212
int * row_nlist = nlist + idx * nlist_size;
210213

211214
if (row_nlist[idy] >= 0) {
212215
const int & j_idx = row_nlist[idy];
213216
for (int kk = 0; kk < 3; kk++) {
214217
row_rij[idy * 3 + kk] = coord[j_idx * 3 + kk] - coord[idx * 3 + kk];
215218
}
216-
const VALUETYPE * rr = &row_rij[idy * 3 + 0];
217-
VALUETYPE nr2 = dev_dot(rr, rr);
218-
VALUETYPE inr = 1./sqrt(nr2);
219-
VALUETYPE nr = nr2 * inr;
220-
VALUETYPE inr2 = inr * inr;
221-
VALUETYPE inr4 = inr2 * inr2;
222-
VALUETYPE inr3 = inr4 * nr;
223-
VALUETYPE sw, dsw;
219+
const FPTYPE * rr = &row_rij[idy * 3 + 0];
220+
FPTYPE nr2 = dev_dot(rr, rr);
221+
FPTYPE inr = 1./sqrt(nr2);
222+
FPTYPE nr = nr2 * inr;
223+
FPTYPE inr2 = inr * inr;
224+
FPTYPE inr4 = inr2 * inr2;
225+
FPTYPE inr3 = inr4 * nr;
226+
FPTYPE sw, dsw;
224227
spline5_switch(sw, dsw, nr, rmin, rmax);
225228
row_descript[idx_value + 0] = (1./nr) ;//* sw;
226229
row_descript[idx_value + 1] = (rr[0] / nr2) ;//* sw;

0 commit comments

Comments
 (0)