Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Make OpenCL integration device agnostic #109

Open
2xB opened this issue May 15, 2024 · 0 comments
Open

Feature request: Make OpenCL integration device agnostic #109

2xB opened this issue May 15, 2024 · 0 comments

Comments

@2xB
Copy link
Member

2xB commented May 15, 2024

The issue

When compiling Kassiopeia with OpenCL enabled, currently the resulting code is bound to the given OpenCL devices during compile time. This is the only reason we can't provide Docker images with OpenCL enabled and why one can't compile Kassiopeia with OpenCL on one system and run it on another system (a difficulty for some HPC systems).

The background

Currently, when compiling, first https://github.com/KATRIN-Experiment/Kassiopeia/blob/main/KEMField/Source/Plugins/OpenCL/Core/src/GenerateOpenCLHeader.cc is compiled by cmake, which generates a platform-dependent header file called kEMField_opencl_defines.h that itself is included in OpenCL (.cl) code. That by itself could all happen at runtime since OpenCL code is compiled at runtime. But then the same header file is also used indirectly by many C++ source files (through KOpenCLInterface.hh through KOpenCLHeaderWrapper.hh). That's the issue.

This dependency is used to know during compile time whether double precision is available on the OpenCL hardware and therefore the C++ interface can use double or float precision for buffers as well. This can be seen by grepping for CL_TYPE in C++ header and source files.

There is no need for this decision between float and double happening during compile time. It happening during compile time just means one can't change the OpenCL platform later. I therefore think it would be best to avoid all occurrences of CL_TYPE in C++ code and always cast to double or use dynamic types instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant