Make Codegen Safer
By introducing more and more (lbmpy/pystencils but also mesa_pd) codegen stuff in waLBerla, the problem arises that changes made in lbmy or pystencils might ultimately also affect the outcome of the codegen procedure, i.e. the generated kernel/lattice model. The problem is not only that these changes are made in other repositories, but also that changes in some files there can not easily be linked to the functionality that is used in the codegen scripts, i.e. it is not intuitively clear by looking at commit changes that this might affect my generated kernel.
One solution could be, that if I want to make sure that a certain kernel does exactly what I have in mind, I have to define a certain input (e.g. 27 PDFs in a single cell) and compute the output with my kernel, for which I know it is correct. This pair of input and output is then put inside the codegen script file and every time I generate a kernel, it is checked that the output of the newly generated kernel matches the formerly given one.
In some cases, this could also be done symbolically, but the issue arises that different optimizations might lead to a different symbolic representation, even though the outcome of the actual computation sis till the same.
So it would be great to introduce a checkKernel(kernel, input, output) function, to e.g. lbmpy_walberla. Then, initial (and correct) input-output-pairs for the currently existing codegen things in waLBerla have to be defined. And then the check function is used in all codegen scripts to assert that the behavior is still the same. The input data set should be complex enough to cover most cases (e.g. not all zeros), maybe even random.