<div dir="ltr">I am curious how this works.  Does the compiler not #include all headers or specific headers when the target compiler is running?<div><br></div><div>I make heavy use of preprocessing in all of my OpenMP codes, including the target ones.  I don't compile for the NVPTX back-end so I haven't seen problems yet but I wonder if my code is broken in that setting.<div><br></div><div>Jeff</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 24, 2019 at 1:32 PM Doerfert, Johannes <<a href="mailto:jdoerfert@anl.gov">jdoerfert@anl.gov</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">#define works, the preprocessor works.<br>
<br>
When the target region is compiled we do not include math.h. This will<br>
change once we get support for variants. Till then, it is either no math<br>
functions or only he ones Clang CUDA provides automatically, which seems<br>
not to include these defines, maybe because they are not ISO C but POSIX<br>
extensions.<br>
<br>
<br>
On 07/24, Jeff Hammond wrote:<br>
> How does #define not act on the full source code? How is that a compliant implementation of the preprocessor?<br>
> <br>
> Jeff<br>
> <br>
> > On Jul 24, 2019, at 12:25 PM, Doerfert, Johannes via Openmp-dev <<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>> wrote:<br>
> > <br>
> > Hi Itaru,<br>
> > <br>
> > For now, you need to define them yourself when you need them in the target region.<br>
> > We are working on a permanent solution.<br>
> > <br>
> > Thanks,<br>
> >  Johannes<br>
> > <br>
> > ________________________________________<br>
> > From: Openmp-dev <<a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank">openmp-dev-bounces@lists.llvm.org</a>> on behalf of Itaru Kitayama via Openmp-dev <<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>><br>
> > Sent: Tuesday, July 23, 2019 22:58<br>
> > To: <a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a><br>
> > Subject: [Openmp-dev] Math symbols are not found during configuration<br>
> > <br>
> > Hi,<br>
> > Adding the flag -fopenmp-targets=nvptx64 makes math symbols M_E and M_PI defined in cmath not detected during the execution of CMake. How do I work around this? I am using the latest trunk Clang at this moment, and without the above flag, both symbols are detected properly.<br>
> > <br>
> > Thanks,<br>
> > Itaru.<br>
> > _______________________________________________<br>
> > Openmp-dev mailing list<br>
> > <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>
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><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Jeff Hammond<br><a href="mailto:jeff.science@gmail.com" target="_blank">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/" target="_blank">http://jeffhammond.github.io/</a></div>