manodeep / Corrfunc

⚡️⚡️⚡️Blazing fast correlation functions on the CPU.
https://corrfunc.readthedocs.io
MIT License
165 stars 50 forks source link

Clean up the kernel dispatch code #152

Open manodeep opened 6 years ago

manodeep commented 6 years ago

Almost identical lines of codes are repeated for each pair counter in the function dispatch setup. All of these lines with the exception of the definition of allfunctions could be wrapped up in a macro.

Even better would be a macro that accepts 6 arguments, the first argument being the type of the function pointer (i.e., type of allfunctions) and each of the remaining arguments corresponding to the name of the avx512f, avx2, avx, sse42 and fallback kernels. The macro would then produce the appropriate code, with checking for compile time support (or lack there-of) for the various features.