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

Samuel Antao via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 7 05:26:08 PST 2016


sfantao added a subscriber: sfantao.
sfantao added a comment.

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.

Thanks,
Samuel

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] http://reviews.llvm.org/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`...

http://reviews.llvm.org/D14031

F1288110: graycol.gif <http://reviews.llvm.org/F1288110>


http://reviews.llvm.org/D14031





More information about the Openmp-commits mailing list