cudaMalloc causes crash in EmuDebug mode

My .cu file contains

[codebox]bool CopyToDevice(void ** dest, const void* src, unsigned int byteCount)

{

cudaError_t e = cudaMalloc(dest, byteCount); 

e = cudaMemcpy(*dest, src, byteCount, cudaMemcpyHostToDevice); 

CUT_CHECK_ERROR("CopyToDevice");

return true;

}[/codebox]

I am using msvc++ 2008 and cuda beta 3.0 . I can set a breakpoint on the cudaMalloc line, but it gets removed automatically when I start debugging. In Debug mode, the call succeeds but it crashes in EmuDebug!

Any ideas?

Cheers,S

Sven

When running code on the GPU, you can’t yet set breakpoints in .cu files, unfortunately. I’ve read that in device emulation mode, you can set breakpoints, but I’ve never tried that.

What error code is being returned by cudaMalloc?

EmuDebug is device emulation, so the breakpoint setting should work. Indeed it does, even in standard debug mode because this cudaMalloc is executed on the host anyway. The surprising thing is that it works in debug without device emulation but not with it. The error is something like “priorlaunchfail” - I guess I initialize CUDA incorrectly in emudebug mode.