diff options
Diffstat (limited to 'test.cpp')
-rw-r--r-- | test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test.cpp b/test.cpp new file mode 100644 index 000000000000..0c8fbe6074f6 --- /dev/null +++ b/test.cpp @@ -0,0 +1,20 @@ +#include <hip/hip_runtime.h> +#include <cstdio> + +__global__ void vector_add(double *out, double *a, double *b, int n) +{ + size_t index = blockIdx.x * blockDim.x + threadIdx.x; + size_t stride = blockDim.x * gridDim.x; + + for (size_t i = index; i < n; i += stride) + out[i] = a[i] + b[i]; +} + +extern "C" +{ + void launch(dim3* grid, dim3* block, int shmem, hipStream_t stream, double *dout, double *da, double *db, int N) + { + //printf("launching kernel\n"); + hipLaunchKernelGGL((vector_add), *grid, *block, shmem, stream, dout, da, db, N); + } +} |