5.3. Memory management¶
The CPU and GPU in a APU share the same main memory. There is no distinction between CPU and GPU memory. Even though a HSA kernel can directly consume any data in the main memory, it is recommended to register a memory region to the HSA runtime compatibility with HSA-compliant discrete GPUs.
Register every given array. The function can be used in a with-context for automically deregistration:
array_a = numpy.arange(10) array_b = numpy.arange(10) with hsa.register(array_a, array_b): some_hsa_code(array_a, array_b)
Deregister every given array