Uncrustify command for CUDA kernel
Asked Answered
C

1

8

I would like to apply uncrustify (via beautify in the Atom editor and a config file) to CUDA code. However, I don't know how to tell uncrustify to recognize CUDA kernel calls which have the following structure:

kernelName <<<N,M>>> (arg0,arg1,...);

However, uncrustify has problems with the <<< >>> and applying it gives the following unpleasant result

kernelName << < N, M >> >
    (arg0,arg1,...);

I would like to have it look more like a function call and also avoid the formatting of <<< to << <. Ideally, the result would look like

kernelName <<< N, M >>> (arg0,arg1,
      ...); // line break if argument list is too long

Which arguments can I add to my config.cfg to achieve the above result?

Thank you very much.

Czardas answered 10/7, 2015 at 8:30 Comment(0)
S
5

Looking through whole documentation of uncrustify, I have found 2 arguments that could influence in your CUDA kernel style:

sp_compare                                { Ignore, Add, Remove, Force     }
 Add or remove space around compare operator '<', '>', '==', etc

And:

align_left_shift                          { False, True }
  Align lines that start with '<<' with previous '<<'. Default=true

You can try to play around with these parameters to be more closely to the solution although I would try something like:

sp_compare     =   Remove
align_left_shift   = False
Sharecropper answered 18/7, 2015 at 23:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.