1 | /* Minimal declarations for CUDA support. Testing purposes only. */ |
2 | |
3 | #include <stddef.h> |
4 | |
5 | // Make this file work with nvcc, for testing compatibility. |
6 | |
7 | #ifndef __NVCC__ |
8 | #define __constant__ __attribute__((constant)) |
9 | #define __device__ __attribute__((device)) |
10 | #define __global__ __attribute__((global)) |
11 | #define __host__ __attribute__((host)) |
12 | #define __shared__ __attribute__((shared)) |
13 | #define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__))) |
14 | |
15 | struct dim3 { |
16 | unsigned x, y, z; |
17 | __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {} |
18 | }; |
19 | |
20 | typedef struct cudaStream *cudaStream_t; |
21 | typedef enum cudaError {} cudaError_t; |
22 | |
23 | extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize, |
24 | size_t sharedSize = 0, |
25 | cudaStream_t stream = 0); |
26 | extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize, |
27 | size_t sharedSize = 0, |
28 | cudaStream_t stream = 0); |
29 | extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim, |
30 | dim3 blockDim, void **args, |
31 | size_t sharedMem, cudaStream_t stream); |
32 | |
33 | // Host- and device-side placement new overloads. |
34 | void *operator new(__SIZE_TYPE__, void *p) { return p; } |
35 | void *operator new[](__SIZE_TYPE__, void *p) { return p; } |
36 | __device__ void *operator new(__SIZE_TYPE__, void *p) { return p; } |
37 | __device__ void *operator new[](__SIZE_TYPE__, void *p) { return p; } |
38 | |
39 | #endif // !__NVCC__ |
40 | |