Uncrustify Team for CUDA Kernel

I would like to apply uncrustify (via beautify in the Atom editor and configuration file) to the CUDA code. However, I do not know how to tell uncrustify to recognize CUDA kernel calls that have the following structure:

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

However, uncrustify has problems with <<< >>> and its application gives the following unpleasant result

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

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

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

What arguments can be added to my config.cfg to achieve the above result?

Many thanks.

+8
code-formatting cuda uncrustify
source share
1 answer

Looking through all the uncrustify documentation, I found 2 arguments that could affect 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 playing around with these options to be closer to the solution, although I would try something like:

 sp_compare = Remove align_left_shift = False 
+5
source share

All Articles