Cublas function call from within the kernel ? is it possible ?

Is it possible to call cublas functions/api from within the kernel code ? like

__global__ kernel(....) {

// some declarations





I would say no. That function is a wrapper to a kernel call, and you can’t call a kernel from within a kernel.
Also, a function must have the device modifier for it to be able to be called from a kernel, and AFAIK that’s not the case with cublas and cufft functions.


I have another question, say I have a code like the following

void function (input, output) {

float abc;

float xyz;


abc = cublasSdot(.....);

xyz = cublasSdot(....);


will the above code be valid ? What i mean to ask is will the floats i have declared, be on the host or the gpu ?

Is the only way to declare variables on the gpu from the host be via cudaMalloc and cublasAlloc functions ?

These floats you have are on the host. I think you can also declare host variables and give them to the kernel then the kernel will allocate space for it in shared mem. But I’m not sure about that.

What about the first question you did. I read somewhere that the cufft and cublas source had been released. maybe you can translate the kernel that is used to a device function.

I just got my hands on the source code. I did not think of this. I will see what I can do and get back.