41 ({ __typeof__ (a) _a = (a); \
42 __typeof__ (b) _b = (b); \
47 static bool is_set =
false;
51 cudaFuncAttributeMaxDynamicSharedMemorySize,
77 const int w1 = nu * nu * nv;
78 const int w3 = nv * nv * nv;
79 int work = (w1 >
w3) ? w1 :
w3;
81 work = ((work + 32 - 1) / 32) * 32;
82 if (work > 1024) work = 1024;
83 if (work < 32) work = 32;
91 void *A,
void *Bt,
void *Ct,
int *nel) {
93 const dim3 nblcks(*nel, 1, 1);
99 tnsr3d_kernel<real, N> \
100 <<<nblcks, nthrds, 0, stream>>>((real *) v, *nv, \
102 (real *) A, (real *) Bt, (real *) Ct); \
103 CUDA_CHECK(cudaGetLastError()); \
106#define CASE_LARGE(N) \
108 const size_t shmem_size = 2 * N * N * N * sizeof(real); \
109 set_tnsr3d_large_shmem_attr<N>(shmem_size); \
110 tnsr3d_kernel_large<real, N> \
111 <<<nblcks, nthrds, shmem_size, stream>>>((real *) v, *nv, \
113 (real *) A, (real *) Bt, \
115 CUDA_CHECK(cudaGetLastError()); \
137 fprintf(stderr, __FILE__
": size not supported: %d\n", n);
145 void *A,
void *Bt,
void *Ct,
int * elements,
int* n_points) {
147 const dim3 nblcks(*n_points, 1, 1);
150 int n =
max(*nu,*nv);
153 tnsr3d_el_kernel<real, N> \
154 <<<nblcks, nthrds, 0, stream>>>((real *) v, *nv, \
156 (real *) A, (real *) Bt, (real *) Ct, \
157 (int *) elements, *n_points); \
158 CUDA_CHECK(cudaGetLastError()); \
177 fprintf(stderr, __FILE__
": size not supported: %d\n", n);
__global__ void const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__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 tnsr3d_kernel_large(T *__restrict__ v, const int nv, const T *__restrict__ u, const int nu, const T *__restrict__ A, const T *__restrict__ Bt, const T *__restrict__ Ct)
void cuda_tnsr3d(void *v, int *nv, void *u, int *nu, void *A, void *Bt, void *Ct, int *nel)
void cuda_tnsr3d_el_list(void *v, int *nv, void *u, int *nu, void *A, void *Bt, void *Ct, int *elements, int *n_points)
static int cuda_tnsr3d_nthrds(const int nu, const int nv)
static void set_tnsr3d_large_shmem_attr(const size_t shmem_size)