Astaroth  3.1
Scalable Multi-GPU Stencil Computations
Loading...
Searching...
No Matches
astaroth_device_headers.h
Go to the documentation of this file.
1#pragma once
2#pragma GCC system_header // NOTE: Silences errors originating from CUDA/HIP
3 // headers
4
5#if AC_CPU_BUILD
6
7#include <limits.h>
8#include <stdint.h>
9
10typedef float __half;
11typedef int cudaStream_t;
12typedef int cudaError_t;
13typedef int cudaSharedMemConfig;
14typedef int cudaStream_t;
15typedef int cudaMemcpyKind;
16typedef int cudaEvent_t;
17typedef struct
18{
19 int warpSize;
20 int multiProcessorCount;
21 int maxThreadsPerBlock;
22 int sharedMemPerBlock;
23 const char* name;
24 int major,minor;
25 double clockRate;
26 int singleToDoublePrecisionPerfRatio;
27 int computeMode;
28 int memoryClockRate;
29 int memoryBusWidth;
30 int ECCEnabled;
31 double totalGlobalMem;
32 int localL1CacheSupported;
33 int globalL1CacheSupported;
34 int l2CacheSize;
35 int regsPerBlock;
36 int streamPrioritiesSupported;
37 int maxThreadsDim[3];
39typedef int cudaDeviceAttr;
40#define cudaStreamNonBlocking (0)
41
42#define cudaSharedMemBankSizeEightByte (0)
43
44#define cudaSuccess (0)
45#define cudaFailure (1)
46#define cudaErrorInvalidConfiguration (2)
47#define cudaErrorLaunchOutOfResources (3)
48#define cudaErrorNotReady (4)
49
50#define cudaMemcpyDeviceToHost (0)
51#define cudaMemcpyHostToDevice (1)
52#define cudaMemcpyDeviceToDevice (2)
53#define cudaMemcpyHostToHost (3)
54#define cudaMemcpyDefault (4)
55#define cudaDevAttrCooperativeLaunch (0)
56#define cudaDevAttrClockRate (0)
57#define cudaDevAttrMemoryClockRate (0)
58#define cudaDevAttrSingleToDoublePrecisionPerfRatio (0)
59#define cudaDevAttrComputeMode (0)
60
61#undef __host__
62#define __host__
63#undef __forceinline__
64#define __forceinline__
65#undef __device__
66#define __device__
67#undef __global__
68#define __global__
69#undef __launch_bounds__
70#define __launch_bounds__(x)
71#undef __syncthreads
72#define __syncthreads()
73#undef __shared__
74#define __shared__
75#undef __constant__
76#define __constant__
77
78#define blockIdx ((dim3){0, 0, 0})
79#define blockDim ((dim3){1, 1, 1})
80#define gridDim ((dim3){1, 1, 1})
81#define make_int3(x, y, z) ((int3){x, y, z})
82#define make_float3(x, y, z) ((float3){x, y, z})
83#define make_double3(x, y, z) ((double3){x, y, z})
84#define KERNEL_LAUNCH(func,bpg,tpb,...) \
85 func
86
87#define KERNEL_VBA_LAUNCH(func,bpg,tpb,...) \
88 func
89
90#else
91
92#if AC_USE_HIP
93
94#ifndef __HIP_PLATFORM_HCC__
95#define __HIP_PLATFORM_HCC__
96#endif
97
98#ifndef __HIP_PLATFORM_AMD__
99#define __HIP_PLATFORM_AMD__
100#endif
101#include <hip/hip_fp16.h> // Half-precision floats
102#include <hip/hip_runtime_api.h> // Streams
103
104#include "hip.h"
105#if PROFILING_ENABLED
106#include <roctracer/roctracer_ext.h> // Profiling
107#endif
108#else
109
110#if PROFILING_ENABLED
111#include <cuda_profiler_api.h> // Profiling
112#endif
113#include <cuda_runtime_api.h> // Streams
114#include <cuda_fp16.h> // Half-precision floats
115#endif
116
117#define KERNEL_LAUNCH(func,bpg,tpb,...) \
118 func<<<bpg,tpb,__VA_ARGS__>>>
119
120#define KERNEL_VBA_LAUNCH(func,bpg,tpb,...) \
121 func<<<bpg,tpb,__VA_ARGS__>>>
122
123#endif
124
125#if AC_CPU_BUILD
126#define AC_READ_ONLY_LOAD(expr) expr
127#else
128#define AC_READ_ONLY_LOAD(expr) __ldg(&expr)
129#endif
#define cudaEvent_t
Definition hip.h:34
#define cudaDeviceProp
Definition hip.h:71
#define cudaStream_t
Definition hip.h:25
#define cudaDeviceAttr
Definition hip.h:70
#define cudaMemcpyKind
Definition hip.h:44
#define cudaError_t
Definition hip.h:23
#define cudaSharedMemConfig
Definition hip.h:21