 	cufftExecR2C(handle,  deviceInputData, deviceOutputData);
 
 	// --- Device->Host copy of the results
-	gpuErrchk(cudaMemcpy(hostOutputData, deviceOutputData, (DATASIZE / 2 + 1) * BATCH * sizeof(cufftComplex), cudaMemcpyDeviceToHost));
+	gpuErrchk(cudaMemcpy(hostOutputData, deviceOutputData, (FFTSIZE / 2 + 1) * BATCH * sizeof(cufftComplex), cudaMemcpyDeviceToHost));
 
 	for (int i=0; i<BATCH; i++)
-		for (int j=0; j<(DATASIZE / 2 + 1); j++)
-			printf("%i %i %f %f\n", i, j, hostOutputData[i*(DATASIZE / 2 + 1) + j].x, hostOutputData[i*(DATASIZE / 2 + 1) + j].y);
+		for (int j=0; j<(FFTSIZE / 2 + 1); j++)
+			printf("%i %i %f %f\n", i, j, hostOutputData[i*(FFTSIZE / 2 + 1) + j].x, hostOutputData[i*(FFTSIZE / 2 + 1) + j].y);
 
 	cufftDestroy(handle);
 	gpuErrchk(cudaFree(deviceOutputData));

#include <math.h>
#include <stdlib.h>

#define DATASIZE 8
#define BATCH 2

/********************/


	// --- Device side input data allocation and initialization
	cufftReal *deviceInputData;
	gpuErrchk(cudaMalloc((void**)&deviceInputData, N * BATCH * sizeof(cufftReal)));
	cudaMemcpy(deviceInputData, hostInputData, N * BATCH * sizeof(cufftReal), cudaMemcpyHostToDevice);

	// --- Host side output data allocation
	cufftComplex *hostOutputData = (cufftComplex*)malloc((FFTSIZE / 2 + 1) * BATCH * sizeof(cufftComplex));

	// --- Device side output data allocation
	cufftComplex *deviceOutputData; gpuErrchk(cudaMalloc((void**)&deviceOutputData, (FFTSIZE / 2 + 1) * BATCH * sizeof(cufftComplex)));

	// --- Batched 1D FFTs
	cufftHandle handle;
	int rank = 1;                           // --- 1D FFTs
	int n[] = { FFTSIZE };                 // --- Size of the Fourier transform
	int istride = 1, ostride = 1;           // --- Distance between two successive input/output elements
	int idist = FFTSIZE, odist = (FFTSIZE / 2 + 1); // --- Distance between batches
	int inembed[] = { 0 };                  // --- Input size with pitch (ignored for 1D transforms)
	int onembed[] = { 0 };                  // --- Output size with pitch (ignored for 1D transforms)
	int batch = BATCH;                      // --- Number of batched executions
