// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args // CHECK: #include #include // CHECK: #include #include #include #include #define DATASIZE 8 #define BATCH 2 #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } // CHECK: inline void gpuAssert(hipError_t code, const char *file, int line, bool abort = true) inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort = true) { // CHECK: if (code != hipSuccess) if (code != cudaSuccess) { // CHECK: fprintf(stderr, "GPUassert: %s %s %dn", hipGetErrorString(code), file, line); fprintf(stderr, "GPUassert: %s %s %dn", cudaGetErrorString(code), file, line); if (abort) exit(code); } } int main() { // --- Host side input data allocation and initialization // CHECK: hipfftReal *hostInputData = (hipfftReal*)malloc(DATASIZE*BATCH * sizeof(hipfftReal)); cufftReal *hostInputData = (cufftReal*)malloc(DATASIZE*BATCH * sizeof(cufftReal)); for (int i = 0; iHost copy of the results // CHECK: gpuErrchk(hipMemcpy(hostOutputData, deviceOutputData, (DATASIZE / 2 + 1) * BATCH * sizeof(hipfftComplex), hipMemcpyDeviceToHost)); gpuErrchk(cudaMemcpy(hostOutputData, deviceOutputData, (DATASIZE / 2 + 1) * BATCH * sizeof(cufftComplex), cudaMemcpyDeviceToHost)); for (int i = 0; i