I have a host pointer h_ptr which points to an array in ordinary host memory. The array does not fit into device memory.
I want to have read-only access to this array on both host and device. Unified Virtual Memory is supported.
Currently, I allocate a new array managed_ptr with cudaMallocManaged, copy the data from h_ptr to managed_ptr, free h_ptr and finally use cudaMemAdvice to set managed_ptr to cudaMemAdviseSetReadMostly.
However, this will fail if the size of the array exceeds the available free memory since a copy is made.
Is it possible to use cudaHostRegister or other another function to convert h_ptr into managed memory?