[Openmp-commits] [PATCH] D14031: [OpenMP] Initial implementation of OpenMP offloading library - libomptarget.

Samuel F Antao via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 7 05:25:48 PST 2016

Hi Jonas,

I think you are correct, we need to register the device and initialize it
for #target update and #target data directives not only the #target
directive. I'll send a fix for that soon.


From:	Jonas Hahnfeld <Hahnfeld at itc.rwth-aachen.de>
To:	Samuel F Antao/Watson/IBM at IBMUS, hfinkel at anl.gov,
            jonathan.l.peyton at intel.com, james.h.cownie at intel.com,
            a.bataev at hotmail.com, chandlerc at gmail.com,
            ravi.narayanaswamy at intel.com
Cc:	f.brygidyn at samsung.com, Alexandre
            Eichenberger/Watson/IBM at IBMUS, openmp-commits at lists.llvm.org,
            Hahnfeld at itc.rwth-aachen.de, hyviquel at gmail.com, Kevin K
            O'Brien/Watson/IBM at IBMUS, Carlo Bertolli/Watson/IBM at IBMUS,
            andreybokhanko at gmail.com, sergos.gnu at gmail.com
Date:	01/07/2016 02:53 AM
Subject:	Re: [PATCH] D14031: [OpenMP] Initial implementation of OpenMP
            offloading library - libomptarget.

Hahnfeld added a comment.

In http://reviews.llvm.org/D14031#320528, @RaviNarayanaswamy wrote:

> OpenMP says : " If the corresponding list item is not present in the
device data environment then no assignment occurs to or from the original
list item."
> Device.IsInit being false can be one's implementation as the list item
not present in the device data environment.
> Ravi

Sorry for not directly posting the code in question that I had in mind:

  #include <stdio.h>

  #pragma omp declare target
  int a = 1;
  #pragma omp end declare target

  int main(int argc, char* argv[]) {
  		 a = 2;
  		 #pragma omp target update to(a)

  		 #pragma omp target
  		 		 printf("a = %d\n", a);

  		 return 0;

What would the expected result be? However I just noticed that yesterday's
simple `init()` didn't change it to `2` because the code and global
variables are still only mapped in the first `omp target`...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160107/1984cc68/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160107/1984cc68/attachment-0001.gif>

More information about the Openmp-commits mailing list