Try:<div><br></div><div>find<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> $HEADER_DIR | xargs </span>sed --i.bak -e 's/>>>/> > >/'</div><div><div><br>
</div><div>I don't think there are any syntactic dark corners where that will break otherwise valid C++.<div><br></div><div>No guarantees though (that's what the -i.bak is for ;).</div><div><div><br></div><div>--Sean Silva<br>
<br><div class="gmail_quote">On Wed, Jun 13, 2012 at 8:28 PM, Peter Colberg <span dir="ltr"><<a href="mailto:peter@colberg.org" target="_blank">peter@colberg.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, Jun 13, 2012 at 07:30:25PM -0700, Richard Smith wrote:<br>
> On Wed, Jun 13, 2012 at 6:57 PM, Peter Colberg <<a href="mailto:peter@colberg.org">peter@colberg.org</a>> wrote:<br>
> > Hi,<br>
> ><br>
> > I am experimenting with CUDA language support in Clang, and so far<br>
> > the kernel-call test in Clang trunk (r158426) compiles and runs, on<br>
> > a Tesla C2050.<br>
> ><br>
> > Now I would like to enable C++11 support in Clang to use compile-time<br>
> > C++11 features in GPU code, primarily variadic templates and lambda<br>
> > functions.<br>
</div><div class="im">> > …<br>
> > Is there a way to tell Clang to enable C++11 extensions?<br>
><br>
> Sadly no, it appears we enable CUDA features based on whether we're<br>
> using -std=cuda, not whether we're using -x cuda, so even though we<br>
> accept -x cuda -std=c++11, that diasbles CUDA support! I expect we'd<br>
> accept a patch to fix that :-)<br>
><br>
> For your own experimentation, try modifying<br>
> include/clang/Frontend/LangStandards.def as follows:<br>
><br>
> --- include/clang/Frontend/LangStandards.def (revision 158416)<br>
> +++ include/clang/Frontend/LangStandards.def (working copy)<br>
> @@ -115,6 +115,6 @@<br>
> // CUDA<br>
> LANGSTANDARD(cuda, "cuda",<br>
> "NVIDIA CUDA(tm)",<br>
> - BCPLComment | CPlusPlus | Digraphs)<br>
> + BCPLComment | CPlusPlus | CPlusPlus0x | Digraphs)<br>
><br>
> #undef LANGSTANDARD<br>
<br>
</div>Thanks, Richard and Sean, indeed that works! I could compile a<br>
__attribute__((global)) function calling a local lambda function,<br>
and a variadic function with __attribute__((device)).<br>
<br>
There seems to be an issue with C++11 headers, e.g. <iostream><br>
<br>
clang++ -I/usr/local/cuda-4.2/cuda/include -L/usr/local/cuda-4.2/cuda/lib64 -lcudart -o kernel-call <a href="http://kernel-call.cu" target="_blank">kernel-call.cu</a><br>
In file included from <a href="http://kernel-call.cu:7" target="_blank">kernel-call.cu:7</a>:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/iostream:39:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ostream:39:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ios:40:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/char_traits.h:40:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:65:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:61:<br>
In file included from /home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/move.h:57:<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:441:38: error: expected '>'<br>
is_void<_Tp>>>::type<br>
^<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:441:38: error: expected a type<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:442:8: error: expected a type<br>
{ };<br>
^<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:442:8: error: expected class<br>
name<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:442:8: error: expected<br>
'{' after base class list<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:563:61: error: expected '>'<br>
: public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type<br>
^<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:563:61: error: expected a type<br>
/home/peter/usr/rhel6-x86_64/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:564:8: error: expected a type<br>
{ };<br>
…<br>
<br>
<br>
The parser interprets the compressed C++11 template parameter syntax<br>
as a call to a CUDA kernel function. Is there a way to disable parsing<br>
of the CUDA call syntax <<< >>>? I would be using a C++ wrapper around<br>
cudaConfigureCall, cudaSetupArgument and cudaLaunch anyway.<br>
<br>
<br>
Besides, this is very impressive. C++11 on GPUs appears to be near :-).<br>
<span class="HOEnZb"><font color="#888888"><br>
Peter<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div></div></div></div>