Software Archive
Read-only legacy content
17061 Discussions

How could I keep a task busy wait on mic, and signal it to continue?

songlinhai
Beginner
338 Views

Hi,

   What I am doing now is to use asynchronized method to transfer data between host and mic. If I split data into 100 blocks, the transfer task and computation task are initialized 100 times on mic. I am thinking to remove the overhead from initialization. What I want to implement is to keep the computation task always running, but when there is no available data, it just busy waits. When the transfer task finish one block, it will signal computation task to continue. How could I implement this? 

     thanks a lot!

     Best,

0 Kudos
1 Reply
Andrey_Vladimirov
New Contributor III
338 Views

I am pretty sure that you can't do it with the offload model. However, if you use MPI, you can set up two processes (one on host, one on coprocessor) and use a blocking receive function MPI_Recv on the coprocessor side.

Edit: you can do something similar with the offload model if you use data persistence on coprocessor (clauses "free_if" and "alloc_if" of #pragma offload). However, in this case, you will not have a waiting task; you will just terminate the offload and then start another offload for each chunk of work, which re-uses persistent data.

0 Kudos
Reply