Skip to content

Commit 7da6874

Browse files
committed
fix: memcpy_device_to_host size error
1 parent e58d032 commit 7da6874

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

source/lib/src/gpu/tabulate.cu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,8 @@ __global__ void tabulate_fusion_se_t_tebd_grad_fifth_order_polynomial(
740740
// gridDim.x -> nloc
741741

742742
// Identify which atom and neighbor pair this thread is responsible for.
743-
const int block_idx = blockIdx.x;
744-
const int thread_idx = threadIdx.x;
743+
const int_64 block_idx = blockIdx.x;
744+
const int_64 thread_idx = threadIdx.x;
745745
const int ii = thread_idx / nnei_j;
746746
const int jj = thread_idx % nnei_j;
747747

@@ -800,8 +800,8 @@ __global__ void tabulate_fusion_se_t_tebd_grad_grad_fifth_order_polynomial(
800800
// gridDim.x -> nloc
801801

802802
// Identify which atom and neighbor pair this thread is responsible for.
803-
const int block_idx = blockIdx.x;
804-
const int thread_idx = threadIdx.x;
803+
const int_64 block_idx = blockIdx.x;
804+
const int_64 thread_idx = threadIdx.x;
805805
const int ii = thread_idx / nnei_j;
806806
const int jj = thread_idx % nnei_j;
807807

source/lib/tests/test_tabulate_se_t_tebd.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,7 @@ TEST_F(TestTabulateSeTTebd, tabulate_fusion_se_t_tebd_gpu) {
718718
xyz_scatter_dev, table_dev, &table_info[0], em_x_dev, em_dev, nloc,
719719
nnei_i, nnei_j, last_layer_size);
720720

721-
deepmd::memcpy_device_to_host(&xyz_scatter[0], xyz_scatter_dev,
722-
xyz_scatter.size() * sizeof(double));
721+
deepmd::memcpy_device_to_host(xyz_scatter_dev, xyz_scatter);
723722

724723
deepmd::delete_device_memory(xyz_scatter_dev);
725724
deepmd::delete_device_memory(table_dev);
@@ -750,8 +749,7 @@ TEST_F(TestTabulateSeTTebd, tabulate_fusion_se_t_tebd_grad_gpu) {
750749
dy_dem_x_dev, table_dev, &table_info[0], em_x_dev, em_dev, dy_dev, nloc,
751750
nnei_i, nnei_j, last_layer_size);
752751

753-
deepmd::memcpy_device_to_host(&dy_dem_x[0], dy_dem_x_dev,
754-
dy_dem_x.size() * sizeof(double));
752+
deepmd::memcpy_device_to_host(dy_dem_x_dev, dy_dem_x);
755753

756754
deepmd::delete_device_memory(dy_dem_x_dev);
757755
deepmd::delete_device_memory(table_dev);

0 commit comments

Comments
 (0)