cudaMalloc can't be called in global function?

What kinds of function can be called from global function?



device functions, including (on compute capability 2.x devices) malloc().

In addition to what tera said, global functions can call other global functions as well. Another interesting function that can be called is printf()

Also, all the functions prefixed with cuda or cu cannot be called from within global or device functions.