Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
from os import path, makedirs
import os, imp, sys, platform, sysconfig

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

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

install_requires=['numpy', 'scipy']
setup_requires=['setuptools_scm', 'scikit-build']
setup_requires=['setuptools_scm', 'scikit-build', 'cmake']

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

dp_pip_install_path, dp_setup_install_path = get_dp_install_path()

setup(
name="deepmd-kit",
Expand All @@ -69,8 +59,6 @@ def get_dp_install_path() :
'-DBUILD_PY_IF:BOOL=TRUE',
'-DBUILD_CPP_IF:BOOL=FALSE',
'-DFLOAT_PREC:STRING=high',
'-DDP_PIP_INSTALL_PATH=%s' % dp_pip_install_path,
'-DDP_SETUP_INSTALL_PATH=%s' % dp_setup_install_path,
],
cmake_source_dir='source',
cmake_minimum_required_version='3.0',
Expand Down
2 changes: 1 addition & 1 deletion source/op/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif (BUILD_CPP_IF)

if (BUILD_PY_IF)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH DESTINATION ${DP_PIP_INSTALL_PATH} ${DP_SETUP_INSTALL_PATH} ${CMAKE_BINARY_DIR}/op/cuda)
set(CMAKE_INSTALL_RPATH $ORIGIN)
if (USE_CUDA_TOOLKIT)
add_library(op_abi SHARED ${OP_PY_CUDA_SRC} ${OP_LIB})
add_library(op_grads SHARED ${OP_GRADS_SRC})
Expand Down
41 changes: 22 additions & 19 deletions source/op/cuda/descrpt_se_a.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ limitations under the License.
typedef float VALUETYPE;
#endif

typedef double compute_t;

typedef unsigned long long int_64;

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

int_64 * key_in = key + idx * MAGIC_NUMBER;

VALUETYPE diff[3];
compute_t diff[3];
const int & j_idx = nei_idx[idy];
for (int dd = 0; dd < 3; dd++) {
diff[dd] = coord[j_idx * 3 + dd] - coord[idx * 3 + dd];
}
VALUETYPE rr = sqrt(dev_dot(diff, diff));
compute_t rr = sqrt(dev_dot(diff, diff));
if (rr <= rcut) {
key_in[idy] = type[j_idx] * 1E15+ (int_64)(rr * 1.0E13) / 100000 * 100000 + j_idx;
}
Expand Down Expand Up @@ -179,18 +181,19 @@ __global__ void format_nlist_fill_b_se_a(int * nlist,
}
//it's ok!

__global__ void compute_descriptor_se_a (VALUETYPE* descript,
template<typename FPTYPE>
__global__ void compute_descriptor_se_a (FPTYPE* descript,
const int ndescrpt,
VALUETYPE* descript_deriv,
FPTYPE* descript_deriv,
const int descript_deriv_size,
VALUETYPE* rij,
FPTYPE* rij,
const int rij_size,
const int* type,
const VALUETYPE* avg,
const VALUETYPE* std,
const FPTYPE* avg,
const FPTYPE* std,
int* nlist,
const int nlist_size,
const VALUETYPE* coord,
const FPTYPE* coord,
const float rmin,
const float rmax,
const int sec_a_size)
Expand All @@ -203,24 +206,24 @@ __global__ void compute_descriptor_se_a (VALUETYPE* descript,
if (idy >= sec_a_size) {return;}

// else {return;}
VALUETYPE * row_descript = descript + idx * ndescrpt;
VALUETYPE * row_descript_deriv = descript_deriv + idx * descript_deriv_size;
VALUETYPE * row_rij = rij + idx * rij_size;
FPTYPE * row_descript = descript + idx * ndescrpt;
FPTYPE * row_descript_deriv = descript_deriv + idx * descript_deriv_size;
FPTYPE * row_rij = rij + idx * rij_size;
int * row_nlist = nlist + idx * nlist_size;

if (row_nlist[idy] >= 0) {
const int & j_idx = row_nlist[idy];
for (int kk = 0; kk < 3; kk++) {
row_rij[idy * 3 + kk] = coord[j_idx * 3 + kk] - coord[idx * 3 + kk];
}
const VALUETYPE * rr = &row_rij[idy * 3 + 0];
VALUETYPE nr2 = dev_dot(rr, rr);
VALUETYPE inr = 1./sqrt(nr2);
VALUETYPE nr = nr2 * inr;
VALUETYPE inr2 = inr * inr;
VALUETYPE inr4 = inr2 * inr2;
VALUETYPE inr3 = inr4 * nr;
VALUETYPE sw, dsw;
const FPTYPE * rr = &row_rij[idy * 3 + 0];
FPTYPE nr2 = dev_dot(rr, rr);
FPTYPE inr = 1./sqrt(nr2);
FPTYPE nr = nr2 * inr;
FPTYPE inr2 = inr * inr;
FPTYPE inr4 = inr2 * inr2;
FPTYPE inr3 = inr4 * nr;
FPTYPE sw, dsw;
spline5_switch(sw, dsw, nr, rmin, rmax);
row_descript[idx_value + 0] = (1./nr) ;//* sw;
row_descript[idx_value + 1] = (rr[0] / nr2) ;//* sw;
Expand Down