<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
It is applied only to global vars in the file/namespace scope.<br>
<br>
<div id="AppleMailSignature" dir="ltr">Best regards,
<div>Alexey Bataev</div>
</div>
<div dir="ltr"><br>
8 авг. 2019 г., в 21:37, Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com">itaru.kitayama@gmail.com</a>> написал(а):<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">$ cat test.cpp<br>
int main() {<br>
int a;<br>
#pragma omp declare target to (a)<br>
<br>
<div>}</div>
$ clang++ -fopenmp -fopenmp-targets=nvptx64 test.cpp<br>
test.cpp:3:21: error: unexpected OpenMP directive '#pragma omp declare target'<br>
#pragma omp declare target to (a)<br>
                    ^<br>
<div>1 error generated.</div>
<div><br>
</div>
<div>Tested with the latest trunk Clang on POWER8.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Aug 9, 2019 at 9:34 AM Alexey Bataev <<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="auto">A a;
<div>#pragma omp declare target to(a)<br>
<br>
<div id="gmail-m_7005959492949325783AppleMailSignature" dir="ltr">Best regards,
<div>Alexey Bataev</div>
</div>
<div dir="ltr"><br>
8 авг. 2019 г., в 20:31, Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com" target="_blank">itaru.kitayama@gmail.com</a>> написал(а):<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">Ravi,
<div>Do you have a simple C++ code that does show how it is done? As I am still inserting a line</div>
<div><br>
</div>
<div>A a;</div>
<div><br>
</div>
<div>#pragma omp target data map(alloc: a) </div>
<div><br>
</div>
<div>?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Aug 9, 2019 at 8:28 AM Narayanaswamy, Ravi <<a href="mailto:ravi.narayanaswamy@intel.com" target="_blank">ravi.narayanaswamy@intel.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Correct.<br>
We are still working on supporting function pointers which should include support for virtual function.<br>
<br>
You can mark the class and object with declare target and use the object to invoke virtual function.<br>
Currently you cannot pass an object through the map clause and use virtual function with that object.<br>
<br>
-----Original Message-----<br>
From: Doerfert, Johannes [mailto:<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a>]
<br>
Sent: Thursday, August 8, 2019 4:24 PM<br>
To: Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com" target="_blank">itaru.kitayama@gmail.com</a>><br>
Cc: Alexey Bataev <<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>>;
<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>; Narayanaswamy, Ravi <<a href="mailto:ravi.narayanaswamy@intel.com" target="_blank">ravi.narayanaswamy@intel.com</a>><br>
Subject: Re: [Openmp-dev] Mapping of non-trivial type support<br>
<br>
You mean, calling a virtual function of a mapped object?<br>
That is, as far as I know, not OpenMP 5.0. It might make it in 5.1 though.<br>
(Allocating the object on the device and then calling a virtual function should be fine though.)<br>
<br>
@Ravi Is this correct?<br>
<br>
________________________________________<br>
From: Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com" target="_blank">itaru.kitayama@gmail.com</a>><br>
Sent: Thursday, August 8, 2019 18:15<br>
To: Doerfert, Johannes<br>
Cc: Alexey Bataev; <a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a><br>
Subject: Re: [Openmp-dev] Mapping of non-trivial type support<br>
<br>
In which issue the virtual function offloading feature support being worked on? I am not certain still after going over the OpenMP 5.0 features list.<br>
<br>
<br>
On Fri, Aug 9, 2019 at 2:32 AM Doerfert, Johannes <<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a><mailto:<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a>>> wrote:<br>
Itaru, a webpage with implementation status details is in the works,<br>
  <a href="https://reviews.llvm.org/D64375" rel="noreferrer" target="_blank">https://reviews.llvm.org/D64375</a><br>
but it seems hard to agree on an initial version.<br>
<br>
On 08/05, Itaru Kitayama via Openmp-dev wrote:<br>
> Alexey et al.,<br>
> What's the plan for OpenMP 5.0 API adoption in Clang? Would you point <br>
> me to a link to an appropriate web page?<br>
> Is there an OpenMP 5.0 API work-in-progress branch which I can give it <br>
> a try?<br>
><br>
> On Sun, Aug 4, 2019 at 8:57 PM Alexey Bataev <<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a><mailto:<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>>> wrote:<br>
><br>
> > clang works in accordance with the standard. Standard says that <br>
> > mapping is performed as bitwise copy of the objects. You can perform <br>
> > the bitwise copy safely only for the trivial types.<br>
> > You cannot simply map a vector. You need to convert it to C/C++ <br>
> > array at first.<br>
> > OpenMP 5.0 introduced user-defined mappers to solve the problem of <br>
> > non-trivial types mapping, which are not supported by clang yet. <br>
> > We're working on this feature.<br>
> ><br>
> > Best regards,<br>
> > Alexey Bataev<br>
> ><br>
> > > 4 авг. 2019 г., в 1:16, Itaru Kitayama via Openmp-dev <<br>
> > <a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a><mailto:<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>>> написал(а):<br>
> > ><br>
> > > Hi,<br>
> > > This simple code:<br>
> > ><br>
> > > int main() {<br>
> > ><br>
> > > std::vector<int> v(100, 0);<br>
> > > #pragma omp target teams distribute parallel for map(tofrom: v)<br>
> > >    for (int i=0;i<100;i++) {<br>
> > >         v[i] =i;<br>
> > >    }<br>
> > > };<br>
> > ><br>
> > > causes Clang to warn a message like:<br>
> > ><br>
> > > vectormap.cpp:31:62: warning: Non-trivial type 'std::vector<int>' <br>
> > > is<br>
> > mapped, only trivial types are guaranteed to be mapped correctly <br>
> > [-Wopenmp-target]<br>
> > > #pragma omp target teams distribute parallel for map(tofrom: v)<br>
> > ><br>
> > >                                    ^<br>
> > > 1 warning generated.<br>
> > ><br>
> > > ... and encounters an issue at run time. How much non-trivial <br>
> > > types are supported in trunk Clang?<br>
> > > _______________________________________________<br>
> > > Openmp-dev mailing list<br>
> > > <a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a><mailto:<a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a>><br>
> > > <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" rel="noreferrer" target="_blank">
https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a><br>
> ><br>
<br>
> _______________________________________________<br>
> Openmp-dev mailing list<br>
> <a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a><mailto:<a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a>><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" rel="noreferrer" target="_blank">
https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a><br>
<br>
<br>
--<br>
<br>
Johannes Doerfert<br>
Researcher<br>
<br>
Argonne National Laboratory<br>
Lemont, IL 60439, USA<br>
<br>
<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a><mailto:<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a>><br>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</body>
</html>