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.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Thomas
  • 1,199
  • 1
  • 14
  • 29

1 Answers1

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
juanmajmjr
  • 1,055
  • 7
  • 11