Skip to content

Commit d1fa044

Browse files
LuHan Wang
authored andcommitted
fix bug of 0 output when sec_a.back() is lager than 1024
1 parent ac68881 commit d1fa044

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

source/op/cuda/descrpt_se_a.cu

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ __global__ void compute_descriptor_se_a (VALUETYPE* descript,
208208
const VALUETYPE* coord,
209209
const VALUETYPE rmin,
210210
const VALUETYPE rmax,
211-
compute_t* sel_a_diff_dev)
211+
compute_t* sel_a_diff_dev,
212+
const int sec_a_size)
212213
{
213214
// <<<nloc, sec_a.back()>>>
214-
const unsigned int idx = blockIdx.x;
215-
const unsigned int idy = threadIdx.x;
215+
const unsigned int idx = blockIdx.y;
216+
const unsigned int idy = blockIdx.x * blockDim.x + threadIdx.x;
216217
const int idx_deriv = idy * 4 * 3; // 4 components time 3 directions
217218
const int idx_value = idy * 4; // 4 components
219+
if (idy >= sec_a_size) {return;}
218220

219221
// else {return;}
220222
VALUETYPE * row_descript = descript + idx * ndescrpt;
@@ -355,7 +357,9 @@ void DescrptSeALauncher(const VALUETYPE* coord,
355357
);
356358
}
357359

358-
compute_descriptor_se_a<<<nloc, sec_a.back()>>> (
360+
const int nblock_ = (sec_a.back() + LEN -1) / LEN;
361+
dim3 block_grid(nblock_, nloc);
362+
compute_descriptor_se_a<<<block_grid, LEN>>> (
359363
descript,
360364
ndescrpt,
361365
descript_deriv,
@@ -370,7 +374,8 @@ void DescrptSeALauncher(const VALUETYPE* coord,
370374
coord,
371375
rcut_r_smth,
372376
rcut_r,
373-
sel_a_diff
377+
sel_a_diff,
378+
sec_a.back()
374379
);
375380
////
376381
// res = cudaFree(sec_a_dev); cudaErrcheck(res);

0 commit comments

Comments
 (0)