[Openmp-dev] The z specifier in %zu is silently accepted (although unsupported) in the device code and does not work

Itaru Kitayama via Openmp-dev openmp-dev at lists.llvm.org
Thu Mar 5 16:17:59 PST 2020


To me, printf() support in CUDA is not robust like C implementation. This
makes debugging is harder.

On Fri, Mar 6, 2020 at 5:57 AM Itaru Kitayama <itaru.kitayama at gmail.com>
wrote:

> I've also checked going back to CUDA 8 works. So as you suggested it is
> likely a bug in CUDA 10.0.130
> in my programming environment.
>
> On Fri, Mar 6, 2020 at 5:14 AM Alexey.Bataev <a.bataev at outlook.com> wrote:
>
>> Clang converts standard printf into the CUDA-specific printf and then
>> relies on the CUDA-provided library that implements this CUDA-specific
>> printf function. Seems to me they break something in their library for
>> printf.
>>
>> -------------
>> Best regards,
>> Alexey Bataev
>>
>> 05.03.2020 3:11 PM, Itaru Kitayama пишет:
>>
>> Ok, I see. I stumble upon this “bug” yesterday
>> and wasted a couple of hours as it was printing bogus values etc.
>>
>> In Clang printf support is adjusted with the subtle CUDA version?
>>
>> On Fri, Mar 6, 2020 at 5:05 Alexey.Bataev <a.bataev at outlook.com> wrote:
>>
>>> Most probably, this is just a bug in CUDA 10.2, beause with CUDA 8
>>> everything works as expected
>>>
>>> -------------
>>> Best regards,
>>> Alexey Bataev
>>>
>>> 05.03.2020 3:03 PM, Itaru Kitayama пишет:
>>>
>>> Alexey
>>> Are you using the CUDA 10.2 or higher?
>>>
>>> On Fri, Mar 6, 2020 at 5:02 Itaru Kitayama <itaru.kitayama at gmail.com>
>>> wrote:
>>>
>>>> Clang is the latest trunk.
>>>>
>>>> On Fri, Mar 6, 2020 at 4:58 Alexey.Bataev <a.bataev at outlook.com> wrote:
>>>>
>>>>> Hmm, for me it works, I see 123, 123 as the output (both, in С and in
>>>>> C++).
>>>>>
>>>>> -------------
>>>>> Best regards,
>>>>> Alexey Bataev
>>>>>
>>>>> 05.03.2020 2:54 PM, Itaru Kitayama пишет:
>>>>>
>>>>> Alexey
>>>>> CUDA dorms implement that, and on POWER8
>>>>> it just doesn’t work (prints out plain “%zu” literally).
>>>>>
>>>>> On Fri, Mar 6, 2020 at 0:45 Alexey.Bataev <a.bataev at outlook.com>
>>>>> wrote:
>>>>>
>>>>>> What's wrong with the z specifier? It works as it should. Why is it
>>>>>> unsupported?
>>>>>>
>>>>>> -------------
>>>>>> Best regards,
>>>>>> Alexey Bataev
>>>>>>
>>>>>> 05.03.2020 5:44 AM, Itaru Kitayama via Openmp-dev пишет:
>>>>>>
>>>>>> Can Clang warn on the wrong use at build time?
>>>>>>
>>>>>> When a developer writes code like below and build?
>>>>>>
>>>>>> #include <iostream>
>>>>>> int main()
>>>>>> {
>>>>>>         size_t my_sz = 123;
>>>>>> #pragma omp target parallel for map(to: my_sz)
>>>>>>     for (int i=0;i<1;i++) {
>>>>>>         printf("%zu, %d\n", my_sz, my_sz);
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> _______________________________________________
>>>>>> Openmp-dev mailing listOpenmp-dev at lists.llvm.orghttps://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20200306/963a7091/attachment.html>


More information about the Openmp-dev mailing list