Skip to content

Moving Data Between Host and Device Memory

Matt Norman edited this page Dec 11, 2021 · 1 revision

The intent of YAKL is that you will want copies of an Array object in one of two distinct memory spaces: Host (i.e., main memory) and Device (e.g., GPU memory). There are currently four member functions of the Array class to help with data movement:

// Create a copy of this Array class in Host Memory, and pass that copy back as a return value.
Array<...> createHostCopy();

// Create a copy of this Array class in Device Memory, and pass that copy back as a return value.
Array<...> createDeviceCopy();

// Copy the data from this Array pointer to the Host Array's pointer (Host Array must already exist)
void deep_copy_to(Array<T,...,memHost,...> lhs);

// Copy the data from this Array pointer to the Device Array's pointer (Device Array must already exist)
void deep_copy_to(Array<T,...,memDevice,...> lhs);
Clone this wiki locally