cudaMallocHost is causing cufftExecC2C to fail?

Hey all,

I’m getting CUFFT failures when I’m trying to use cudaMallocHost, but it doesn’t fail when I use the new and delete operators to allocate memory. Here are the error messages being printed

cufft: ERROR: D:/Bld/rel/gpgpu/toolkit/r2.1/cufft/src/execute.cu, line 1070

cufft: ERROR: CUFFT_EXEC_FAILED

cufft: ERROR: D:/Bld/rel/gpgpu/toolkit/r2.1/cufft/src/execute.cu, line 316

cufft: ERROR: CUFFT_EXEC_FAILED

cufft: ERROR: D:/Bld/rel/gpgpu/toolkit/r2.1/cufft/src/cufft.cu, line 151

cufft: ERROR: CUFFT_EXEC_FAILED

cufftSafeCall() CUFFT error in file <myImageFFT.cu>, line 23.

Here is the main.cpp file I’m using. It’s really simple just to show this error

#include <iostream>

#include <cuda.h>

#include <vector_types.h>

#include "cutil_inline.h"

#define IMAGE_WIDTH  256

#define IMAGE_HEIGHT 256

using namespace std;

extern "C" void myImageFFT(cufftComplex* image, dim3 imageDim);

int main(int argc, char* argv[]) {

	cufftComplex* image = NULL;

	dim3 imageDim(IMAGE_WIDTH, IMAGE_HEIGHT, 0);

	cutilSafeCall(cudaMallocHost((void**)&image, imageDim.x*imageDim.y*sizeof(cufftComplex)));

	myImageFFT(image, imageDim);

	cutilSafeCall(cudaFreeHost(image));

	cutilExit(argc, argv);

}

Finally, here is the myImageFFT.cu file. Also, very simple :)

#include <stdio.h>

#include <cufft.h>

#include <cutil_inline.h>

extern "C" void myImageFFT(cufftComplex* image, dim3 imageDim) {

	// use device with highest Gflops/s

	cudaSetDevice(cutGetMaxGflopsDeviceId());

	cufftComplex* d_Image;

	// allocate space for the image on the device

	cutilSafeCall(cudaMalloc((void**)&d_Image, imageDim.x*imageDim.y*sizeof(cufftComplex)));

	// copy the image from host memory to device memory

	cutilSafeCall(cudaMemcpy(d_Image, image, imageDim.x*imageDim.y*sizeof(cufftComplex), cudaMemcpyHostToDevice));

	// create the fft plan

	cufftHandle fftPlan;

	cufftSafeCall(cufftPlan2d(&fftPlan, imageDim.x, imageDim.y, CUFFT_C2C));

	

	// execute the forward fft

	cufftSafeCall(cufftExecC2C(fftPlan, d_Image, d_Image, CUFFT_FORWARD));

		// clean up memory

	cufftSafeCall(cufftDestroy(fftPlan));

	cutilSafeCall(cudaFree(d_Image));

	cudaThreadExit();

}

I am currently running Windows Vista SP1 32-bit, and I’m using a GeForce 9800 GTX. I’m also using the latest CUDA 2.1 drivers and toolkit. Are you not allowed to call CUDA functions from a .cpp file or something? Thanks for any advice!

-Will

Has anyone encountered this error before? It’s getting pretty annoying…

-Will