CUT_DEVICE_RESET, cudaThreadExit - initialization crashes

Hi all,

I have packed two different FFT libraries (CUDA’s cuFFT, Nukada’s nuFFT) in one Matlab MEX file.

To be sure of having all the available GPU memory free to use for my FFTs I want to clean up the device before allocating any memory.

Which I’ve planned to do like this (at the very beginning of the CUDA code just after setting the device):

cuInit(0);

	cudaSetDeviceFlags(cudaDeviceBlockingSync);

	cudaSetDevice(cutGetMaxGflopsDeviceId());				//  use device with highest Gflops/s

	CUT_DEVICE_RESET();

So I assume that the CUT_DEVICE_RESET-command (which is internally redirected to cudaThreadExit in cutil.h) kind of frees the GPUs RAM from unused memory. Is that correct at all?

But now to my problem:

When I execute the CUT_DEVICE_RESET-command and then run one of the two FFT libraries (nuFFT) my application crashes due to some memory error. If I remove this command everything works perfect.

But then if I want to run the CUDA FFT library (cuFFT) it only runs when the CUT_DEVICE_RESET-command has been performed beforehand. Else (without any CUT_DEVICE_RESET-command) the FFT execution (cufftExecC2C(…)) fails!

(So for the moment I’ve put there a switch depending on which of the two libraries I’m using and therefore execute the CUT_DEVICE_RESET-command or not. But that’s definitely not the final solution I want to achieve… External Image )

Any ideas what could be the reason of this strange behaviour?

Thanks for your help in advance!

Fab

BTW: I’m running a GeForce GT330M with Windows 7 on a MacBook Pro

Hi all,

I have packed two different FFT libraries (CUDA’s cuFFT, Nukada’s nuFFT) in one Matlab MEX file.

To be sure of having all the available GPU memory free to use for my FFTs I want to clean up the device before allocating any memory.

Which I’ve planned to do like this (at the very beginning of the CUDA code just after setting the device):

cuInit(0);

	cudaSetDeviceFlags(cudaDeviceBlockingSync);

	cudaSetDevice(cutGetMaxGflopsDeviceId());				//  use device with highest Gflops/s

	CUT_DEVICE_RESET();

So I assume that the CUT_DEVICE_RESET-command (which is internally redirected to cudaThreadExit in cutil.h) kind of frees the GPUs RAM from unused memory. Is that correct at all?

But now to my problem:

When I execute the CUT_DEVICE_RESET-command and then run one of the two FFT libraries (nuFFT) my application crashes due to some memory error. If I remove this command everything works perfect.

But then if I want to run the CUDA FFT library (cuFFT) it only runs when the CUT_DEVICE_RESET-command has been performed beforehand. Else (without any CUT_DEVICE_RESET-command) the FFT execution (cufftExecC2C(…)) fails!

(So for the moment I’ve put there a switch depending on which of the two libraries I’m using and therefore execute the CUT_DEVICE_RESET-command or not. But that’s definitely not the final solution I want to achieve… External Image )

Any ideas what could be the reason of this strange behaviour?

Thanks for your help in advance!

Fab

BTW: I’m running a GeForce GT330M with Windows 7 on a MacBook Pro