Software Archive
Read-only legacy content

runtime API for data copy in/out and kernel launching

Jiawen_L_
Beginner
879 Views

I know I can separate data copyin, offloading execution and copyout using pragma, e.g.

 

 

 #pragma offload target(mic) nocopy (x: length(SIZE) alloc_if(0) free_if(0)) \

                                nocopy (y: length(SIZE) alloc_if(0) free_if(0))

However, can we do it as runtime call? For example, a function that takes a arbitrary number of arrays and the pointers/sizes of those array, it will have a loop iterating each array to copy data in. Similar thing for copy out. So is there runtime library for that?

Thanks

 

 

 

 

0 Kudos
4 Replies
Rajiv_D_Intel
Employee
879 Views
0 Kudos
Jiawen_L_
Beginner
879 Views

Hi Rajiv, 

Thank you so much for you reply soon.

But It's not what I want. What I want is the runtime API that can be assigned for the function with the a number of arrays and the pointers/sizes of them, which means as this API can generate  a arbitrary number of arrays as below according to the variables/parameters in the runtime dynamically instead of fixedly. How could I do that? Thanks!

 #pragma offload target(mic) nocopy (x: length(SIZE) alloc_if(0) free_if(0)) \

                                nocopy (y: length(SIZE) alloc_if(0) free_if(0))

 

0 Kudos
Rajiv_D_Intel
Employee
879 Views

See attached sample.c

0 Kudos
Rajiv_D_Intel
Employee
879 Views

Note that the variable-length array of pointers must itself be statically allocated, but the dynamic number of pointers that it contains, and the starts and extents of data pointed to by each pointer in that array can be function parameters.

0 Kudos
Reply