openclKernels: optionally instantiate for float

This commit is contained in:
Arne Morten Kvarving 2024-04-16 13:13:36 +02:00
parent df0a9a4055
commit 9f5bad224c
3 changed files with 14 additions and 0 deletions

View File

@ -35,6 +35,12 @@ foreach(CL ${CL_LIST})
file(READ "${CL}" CL_CONTENT)
file(APPEND ${CL_SRC_FILE} "${CL_CONTENT}")
file(APPEND ${CL_SRC_FILE} "\)\"; \n\n")
if(BUILD_FLOW_FLOAT_VARIANTS)
string(REPLACE double float CL_CONTENT "${CL_CONTENT}")
file(APPEND ${CL_SRC_FILE} "template<> const std::string OpenclKernels<float>::${FNAME}_str = R\"\( \n")
file(APPEND ${CL_SRC_FILE} "${CL_CONTENT}")
file(APPEND ${CL_SRC_FILE} "\)\"; \n\n")
endif()
if(DEBUG_OPENCL_KERNELS_INTEL)
execute_process(

View File

@ -561,4 +561,8 @@ void OpenclKernels<Scalar>::isaiU(cl::Buffer& diagIndex, cl::Buffer& colPointers
template class OpenclKernels<double>;
#if FLOW_INSTANTIATE_FLOAT
template class OpenclKernels<float>;
#endif
} // namespace Opm::Accelerator

View File

@ -182,6 +182,10 @@ public:
DECLARE_INSTANCE(double)
#if FLOW_INSTANTIATE_FLOAT
DECLARE_INSTANCE(float)
#endif
} // namespace Opm::Accelerator
#endif