-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchAPI.h
executable file
·127 lines (77 loc) · 1.99 KB
/
archAPI.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef ARCHAPI_H_
#define ARCHAPI_H_
#include <string.h>
#include "read_particles.h"
#define HOST_TO_DEVICE -131313
#define HOST_TO_HOST -131314
#define DEVICE_TO_HOST -131315
#define DEVICE_TO_DEVICE -131316
#ifdef __CUDACC__
//#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef#ifdef
#define hostdevice_for_CUDA __host__ __device__
#define global_for_CUDA __global__
#endif
#ifndef __CUDACC__
//#ifndef#ifndef#ifndef#ifndef#ifndef#ifndef#ifndef#ifndef#ifndef#ifndef#ifndef
typedef struct
{
double x, y, z;
} double3;
typedef struct
{
int x, y, z;
} int3;
typedef struct
{
unsigned int x, y, z;
} uint3;
struct dim3
{
unsigned int x, y, z;
#if defined(__cplusplus)
dim3(unsigned int vx = 1, unsigned int vy = 1, unsigned int vz = 1) : x(vx), y(vy), z(vz) {}
dim3(uint3 v) : x(v.x), y(v.y), z(v.z) {}
operator uint3(void) { uint3 t; t.x = x; t.y = y; t.z = z; return t; }
#endif /* __cplusplus */
};
typedef struct dim3 dim3;
#define __device__
#define __host__
#define __global__
#define __shared__
#define OMP_NUM_THREADS 100
extern uint3 threadIdx,blockIdx;
#endif
#ifdef __CUDACC__
__device__ void BlockThreadSynchronize();
#else
void BlockThreadSynchronize();
#endif
#ifdef __CUDACC__
#endif
#ifdef __CUDACC__
__device__ double MultiThreadAdd(double *address, double val);
#else
double MultiThreadAdd(double *address, double val);
#endif
const char *getErrorString(int err);
int SetDevice(int n);
#ifdef __CUDACC__
__device__
void AsyncCopy(double *dst,double *src,int n,int size);
#else
void AsyncCopy(double *dst,double *src,int n,int size);
#endif
int MemoryCopy(void* dst,void *src,size_t size,int dir);
int MemoryAllocate(void** dst,size_t size);
int GetDeviceMemory(size_t *m_free,size_t *m_total);
int MemorySet(void *s, int c, size_t n);
int ThreadSynchronize();
#ifdef __CUDACC__
int __device__ DeviceSynchronize();
int getLastError();
#else
int DeviceSynchronize();
int getLastError();
#endif
#endif /* ARCHAPI_H_ */