Already locked memory: making it known to CUDA - how ?

For certain reasons I have to allocate host memory under Windows (in this case, Windows API functions “CreateFileMapping” and “MapViewOfFile” are used to allocate shared memory and return the pointer to it).
This memory contains data this to be copied to GPU memory for subsequent processing.
In order to improve copy performance to GPU memory (or: in general), that memory is subsequently locked with the “VirtualLock” Windows API call.
What I want to do is to make that memory known to CUDA to be already locked (that is: pinned) so that CUDA will choose the optimum mechanism to copy that memory on say a “cudaMemCopy” or “cudaMemCopyAsync” call.
Is there any cuda Function that allows to “register” already pinned host memory ?

Yes, and even your naming guess was correct: cudaHostRegister(). The Programming Guide also covers this.


I guess I should have found that myself …
Anyway, many thanks for the “pointer” (Ha ha …)