Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Allocating parts of arrays on coprocessor

sekiguchi__tetsuro
277 Views

Hi, 

I'm trying to figure out how parts of arrays can be allocated on coprocessors.  Following the user guide and an example, I tried compiling the following test code but failed.

program main
  implicit none
  double precision :: a(15)
  
  print *,'size on host:',size(a)
  !dir$ offload begin target(mic:0) in(a(4:8): alloc(3:10))
  print *,'size on mic:',size(a)
  !dir$ end offload 
  
end program main

It seems that although the guide suggests to specify "a list of array section triplets" in a alloc() modifier, the compilers (ver 16.0.0) don't accept that. As far as I tried so far, the only specification which is accepted is like alloc(a(3:10)). However, when I executed the code, the size of the array on coprocessors is the same as in the host. 

Any suggestions are welcome.

Thanks, T

0 Kudos
1 Reply
Kevin_D_Intel
Employee
277 Views

I thought we made some clarifying edits to the documentation regarding this modifier but I'm not seeing any our upcoming release for later this year so I'll follow up with our documentation writers about that. Our apologies.

The syntax should include the array name as you indicated finding, e.g.

  !dir$ offload begin target(mic:0) in(a(4:8): alloc(a(3:10)))

Offloading does not alter an array's underlying characteristics within the offload scope. This alloc modifier only controls the amount of underlying buffer allocation on the coprocessor for the array and you would need to avoid accessing elements not allocated per the array section used for this offload.

0 Kudos
Reply