Software Archive
Read-only legacy content

How to

SKAL_H_
Beginner
333 Views

for example, I have

#pragma offload nocopy(a)
{
  a = malloc(sizeof(double)*ny*nx);
}

And now I want to initialize its first k lines from the data from Host

I can do something like:

inout = malloc(sizeof(double)*k*nx);
memcpy(inout, a, k*nx*sizeof(double));
#pragma offload in(inout: length(k*nx) alloc_if(1) free_if(1)) nocopy(a) in(nx, k)
{
 memcpy(a, inout, k * nx * sizeof(double));
}

Is there any way to avoid the temporary pointer `inout' ?

Thanks

 

0 Kudos
1 Reply
Kevin_D_Intel
Employee
333 Views

This is probably easier done using INTO and having the offload manage the memory allocation. There is an outline of an example that demonstrates your interest under the topic Minimize Coprocessor Memory Allocation Overhead on the Effective Use of the Intel Compilers Offload Features page.
Let me know whether this helps.

0 Kudos
Reply