12#if defined(__OFFLOAD) && !defined(__NO_OFFLOAD_NNP)
46static __global__
void nnp_pack_walk_to_pbuf_radial_kernel(
47 const int n_atoms_in_e,
const int max_n_neigh_per_se,
const int s_0based,
48 const int e_0based,
const int max_n_radgrp_walk,
49 const int n_atoms_in_e_max_walk,
const int max_n_neigh_walk,
50 const int istart_1based,
const int *__restrict__ walk_n_rad_pa,
51 const int *__restrict__ walk_rad_ind,
52 const int *__restrict__ walk_rad_image_idx,
53 const int *__restrict__ walk_atoms_global,
54 int *__restrict__ pbuf_n_neigh_pa,
55 int *__restrict__ pbuf_rad_ind_zero_based,
56 int *__restrict__ pbuf_rad_image_idx_zero_based,
57 int *__restrict__ pbuf_atoms_global_zero_based,
58 int *__restrict__ pbuf_atom_map,
59 int *__restrict__ scatter_neigh_ind_one_based) {
60 const int atom = blockIdx.x;
61 const int j = blockIdx.y * blockDim.x + threadIdx.x;
62 if (
atom >= n_atoms_in_e)
66 const long long count_off =
68 (
long long)n_atoms_in_e_max_walk *
69 ((
long long)s_0based +
70 (
long long)max_n_radgrp_walk * (
long long)e_0based);
71 const long long ij_base =
72 (
long long)max_n_neigh_walk *
74 (
long long)n_atoms_in_e_max_walk *
75 ((
long long)s_0based +
76 (
long long)max_n_radgrp_walk * (
long long)e_0based));
78 const int n_neigh = walk_n_rad_pa[count_off];
82 pbuf_n_neigh_pa[
atom] = n_neigh;
83 const int atom_global_1b =
84 walk_atoms_global[
atom + n_atoms_in_e_max_walk * e_0based];
85 pbuf_atoms_global_zero_based[
atom] = atom_global_1b - 1;
86 pbuf_atom_map[
atom] = atom_global_1b - istart_1based;
91 if (j < max_n_neigh_per_se) {
95 j_global_0b = walk_rad_ind[ij_base + j];
96 img_0b = walk_rad_image_idx[ij_base + j];
98 const long long out_off =
99 (
long long)
atom * (
long long)max_n_neigh_per_se + (
long long)j;
101 pbuf_rad_ind_zero_based[out_off] = j_global_0b;
102 pbuf_rad_image_idx_zero_based[out_off] = img_0b;
105 scatter_neigh_ind_one_based[out_off] = j_global_0b + 1;
127static __global__
void
128nnp_pack_se_static_symf_map_kernel(
const int se_idx_in_kind,
const int n_symf,
130 const int *__restrict__ se_symf_packed,
131 const int *__restrict__ se_symf_offsets,
132 int *__restrict__ symf_map_zero_based,
133 int *__restrict__ symf_map_one_based) {
134 const int sf = blockIdx.x * blockDim.x + threadIdx.x;
137 const int off = se_symf_offsets[se_idx_in_kind];
138 const int v_one = se_symf_packed[off + sf];
139 symf_map_zero_based[sf] = v_one - 1 + m_offset;
140 symf_map_one_based[sf] = v_one;
152static __global__
void nnp_pack_walk_to_pbuf_angular_per_atom_kernel(
153 const int n_atoms_in_e,
const int homo,
const int s_0based,
154 const int e_0based,
const int max_n_anggrp_walk,
155 const int n_atoms_in_e_max_walk,
const int istart_1based,
156 const int *__restrict__ walk_n_ang1_pa,
157 const int *__restrict__ walk_n_ang2_pa,
158 const int *__restrict__ walk_atoms_global,
int *__restrict__ pbuf_n_ang1_pa,
159 int *__restrict__ pbuf_n_ang2_pa,
160 int *__restrict__ pbuf_atoms_global_zero_based,
161 int *__restrict__ pbuf_atom_map) {
162 const int atom = blockIdx.x * blockDim.x + threadIdx.x;
163 if (
atom >= n_atoms_in_e)
166 const long long count_off =
168 (
long long)n_atoms_in_e_max_walk *
169 ((
long long)s_0based +
170 (
long long)max_n_anggrp_walk * (
long long)e_0based);
172 const int n1 = walk_n_ang1_pa[count_off];
173 const int n2 = homo ? n1 : walk_n_ang2_pa[count_off];
174 pbuf_n_ang1_pa[
atom] = n1;
175 pbuf_n_ang2_pa[
atom] = n2;
177 const int atom_global_1b =
178 walk_atoms_global[
atom + n_atoms_in_e_max_walk * e_0based];
179 pbuf_atoms_global_zero_based[
atom] = atom_global_1b - 1;
180 pbuf_atom_map[
atom] = atom_global_1b - istart_1based;
195static __global__
void nnp_pack_walk_to_pbuf_angular_per_neigh_kernel(
196 const int n_atoms_in_e,
const int max_n_per_se,
const int s_0based,
197 const int e_0based,
const int max_n_anggrp_walk,
198 const int n_atoms_in_e_max_walk,
const int max_n_neigh_walk,
199 const int ind_offset,
const int *__restrict__ walk_n_pa,
200 const int *__restrict__ walk_ind,
const int *__restrict__ walk_image_idx,
201 int *__restrict__ pbuf_ind,
int *__restrict__ pbuf_image_idx) {
202 const int atom = blockIdx.x;
203 const int j = blockIdx.y * blockDim.x + threadIdx.x;
204 if (
atom >= n_atoms_in_e)
206 if (j >= max_n_per_se)
209 const long long count_off =
211 (
long long)n_atoms_in_e_max_walk *
212 ((
long long)s_0based +
213 (
long long)max_n_anggrp_walk * (
long long)e_0based);
214 const long long ij_base =
215 (
long long)max_n_neigh_walk *
217 (
long long)n_atoms_in_e_max_walk *
218 ((
long long)s_0based +
219 (
long long)max_n_anggrp_walk * (
long long)e_0based));
221 const int n_neigh = walk_n_pa[count_off];
225 j_global_0b = walk_ind[ij_base + j];
226 img_0b = walk_image_idx[ij_base + j];
228 const long long out_off =
229 (
long long)
atom * (
long long)max_n_per_se + (
long long)j;
230 pbuf_ind[out_off] = j_global_0b + ind_offset;
231 pbuf_image_idx[out_off] = img_0b;