This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4] Questions about "declare target" and "target update" pragmas


2014/1/22 Jakub Jelinek <jakub@redhat.com>:
> This can print 3 (if doing host fallback or device shares address space
> with host), or 2 (otherwise).  It shouldn't print 1 ever, and yes,
> the target update is then well defined.  All variables from omp declare
> target are allocated on the device sometime before
> the first target data/target update/target region; given that they will
> be allocated in the data section of the target DSO, they actually just need
> to be registered with the mapping data structure when the DSO is loaded.
>
> No, the target DSO initialization should use the tables we've talked about
> to initialize the mapping.
>
>         Jakub

Yes, when G is global variable marked with 'declare target', everything works
fine.  But this testcase crashes at runtime in GOMP_target_update:

int main ()
{
  int G = 2;
  #pragma omp target update to(G)
  G = 3;
  int x = 0;
  #pragma omp target
    {
      x = G;
    }
  printf ("%d\n", x);
}

Is it right, that such usage of 'target update' is not allowed by omp
specification?

  -- Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]