I want to use zero-copy on mapped memory by cudaHostGetDevicePointer. Can I use thrust::host_vector or I must use cudaHostAlloc(...,cudaHostAllocMapped)?
Or is it somehow easier to do with Thrust?
I want to use zero-copy on mapped memory by cudaHostGetDevicePointer . Can I use
Share
I am pretty sure it still isn’t possible to use a thrust::host_vector as a mapped host allocation. There is a pinned memory allocator, but I don’t believe mapped memory is available. What you need to do is something like this:
cudaHostAlloccudaHostGetDevicePointerthrust::device_ptrusingthrust::device_pointer_caston that device pointer (see here for more information)You can the either make a
thrust::device_vectorusing thethrust::device_ptror dirctly pass thethrust::device_ptrto any algorithms which accept an iterator.