Skip to content

Commit 3dc069b

Browse files
authored
Merge pull request #212 from denghuilu/devel
increase max neighbor size from 256 to 1024
2 parents 2b02556 + 3a38dc4 commit 3dc069b

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

source/lib/src/NNPInter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "SimulationRegion.h"
44
#include <stdexcept>
55

6-
#define MAGIC_NUMBER 256
6+
#define MAGIC_NUMBER 1024
77

88
#ifdef USE_CUDA_TOOLKIT
99
#include "cuda_runtime.h"

source/op/cuda/descrpt_se_a.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License.
1818
#include <cub/block/block_radix_sort.cuh>
1919
#include <cuda_runtime.h>
2020

21-
#define MAGIC_NUMBER 256
21+
#define MAGIC_NUMBER 1024
2222

2323
#ifdef HIGH_PREC
2424
typedef double VALUETYPE;
@@ -326,7 +326,7 @@ void DescrptSeALauncher(const VALUETYPE* coord,
326326
i_idx
327327
);
328328
const int ITEMS_PER_THREAD = 4;
329-
const int BLOCK_THREADS = 64;
329+
const int BLOCK_THREADS = MAGIC_NUMBER / ITEMS_PER_THREAD;
330330
// BlockSortKernel<NeighborInfo, BLOCK_THREADS, ITEMS_PER_THREAD><<<g_grid_size, BLOCK_THREADS>>> (
331331
BlockSortKernel<int_64, BLOCK_THREADS, ITEMS_PER_THREAD> <<<nloc, BLOCK_THREADS>>> (key, key + nloc * MAGIC_NUMBER);
332332

source/op/descrpt_se_a_gpu.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "tensorflow/core/framework/shape_inference.h"
88

99
using namespace tensorflow; // NOLINT(build/namespaces)
10-
#define MAGIC_NUMBER 256
1110

1211
#ifdef HIGH_PREC
1312
typedef double VALUETYPE ;
@@ -159,7 +158,8 @@ class DescrptSeAOp : public OpKernel {
159158

160159
OP_REQUIRES (context, (ntypes == int(sel_a.size())), errors::InvalidArgument ("number of types should match the length of sel array"));
161160
OP_REQUIRES (context, (ntypes == int(sel_r.size())), errors::InvalidArgument ("number of types should match the length of sel array"));
162-
161+
OP_REQUIRES (context, (nnei <= 1024), errors::InvalidArgument ("Assert failed, max neighbor size of atom(nnei) " + std::to_string(nnei) + " is larger than 1024!, which currently is not supported by deepmd-kit."));
162+
163163
// Create output tensors
164164
TensorShape descrpt_shape ;
165165
descrpt_shape.AddDim (nsamples);
@@ -201,7 +201,6 @@ class DescrptSeAOp : public OpKernel {
201201
cudaErrcheck(cudaMemcpy(&(array_longlong), 20 + mesh_tensor.flat<int>().data(), sizeof(unsigned long long *), cudaMemcpyDeviceToHost));
202202
cudaErrcheck(cudaMemcpy(&(array_double), 24 + mesh_tensor.flat<int>().data(), sizeof(compute_t *), cudaMemcpyDeviceToHost));
203203

204-
// cudaErrcheck(cudaMemcpy(jlist, host_jlist, sizeof(int) * nloc * MAGIC_NUMBER, cudaMemcpyHostToDevice));
205204
// Launch computation
206205
for (int II = 0; II < nsamples; II++) {
207206
DescrptSeALauncher(coord_tensor.matrix<VALUETYPE>().data() + II * (nall * 3), // related to the kk argument

source/train/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
configure_file("RunOptions.py.in" "${CMAKE_CURRENT_BINARY_DIR}/RunOptions.py" @ONLY)
44

5-
file(GLOB LIB_PY main.py common.py env.py compat.py calculator.py Network.py Deep*.py Data.py DataSystem.py Model*.py Descrpt*.py Fitting.py Loss.py LearningRate.py Trainer.py TabInter.py EwaldRecp.py DataModifier.py ${CMAKE_CURRENT_BINARY_DIR}/RunOptions.py)
5+
file(GLOB LIB_PY main.py common.py env.py compat.py calculator.py Network.py Deep*.py Data.py DataSystem.py Model*.py Descrpt*.py Fitting.py Loss.py LearningRate.py Trainer.py TabInter.py EwaldRecp.py DataModifier.py ${CMAKE_CURRENT_BINARY_DIR}/RunOptions.py transform.py)
66

77
file(GLOB CLS_PY Local.py Slurm.py)
88

0 commit comments

Comments
 (0)