cudaMalloc returns cudaSuccess even when it fails


I have a weird issue with cudaMalloc.

I run in emulation mode through a matlab mex script using matlab 2010a, compiling using MS VC++ Express 2008, and the 3.0 toolkit.

When I use cudaMalloc( pDst, pSrc, number ) I get a cudaSuccess. However, I sometimes get a NULL pointer, e.g. if I want 1GB of memory (although my machine has it, and the device properties support up to 4GB if I do querydevice). According to the reference manual, I should get an error. How come I’m not?

This has been asked before I have seen, but I haven’t seen any answers to the problem.

Anything I have missed or is this an emulation thing?

Best regards

Henrik Andresen

Heh, emulation mode does not “emaulate” device. It is some cpu implementation for debugging only. It is not in focus of nvidia support and is planned to be removed.

cudaError_t err;

err = cudaMalloc(…);
if (err != cudaSuccess)

Use ‘ocelot’ instead of device emu… devemu will be deprecated next release. fyi