[llvm-dev] Fwd: Compiling CUDA with clang on Windows

Finite Tsai via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 13 16:53:15 PST 2019


Dear llvm friends and Justin:

I tried clang 7.0.1 from the pre-built binariy of windows (64bit)
<http://releases.llvm.org/download.html#7.0.1> and cuda 8.0 to build axpy.cu
in the website <https://llvm.org/docs/CompileCudaWithLLVM.html>. I use the
following command: clang++ axpy.cu -o axpy.exe --cuda-gpu-arch=sm_35
-L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64"
-lcudart_static. The compiler indicated two types of bugs as "undefined
FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, & FP_NORMAL" and "conflicts of
isnan, isfinite, & isinf". I patched them by the attached files. Then, I
can obtain axpy.exe correctly. However, the results are "y[0] = 0, y[1] =
0, y[2] = 0, y[3] = 0", which are not correct. I will be very glad to have
comments from you.

By the way, is it also possible to have a pre-built binary for msys2
(64bits) on windows? I suppose that it should be very similar to a linux
system except reimp should be used to convert the cuda .lib files to the
corresponding .a files. I have used the method to obtain libopencl.a, and
it works perfectly well on my Nvidia GPU + msys2/mingw64/clang5 + opencl
system as I tested all the examples from viennaCL
<http://viennacl.sourceforge.net/>.

best regard
Tsai


On Fri, May 4, 2018 at 6:11 AM Justin Lebar <jlebar at google.com> wrote:

> Hi, Tsai,
>
> Can you try a newer version of clang and CUDA?
>
> -Justin
> On Thu, May 3, 2018 at 1:20 AM Finite Tsai <tsaichiacheng at gmail.com>
> wrote:
>
>
> > Hi, Justin,
>
> > Attached files are my code and results. Please give me some comments.
> Alternatively, can you tell me how are your simple clang builds to work?
>
> > best regard
> > Tsai
>
>
> > On Wed, May 2, 2018 at 2:30 AM, Justin Lebar <jlebar at google.com> wrote:
>
> >> Hi, Tsai.
>
> >> I've gotten simple clang builds to work with cuda on Windows.  I didn't
> use
> >> mingw, though.
>
> >> Unfortunately your email does not have enough information to allow me to
> >> assist you further than that.
>
> >> -Justin
> >> On Tue, May 1, 2018 at 7:06 AM Finite Tsai via llvm-dev <
> >> llvm-dev at lists.llvm.org> wrote:
>
>
> >> > Dear all,
>
> >> > In the official document, it is mentioned that  CUDA compilation is
> >> supported on Windows as of 2017-01-05. I used msys2 to install clang
> 5.0.1.
> >> Then I installed cuda 8.0. However, I basically could not compile any
> code
> >> of cuda by the prescribed setting. I wounder if anyone can successfully
> >> compile cuda code by the clang on Windows. Any of your information is
> >> highly appreciated, and
>
> >> > best regards
> >> > Tsai
>
> >> > _______________________________________________
> >> > LLVM Developers mailing list
> >> > llvm-dev at lists.llvm.org
> >> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190214/529269e8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: __clang_cuda_math_forward_declares.h
Type: text/x-c-code
Size: 9071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190214/529269e8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: __clang_cuda_cmath.h
Type: text/x-c-code
Size: 17339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190214/529269e8/attachment-0001.bin>


More information about the llvm-dev mailing list