35 lines
1.4 KiB
C
35 lines
1.4 KiB
C
#pragma once
|
|
|
|
#ifdef __HIP_PLATFORM_AMD__
|
|
#include <hip/hip_runtime.h>
|
|
#include <hip/hip_runtime_api.h>
|
|
#define cudaError_t hipError_t
|
|
#define cudaSuccess hipSuccess
|
|
#define cudaMalloc hipMalloc
|
|
#define cudaFree hipFree
|
|
#define cudaMemcpy hipMemcpy
|
|
#define cudaMemcpyHostToDevice hipMemcpyHostToDevice
|
|
#define cudaMemcpyDeviceToHost hipMemcpyDeviceToHost
|
|
#define cudaDeviceSynchronize hipDeviceSynchronize
|
|
#define cudaGetErrorString hipGetErrorString
|
|
#define cudaGetLastError hipGetLastError
|
|
#define cudaMemGetInfo hipMemGetInfo
|
|
#define cudaDeviceReset hipDeviceReset
|
|
#define __global__ __global__
|
|
#define __device__ __device__
|
|
#define __host__ __host__
|
|
#define __shared__ __shared__
|
|
#define __syncthreads __syncthreads
|
|
#define __forceinline__ __forceinline__
|
|
#define __constant__ __constant__
|
|
#define __align__(x) __attribute__((aligned(x)))
|
|
#define blockIdx hipBlockIdx_x
|
|
#define threadIdx hipThreadIdx_x
|
|
#define blockDim hipBlockDim_x
|
|
#define gridDim hipGridDim_x
|
|
#define hipLaunchKernelGGL(F,GRID,BLOCK,SHMEM,STREAM,...) hipLaunchKernelGGL(F, dim3(GRID), dim3(BLOCK), SHMEM, STREAM, __VA_ARGS__)
|
|
#else
|
|
#include <cuda_runtime.h>
|
|
#include <device_launch_parameters.h>
|
|
#endif
|