Software Archive
Read-only legacy content

offload

Philip_S_
Beginner
779 Views

HI,

I have a problem with trying to offload an array of pointers to Intel Phi.

I have tried a few options from your examples, but I have a few questions.

In all the examples shown the array subscripts are from 0:n even if the array

was declared as size n, eg: float * t[100]  (0:99) in the offload pragma it is shown as offload in(t[0:100]).

is this right?

Another question is: on transferring 4,845,568 bytes, in the status return the in size is shown as 13,985,8021,538,504  this can't be correct?

I am using Windows 7 Ultimate with Visual Studio 2013, Parallel Studio XE 2015 and MPSS-3.3-windows

regards,

Phil Sharrock

phil.sharrock@physics.cr.man.ac.uk

0 Kudos
4 Replies
Frances_R_Intel
Employee
779 Views

Unlike standard Fortran array notation, the notation used on the offload statements in C/C++ is start:length, not start:end. Of course, being an old time Fortran programmer, I think the Fortran way is the "right" way, but that is not how old time C programmers think. So offload in(t[0:100]) means offload elements t[0] through t[99].

Given that you are passing an array of pointers, are the values pointed to declared as _Cilk_shared? Variables must be in shared virtual memory in order for the pointers on the host to map to the same variables on the coprocessor. See Offload Using Shared Virtual Memory in the User and Reference Guide for the Intel® C++ Compiler in the reference manuals.

0 Kudos
Kevin_D_Intel
Employee
779 Views

The Intel® Parallel Studio XE 2015 (15.0 compiler) release contains new feature support for passing an array of pointers as discussed in the article: Data transfer of an "array of pointers" using the Intel® Language Extensions for Offload (LEO) for the Intel® Xeon Phi™ coprocessor that does not require using the Virtual shared model.

Regarding the size shown in the status return, I am unable to reproduce anything resembling this so can you tell me where are you seeing this value?

0 Kudos
Philip_S_
Beginner
779 Views

Kevin,

My array of pointers is an array of pointers pointing to other pointers.

not just a single array. after getting the offload report to work I get an error message as fiollows

offload error: cannot find offload entry.

I am using C++ and MS visual studio 2013 with Intel Parallel studio XE 2015

I am trying this version of code to transfer an array of pointers:-

for(i=0;i<zSz;i++)
  {
    fpIn=ApIn;
    #pragma offload_transfer target(mic:0) mandatory in(fpIn[0:ApInsz]:ALLOC RETAIN) nocopy(ApIn) status(offstat)
    if(offstat.result != OFFLOAD_SUCCESS) return -99;
    {
      ApIn=fpIn;
    }
  }

Any suggestions?

Phil

0 Kudos
Kevin_D_Intel
Employee
779 Views

The snippet isn’t enough to understand the runtime error. The runtime error can occur from calling a function within an offload construct where an instance of the function is not present in the offload binary, but maybe there's something else in your case. If you can provide a bit more context (declarations and code) then I could perhaps re-create something I can toy with a bit further.

The offload_transfer only performs data transfer so the block of code you shown below that is executed on the host and not the target. You may already understand that and maybe I am misreading the snippet thinking they are related and that you are trying to avoid the transfer of ApIn related to that code block with the nocopy(ApIn), which for the offload_transfer isn't necessary.

The offload status is only usable on host and not on the coprocessor.

0 Kudos
Reply