Software Archive
Read-only legacy content
17061 Discussions

Send multiple signals in single offload

Tim_D_1
Beginner
604 Views

Hi,

Is it possible to send more than one signal with an offload pragma? According to this document: https://www.tacc.utexas.edu/documents/13601/137150/Advanced+Offloading.pdf it is possible, however I get a compiler error using the syntax below, and I cannot have mutiple signal clauses in the offload pragma.

[cpp]

int main(int argc, char* argv[])
{

 int sig1, sig2;
int data = 1;


#pragma offload_transfer target(mic:0) in(data) signal(&sig1, &sig2)

 #pragma offload target(mic:0) nocopy(data) wait(&sig1)
{
    printf("Data: %d",data);
}


return 0;

}

[/cpp]

If not, is there a way of preinitialising a signal as if it has already been 'signalled'? I have a loop that does various offloads with waits, and I want the signals that are being waited on to be true when i first enter the loop so that the first offloads actually run, as they then send the signal that will be waited on in the next iteration of the loop. 

I do an offload transfer before the loop runs, which I intended to use to transfer some initial parameter data as well as set those first two signals, i understand I could split the transfer in two and send one signal for each to achieve the same goal but is there a cleaner method of doing this with a single transfer?

Thanks

0 Kudos
2 Replies
Sumedh_N_Intel
Employee
604 Views

Hi Tim, 

I was looking through the compiler reference ( http://software.intel.com/sites/products/documentation/doclib/stdxe/2013/composerxe/compiler/cpp-lin/GUID-EAB414FD-40C6-4054-B094-0BA70824E2A2.htm) for offload and I noticed that the signal specifier accepts only a single tag and hence I believe that you cannot send multiple signals from the same pragma. 

One possible workaround could be to use an empty offload pragma which sets the signals. For example, 

[cpp]

#pragma offload target(mic:0) signal(&m2)
{
}

[/cpp]

Hope this helps. 

0 Kudos
Tim_D_1
Beginner
604 Views

Ah okay I should have checked the compiler ref manual, thanks Sumedh. I will use empty offload pragmas to pre-set the signals as you suggest.

0 Kudos
Reply