<div dir="ltr">Thanks Justin! This is very helpful!<div><br></div><div>-Izzat</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 22, 2015 at 5:03 PM, Justin Lebar <span dir="ltr"><<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">When the clang driver is handed a .cu file, it compiles that file more<br>
than once, to build the host code and the device code.  clang-check<br>
can't handle this, thus the error "expected exactly one compiler job".<br>
I expect it's a similar situation to if you asked clang-check to check<br>
two .cpp files at once.<br>
<br>
To make this work you'd need to teach clang-check to handle this case<br>
properly, or you'd need to convince the clang driver to invoke the<br>
compiler only once (for just the host, or just the device).  The<br>
relevant flags to clang proper are --cuda-device-only or<br>
--cuda-host-only; I don't know offhand how to make those interact with<br>
clang-check.<br>
<br>
Good luck,<br>
-Justin<br>
<span class="im"><br>
On Tue, Dec 22, 2015 at 10:45 AM, Jingyue Wu via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> +cfe-dev<br>
><br>
> On Mon, Dec 21, 2015 at 10:07 AM, Izzat El Hajj via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
</span><div class=""><div class="h5">>> Hello,<br>
>><br>
>> I'm not sure if this is the right place to post this question. If not, I<br>
>> apologize and would appreciate if you redirect me.<br>
>><br>
>> I recently built and installed llvm/clang in order to build a CUDA<br>
>> source-to-source translator using Clang. I followed these instructions:<br>
>> <a href="http://clang.llvm.org/docs/LibASTMatchersTutorial.html" rel="noreferrer" target="_blank">http://clang.llvm.org/docs/LibASTMatchersTutorial.html</a>.<br>
>><br>
>> The built-in tools (like clang-check) work fine on C/C++ programs, but<br>
>> they don't work on CUDA. If I execute the following command (regardless of<br>
>> what <a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a> contains) I get the error shown:<br>
>><br>
>> $ clang-check <a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a> --<br>
>><br>
>> error: unable to handle compilation, expected exactly one compiler job in<br>
>> ' "/usr/local/bin/clang-check" "-cc1" "-triple" "nvptx64-nvidia-cuda"<br>
>> "-aux-triple" "x86_64-unknown-linux-gnu" "-fcuda-target-overloads"<br>
>> "-fcuda-disable-target-call-checks" "-fsyntax-only" "-disable-free"<br>
>> "-main-file-name" "<a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a>" "-mrelocation-model" "static" "-mthread-model"<br>
>> "posix" "-mdisable-fp-elim" "-fmath-errno" "-no-integrated-as"<br>
>> "-mconstructor-aliases" "-fcuda-is-device" "-mlink-cuda-bitcode"<br>
>> "/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc"<br>
>> "-target-feature" "+ptx42" "-target-cpu" "sm_20" "-dwarf-column-info"<br>
>> "-resource-dir" "/usr/local/bin/../lib/clang/3.8.0" "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"<br>
>> "-internal-isystem" "/usr/local/include" "-internal-isystem"<br>
>> "/usr/local/bin/../lib/clang/3.8.0/include" "-internal-externc-isystem"<br>
>> "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"<br>
>> "-internal-isystem" "/usr/local/cuda/include" "-include"<br>
>> "__clang_cuda_runtime_wrapper.h" "-fdeprecated-macro"<br>
>> "-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/<path>/test"<br>
>> "-ferror-limit" "19" "-fmessage-length" "192" "-fobjc-runtime=gcc"<br>
>> "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"<br>
>> "-fcolor-diagnostics" "-x" "cuda" "/<path>/test/<a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a>";<br>
>> "/usr/local/bin/clang-check" "-cc1" "-triple" "x86_64-unknown-linux-gnu"<br>
>> "-aux-triple" "nvptx64-nvidia-cuda" "-fcuda-target-overloads"<br>
>> "-fcuda-disable-target-call-checks" "-fsyntax-only" "-disable-free"<br>
>> "-main-file-name" "<a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a>" "-mrelocation-model" "static" "-mthread-model"<br>
>> "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"<br>
>> "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu"<br>
>> "x86-64" "-dwarf-column-info" "-resource-dir"<br>
>> "/usr/local/bin/../lib/clang/3.8.0" "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"<br>
>> "-internal-isystem"<br>
>> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"<br>
>> "-internal-isystem" "/usr/local/include" "-internal-isystem"<br>
>> "/usr/local/bin/../lib/clang/3.8.0/include" "-internal-externc-isystem"<br>
>> "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include"<br>
>> "-internal-externc-isystem" "/usr/include" "-internal-isystem"<br>
>> "/usr/local/cuda/include" "-include" "__clang_cuda_runtime_wrapper.h"<br>
>> "-fdeprecated-macro" "-fdebug-compilation-dir" "/<path>/test"<br>
>> "-ferror-limit" "19" "-fmessage-length" "192" "-fobjc-runtime=gcc"<br>
>> "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"<br>
>> "-fcolor-diagnostics" "-x" "cuda" "/<path>/test/<a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a>"; '<br>
>> Error while processing /<path>/test/<a href="http://kernel.cu" rel="noreferrer" target="_blank">kernel.cu</a>.<br>
>><br>
>><br>
>> I searched thoroughly online before posting here but could not find<br>
>> relevant answers. Any help would be appreciated.<br>
>><br>
>> Thanks!<br>
>><br>
>> -Izzat<br>
>><br>
>><br>
>><br>
</div></div><div class=""><div class="h5">>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
</div></div></blockquote></div><br></div></div>