Hi all,
just try to use the cuMemAllocHost function to allocate some memory on the host and then
access it from the device/running kernel. Something like this :
int memSizeOnHost = (5 * 1024 * 1024);
int * devPtrOnHost = NULL;
CUDA_SAFE_CALL(cuMemAllocHost((void**)devPtrOnHost, memSizeOnHost));
// call the kernel, pointer to the allocated memory as argument
foo_kernel<<<NUM_BLOCKS, NUM_THREADS>>>(..,..,devPtrOnHost);
// kernel
__global__ static void ping_ping_kernel(..,.., int * devPtrOnHost) {
// here try to access host memory, not working
devPtrOnHost[xx] = some_int_value;
}
But it seems not to work. I’m a bit confused because i did not find any example which use the
cuMemAllocHost function. At the other side the programming guide explicitly saids that “… since the memory ca be accessed directly by the device”…
So, it should work…
Any ideas ?
Thanks,
jj