1#ifndef __MATH_MATH_KERNEL_H__
2#define __MATH_MATH_KERNEL_H__
50 for (
int i = idx;
i < n;
i +=
str) {
93 const int ly,
const int lz) {
94 const int idx2 = idx - 1;
95 index[3] =
idx2 / (lx * ly * lz);
96 index[2] = (
idx2 - (lx * ly * lz) * index[3]) / (lx * ly);
97 index[1] = (
idx2 - (lx * ly * lz) * index[3] - (lx * ly) * index[2]) / lx;
98 index[0] = (
idx2 - (lx * ly * lz) * index[3] - (lx * ly) * index[2]) -
108 const int n1,
const int n2,
const int nf) {
109 return ((
i) + (n1) * (((
j) - 1) + (n2) * (((
k) - 1) + (
nf) * (((l) - 1))))) - 1;
115template<
typename T >
131 for (
int m = idx; m <
n_mask; m +=
str) {
132 const int f = facet[m + 1];
155template<
typename T >
173template<
typename T >
192#define MASKED_ATOMIC_RED_BLOCK 256
197template<
typename T >
226 key =
mask[
i + 1] - 1;
246 const unsigned long long next =
heads & ~((2ull <<
lane) - 1ull);
257 if (head && key >= 0) {
258 const int s = key -
kbase;
270 if (
sum != (
T) 0.0) {
280template<
typename T >
298template<
typename T >
316template<
typename T >
332template<
typename T >
341 for (
int i = idx;
i < n;
i +=
str) {
349template<
typename T >
357 for (
int i = idx;
i < n;
i +=
str) {
365template<
typename T >
374 for (
int i = idx;
i < n;
i +=
str) {
382template<
typename T >
390 for (
int i = idx;
i < n;
i +=
str) {
398template<
typename T >
407 for (
int i = idx;
i < n;
i +=
str) {
415template<
typename T >
425 for (
int i = idx;
i < n;
i +=
str) {
433template<
typename T >
440 for (
int i = idx;
i < n;
i +=
str) {
448template<
typename T >
457 for (
int i = idx;
i < n;
i +=
str) {
465template<
typename T >
473 for (
int i = idx;
i < n;
i +=
str) {
481template<
typename T >
489 for (
int i = idx;
i < n;
i +=
str) {
497template<
typename T >
505 for (
int i = idx;
i < n;
i +=
str) {
513template<
typename T >
522 for (
int i = idx;
i < n;
i +=
str) {
530template<
typename T >
540 for (
int i = idx;
i < n;
i +=
str) {
541 a[
i] = b[
i] + c[
i] + d[
i];
548template<
typename T >
557 for (
int i = idx;
i < n;
i +=
str) {
565template<
typename T >
576 for (
int i = idx;
i < n;
i+=
str) {
579 tmp += p[
j][
i]*alpha[
j];
588template<
typename T >
597 for (
int i = idx;
i < n;
i +=
str) {
605template<
typename T >
614 for (
int i = idx;
i < n;
i +=
str) {
622template<
typename T >
633 for (
int i = idx;
i < n;
i +=
str) {
641template<
typename T >
654 for (
int i = idx;
i < n;
i +=
str) {
662template<
typename T >
677 for (
int i = idx;
i < n;
i +=
str) {
685template<
typename T >
693 for (
int i = idx;
i < n;
i +=
str) {
701template<
typename T >
709 for (
int i = idx;
i < n;
i +=
str) {
717template<
typename T >
726 for (
int i = idx;
i < n;
i +=
str) {
734template<
typename T >
742 for (
int i = idx;
i < n;
i +=
str) {
750template<
typename T >
759 for (
int i = idx;
i < n;
i +=
str) {
767template<
typename T >
776 for (
int i = idx;
i < n;
i +=
str) {
777 a[
i] =
a[
i] - b[
i] * c[
i];
784template<
typename T >
792 for (
int i = idx;
i < n;
i +=
str) {
800template<
typename T >
809 for (
int i = idx;
i < n;
i +=
str) {
817template<
typename T >
826 for (
int i = idx;
i < n;
i +=
str) {
827 a[
i] =
a[
i] + b[
i] * c[
i];
835template<
typename T >
845 for (
int i = idx;
i < n;
i +=
str) {
846 a[
i] =
a[
i] + b[
i] * c[
i] * d[
i];
854template<
typename T >
864 for (
int i = idx;
i < n;
i +=
str) {
865 a[
i] =
a[
i] + s * b[
i] * c[
i];
873template<
typename T >
886 for (
int i = idx;
i < n;
i +=
str) {
895template<
typename T >
910 for (
int i = idx;
i < n;
i +=
str) {
913 u3[
i] = v1[
i]*w2[
i] - v2[
i]*w1[
i];
928#if NEKO_WAVE_SIZE == 64
944#if NEKO_WAVE_SIZE == 64
960#if NEKO_WAVE_SIZE == 64
974template<
typename T >
980 for (
int i = idx;
i<n ;
i +=
str)
1005template<
typename T >
1011 for (
int i = idx;
i<n ;
i +=
str)
1036template<
typename T >
1042 for (
int i = idx;
i<n ;
i +=
str)
1068template<
typename T_acc >
1079 for (
int i=idx ;
i<n ;
i+=step)
1102template<
typename T >
1117 for (
int i = idx;
i < n;
i+=
str) {
1137template<
typename T,
typename T_acc >
1152 for (
int i = idx;
i < n;
i+=
str) {
1172template<
typename T,
typename T_acc >
1187 for (
int i = idx;
i < n;
i+=
str) {
1213template<
typename T,
typename T_acc >
1227 for (
int i = idx;
i < n;
i+=
str) {
1248template<
typename T,
typename T_acc >
1262 for (
int i = idx;
i < n;
i+=
str) {
1283template<
typename T,
typename T_acc >
1296 for (
int i = idx;
i<n ;
i +=
str)
1318template<
typename T >
1332 for (
int i = idx;
i<n ;
i +=
str)
1355template<
typename T >
1368 for (
int i = idx;
i<n ;
i +=
str)
1390template<
typename T >
1404 for (
int i = idx;
i<n ;
i +=
str)
1426template<
typename T >
1433 for (
int i = idx;
i < n;
i +=
str) {
1445template <
typename T>
1459template <
typename T>
1474template <
typename T>
1487template <
typename T>
1494 for (
int i = idx;
i < n;
i +=
str)
a[
i] =
max(b[
i], c);
1501template <
typename T>
1515template <
typename T>
1530template <
typename T>
1543template <
typename T>
1550 for (
int i = idx;
i < n;
i +=
str)
a[
i] =
min(b[
i], c);
__global__ void ale_add_kinematics_kernel(const int n, T *__restrict__ wx, T *__restrict__ wy, T *__restrict__ wz, const T *__restrict__ x_ref, const T *__restrict__ y_ref, const T *__restrict__ z_ref, const T *__restrict__ phi, const T *__restrict__ x, const T *__restrict__ y, const T *__restrict__ z, const kinematics_params_t kin_params)
__global__ void const T *__restrict__ x
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w3
__global__ void addcol4_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T *__restrict__ d, const int n)
__global__ void cwrap_kernel(T *__restrict__ a, const T min_val, const T max_val, const int n)
__global__ void pwmin_vec3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void reduce_kernel(T *bufred, const int n)
__global__ void cdiv2_kernel(T *__restrict__ a, T *__restrict__ b, const T c, const int n)
__global__ void invcol2_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
__global__ void add2_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
__global__ void add4s3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T *__restrict__ d, const T c1, const T c2, const T c3, const int n)
__inline__ __device__ T reduce_warp(T val)
__global__ void masked_scatter_copy_aligned_kernel(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int n_mask)
__global__ void masked_atomic_reduction_kernel(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int m)
__global__ void pwmax_vec3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void glsc2_kernel(const T *a, const T *b, T_acc *buf_h, const int n)
__global__ void addcol3s2_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T s, const int n)
__global__ void cfill_mask_kernel(T *__restrict__ a, const T c, const int size, int *__restrict__ mask, const int mask_size)
__global__ void cdiv_kernel(T *__restrict__ a, const T c, const int n)
__global__ void masked_copy_kernel_aligned(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int n_mask)
__global__ void face_masked_gather_copy_kernel(T *__restrict__ a, const T *__restrict__ b, const int *__restrict__ mask, const int *__restrict__ facet, const int n1, const int n2, const int lx, const int ly, const int lz, const int n_mask)
__global__ void masked_gather_copy_aligned_kernel(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int n_mask)
__global__ void pwmax_sca2_kernel(T *__restrict__ a, const T c, const int n)
__device__ __forceinline__ void face_gather_nonlinear_index(int *index, const int idx, const int lx, const int ly, const int lz)
__global__ void reduce_max_kernel(T *bufred, const T ninf, const int n)
__global__ void pwmin_vec2_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
__global__ void add3s2_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T c1, const T c2, const int n)
__inline__ __device__ T reduce_max_warp(T val)
__global__ void glsum_kernel(const T *a, T_acc *buf_h, const int n)
__global__ void add2s1_kernel(T *__restrict__ a, const T *__restrict__ b, const T c1, const int n)
__device__ __forceinline__ int face_gather_idx(const int i, const int j, const int k, const int l, const int n1, const int n2, const int nf)
__global__ void add5s4_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T *__restrict__ d, const T *__restrict__ e, const T c1, const T c2, const T c3, const T c4, const int n)
#define MASKED_ATOMIC_RED_BLOCK
__global__ void masked_gather_copy_kernel(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int n_mask)
__global__ void add2s2_many_kernel(T *__restrict__ x, const T **p, const T *alpha, const int p_cur, const int n)
__global__ void glsc3_many_kernel(const T *a, const T **b, const T *c, T_acc *buf_h, const int j, const int n)
__global__ void pwmax_vec2_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
__global__ void cmult_kernel(T *__restrict__ a, const T c, const int n)
__global__ void addcol3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void pwmin_sca3_kernel(T *__restrict__ a, const T *__restrict b, const T c, const int n)
__global__ void pwmax_sca3_kernel(T *__restrict__ a, const T *__restrict b, const T c, const int n)
__global__ void power_kernel(T *__restrict__ ap, const T *__restrict__ a, const T p, const int n)
__global__ void col2_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
__global__ void masked_copy_kernel_0(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int n_mask)
__global__ void sqrt_inplace_kernel(T *__restrict__ a, const int n)
__global__ void col3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void sub2_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
__global__ void glmin_kernel(const T *a, const T pinf, T *buf_h, const int n)
__global__ void cmult2_kernel(T *__restrict__ a, T *__restrict__ b, const T c, const int n)
__global__ void pwmin_sca2_kernel(T *__restrict__ a, const T c, const int n)
__global__ void sub3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void glsubnorm2_kernel(const T *a, const T *b, T_acc *buf_h, const int n)
__global__ void glsc3_reduce_kernel(T_acc *bufred, const int n, const int j)
__global__ void add2s2_kernel(T *__restrict__ a, const T *__restrict__ b, const T c1, const int n)
__global__ void vdot3_kernel(T *__restrict__ dot, const T *__restrict__ u1, const T *__restrict__ u2, const T *__restrict__ u3, const T *__restrict__ v1, const T *__restrict__ v2, const T *__restrict__ v3, const int n)
__global__ void invcol1_kernel(T *__restrict__ a, const int n)
__global__ void add3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void glmax_kernel(const T *a, const T ninf, T *buf_h, const int n)
__global__ void vlsc3_kernel(const T *a, const T *b, const T *c, T *buf_h, const int n)
__global__ void add4_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T *__restrict__ d, const int n)
__global__ void cfill_kernel(T *__restrict__ a, const T c, const int n)
__global__ void masked_scatter_copy_kernel(T *__restrict__ a, T *__restrict__ b, int *__restrict__ mask, const int n, const int n_mask)
__global__ void glsc3_kernel(const T *a, const T *b, const T *c, T_acc *buf_h, const int n)
__global__ void reduce_min_kernel(T *bufred, const T pinf, const int n)
__global__ void vcross_kernel(T *__restrict__ u1, T *__restrict__ u2, T *__restrict__ u3, const T *__restrict__ v1, const T *__restrict__ v2, const T *__restrict__ v3, const T *__restrict__ w1, const T *__restrict__ w2, const T *__restrict__ w3, const int n)
__global__ void addsqr2s2_kernel(T *__restrict__ a, const T *__restrict__ b, const T c1, const int n)
__global__ void cadd2_kernel(T *__restrict__ a, T *__restrict__ b, const T c, const int n)
__global__ void absval_kernel(T *__restrict__ a, const int n)
__global__ void invcol3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void subcol3_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const int n)
__global__ void cadd_kernel(T *__restrict__ a, const T c, const int n)
__global__ void glamax_kernel(const T *a, T *buf_h, const int n)
__inline__ __device__ T reduce_min_warp(T val)
__global__ void copy_kernel(T *__restrict__ a, const T *__restrict__ b, const int n)
Object for handling masks in Neko.