Can cuPointerGetAttributes be used to get the host pointer of a device memory?

Is it allowed to get the host pointer of a device memory allocated by cuMemAlloc() via cuPointerGetAttributes? I mean all of the device memories are cpu-visible if PCIE large bar is enabled for discrete GPU, and whole range of the device memory can be mapped into host virtual address space. But I’m not sure if it’s allowed by the cuda driver api spec?


No. There is no host pointer “associated” with device memory.

The pointer you are imagining would have to be acquired by other means.

So if and when you get that mapping working, at that point you would be able to get a host pointer, based on the mapping mechanism.

Got it, thanks for clarification!