cudaMemcpy / cudaMalloc

Sorry for my english…
I have in a kernel’s function with cudaMemCopy:

cudaMemcpy(hackbuff, header, sizeof(char)*12, cudaMemcpyDeviceToDevice);

and i have the error:

calling a host function from a device/global function is
only allowed in device emulation mode
cudaMemcpy(hackbuff, header, sizeof(char)*12, cudaMemcpyDeviceToDevice);

i can’t call cudaMemcpy or cudaMalloc in the kernel function?

Thanks

That is correct. You can only allocate memory on the device from the host, and then pass the pointer to your kernel.

Thank you :)