GGEMS / ggems

GGEMS - Advanced Monte Carlo simulation platform using the OpenCL
GNU General Public License v3.0
32 stars 14 forks source link

Update build options for cuda 12.4 #24

Closed Yao1993 closed 2 weeks ago

Yao1993 commented 2 months ago

When building ggems with CUDA 12.4, I need add extra definations to use OpenCL 1.2.

ADD_DEFINITIONS(-DCL_HPP_MINIMUM_OPENCL_VERSION=120)
ADD_DEFINITIONS(-DCL_HPP_TARGET_OPENCL_VERSION=120)
ADD_DEFINITIONS(-DCL_TARGET_OPENCL_VERSION=120)

To make the constructor of cl::Program::Sources of accepting c string, another defination is also needed.

ADD_DEFINITIONS(-DCL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
cl::Program::Sources program_source(1, std::make_pair(source_code.c_str(), source_code.length() + 1));
class Program : public detail::Wrapper<cl_program>
{
public:
#if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
    typedef vector<vector<unsigned char>> Binaries;
    typedef vector<string> Sources;
#else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
    typedef vector<std::pair<const void*, size_type> > Binaries;
    typedef vector<std::pair<const char*, size_type> > Sources;
#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
}