Just like target regions, data transfers can also be made asynchronous. If multiple target nowait regions each handle a chunk of an array, each of these regions will perform its own data transfer at entry and at exit. We can instead consolidate all the data transfers into one target enter data nowait at the start, and one target exit data nowait at the end, with the per-chunk regions in between.

The problem with simply adding the nowait clause to target and target enter data is that we can't guarantee that the target regions start after target enter data, or in other words, that the target regions start only after the data is present on the device. To fix this, we use the depend clause. The target enter data nowait declares depend(out: sync_token), and each target region declares depend(in: sync_token). The target directives now depend on sync_token, which is held until target enter data nowait finishes its data transfer, so the target regions only start once the data is on the device.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)