Hello,
I have a question when translating OpenACC’s acc host_data use_device(arr)
, where arr
is a Fortran allocatable array, to OpenMP. What’s the difference between omp target data use_device_ptr
and use_device_addr
? I’ve read the specification but don’t get it. Any advice would be appreciated!
Thanks,
Victor
Hi Victor,
I had to ask this too a few weeks ago since the description in the standard isn’t obvious.
use_device_ptr
has been in the OpenMP standard longer. It is designed to support systems without a Unified Virtual Address Space. In principle, the pointer returned from use_device_ptr
could be a host handle. The use_device_addr
is a newer feature that assumes that the system has a Unified Virtual Address Space. For portability there is a requires unified_address
to ensure that use_device_addr
can safely be used.
However given the compiler can implicitly handle unified memory, the NVHPC compilers treat them the same.
-Mat
Hi Mat,
Thanks for your explanation! Good to know that they are treated equally by NVHPC.
Victor
Hi,
Just to chime in - it seems they are not treated equally after all, at least when using “nounified,nomanaged” or “mem:separate”.
In that case, when I use “addr” I get incorrect results, but using “ptr” works correctly.
– Ron