forked from N-BodyShop/changa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EwaldCUDA.h
67 lines (53 loc) · 1.89 KB
/
EwaldCUDA.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef _EWALD_CUDA_H_
#define _EWALD_CUDA_H_
#include "HostCUDA.h"
#define NEWH 80
#define BLOCK_SIZE 128
/** @brief Data for the Ewald h loop in the CUDA kernel
*/
typedef struct {
cudatype hx, hy, hz;
cudatype hCfac, hSfac;
} EwtData;
/** @brief CUDA version of complete MultipoleMoments for Ewald
*/
typedef struct {
#ifndef HEXADECAPOLE
cudatype xx, xy, xz, yy, yz, zz;
#endif
cudatype totalMass;
cudatype cmx, cmy, cmz;
} MultipoleMomentsData;
/** @brief CUDA version of MOMC for Ewald
*/
typedef struct {
cudatype m;
cudatype xx,yy,xy,xz,yz;
cudatype xxx,xyy,xxy,yyy,xxz,yyz,xyz;
cudatype xxxx,xyyy,xxxy,yyyy,xxxz,yyyz,xxyy,xxyz,xyyz;
cudatype zz;
cudatype xzz,yzz,zzz;
cudatype xxzz,xyzz,xzzz,yyzz,yzzz,zzzz;
} MomcData;
/** @brief Parameters and data for Ewald in the CUDA kernel
*/
typedef struct {
MultipoleMomentsData mm;
MomcData momcRoot;
int n, nReps, nEwReps, nEwhLoop;
cudatype L, fEwCut, alpha, alpha2, k1, ka, fEwCut2, fInner2;
} EwaldReadOnlyData;
/// @brief structure to hold information specific to GPU Ewald
typedef struct {
int EwaldRange[2]; /**< First and last particle on the
* GPU; only used for small phase */
int *EwaldMarkers; /**< indices of active particles */
EwtData *ewt; /**< h-loop table */
EwaldReadOnlyData *cachedData; /**< Root moment and other Ewald parameters */
} EwaldData;
void EwaldHostMemorySetup(EwaldData *h_idata, int size, int nEwhLoop, int largephase);
void EwaldHostMemoryFree(EwaldData *h_idata, int largephase);
void EwaldHost(CompactPartData *d_localParts, VariablePartData *d_localVars,
EwaldData *h_idata, cudaStream_t stream, void *cb, int myIndex, int largephase);
__global__ void EwaldKernel(CompactPartData *particleCores, VariablePartData *particleVars, int *markers, int largephase, int First, int Last);
#endif