How to

How to

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' ?



2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today