[Openmp-dev] lone "omp target exit data" produces runtime error

Joel E. Denny via Openmp-dev openmp-dev at lists.llvm.org
Wed Mar 3 13:57:13 PST 2021


Hi,

The following program produces an OpenMP runtime error.
LIBOMPTARGET_DEBUG=1 reveals that the problem is that the device is
uninitialized.  Is this behavior specified by OpenMP?

```
int main() {
  int x;
  #pragma omp target exit data map(from:x)
  return 0;
}
```

I'm not sure how it's useful to have an "omp target exit data" before any
other offloading code.  I've only run into this when writing toy test
programs, and my solution has been to add an empty target region before
it.  Also, in the call today I mentioned I'd like to encapsulate more code
into CheckDeviceAndCtors.  It looks like __tgt_target_data_end_mapper could
benefit from that encapsulation except it doesn't currently call
CheckDeviceAndCtors.
If it did call it, the above program would succeed.

Thanks.

Joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20210303/605e55fd/attachment.html>


More information about the Openmp-dev mailing list