Outputting preprocessed kernel codes

GROMACS version: 2024
GROMACS modification: Yes/No
Here post your question:

Hi, I would be interested in getting the preprocessed kernel codes (plain C / SIMD / OpenCL) out for inspection. For me, this does not seem trivial as they are present as “templates” and expanded with defines+includes. I managed to do that for OpenCL kernels by running the .cl sources through compiler preprocessor. But for cpu kernels this seems painful to accomplish. Is there any easier way to do this?




For CPU kernels, I’d do something like VERBOSE=1 make, find the command building the object of interest (CPU kernels are split among several .cpp files), and then copy-paste it and add the -E flag to output the preprocessed source. I don’t think there’s a much better way.

Note: moved this to “Developer discussions”

Got it, thanks!

What would be useful is to get all inlined functions inlined, but I suppose that that is not possible.

Note that there are almost no defines left in the SIMD kernels.

Indeed. I also think eliminating some of the conditionals would be great since now all branching and indentation makes the code huge compared to the previous preprocessed kernels, but I am not sure if such tools exist.