This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp4] Questions about "declare target" and "target update" pragmas
- From: Ilya Verbin <iverbin at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 28 Jan 2014 21:54:09 +0400
- Subject: Re: [gomp4] Questions about "declare target" and "target update" pragmas
- Authentication-results: sourceware.org; auth=none
- References: <20140122155151 dot GA50489 at msticlxl57 dot ims dot intel dot com> <20140122160209 dot GV892 at tucnak dot redhat dot com>
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