[llvm-dev] Compiling CUDA with clang on Windows

Justin Lebar via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 13 17:15:43 PST 2019


>  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.

It probably is not launching the kernel successfully.  You'll need to add
error checking and then figure out why you're getting an error from CUDA.

> By the way, is it also possible to have a pre-built binary for msys2
(64bits) on windows?

All of these things are community-driven, so if it's not there already, you
may be the best person to provide it.  :)

-Justin

On Wed, Feb 13, 2019 at 4:53 PM Finite Tsai <tsaichiacheng at gmail.com> wrote:

>
>
> 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/20190213/3fe1ca55/attachment.html>


More information about the llvm-dev mailing list