cudaMemalloc

:rolleyes:
Hi I’m KiWook Son student of Hanyang university in Korea.
I study CUDA and programed by it

but…
When using cudaMalloc,

int* a;
CUDA_SAFE_CALL( cudaMalloc( ( void ** )&a, sizeof( int ) ) );

This function go the _file.c -> fprintf.c -> exit()…

Finally The program exit it…

what’s the matter with it??
Plz help me…

nothing wrong at all.

did you use any host function with “a”?

I agree with Quoc Vinh, the code looks OK.

What happens if you do int * a = 0; first?

Also, can you run the SDK sample programs, do they work OK?

Are you compiling in DEBUG mode? In debug mode, CUDA_SAFE_CALL exits on error, so I suggest running the program from the command line. This way, you will be able to read the error description.

Or just use
#define exit(x)
after including cutil.h to void any calls to exit().