When compiling under gcc the following errors occur:
clu_runtime.cpp: In constructor ‘DeviceTypeToId::DeviceTypeToId()’:
clu_runtime.cpp:137:47: error: ‘memset’ was not declared in this scope
clu_runtime.cpp: At global scope:
clu_runtime.cpp:260:1: error: specializing member ‘CLU_Runtime::CLU_Specific<cl_context>::~ CLU_Runtime::CLU_Specific<cl_context>’ requires ‘template<>’ syntax
clu_runtime.cpp:261:1: error: specializing member ‘CLU_Runtime::CLU_Specific<cl_command_queue>::~ CLU_Runtime::CLU_Specific<cl_command_queue>’ requires ‘template<>’ syntax
clu_runtime.cpp:262:1: error: specializing member ‘CLU_Runtime::CLU_Specific<cl_program>::~ CLU_Runtime::CLU_Specific<cl_program>’ requires ‘template<>’ syntax
clu_runtime.cpp: In member function ‘void CLU_Runtime::Reset()’:
clu_runtime.cpp:287:53: error: ‘memset’ was not declared in this scope
clu_runtime.cpp: In function ‘cl_platform_id* GetPlatformByVendor(cl_uint, cl_platform_id* const, const char, cl_int_)’:
clu_runtime.cpp:362:42: error: ‘strstr’ was not declared in this scope
clu_runtime.cpp: In function ‘cl_program cluBuildSourceArray(cl_uint, const char**, const char_, cl_int_)’:
clu_runtime.cpp:832:92: error: ‘strlen’ was not declared in this scope
clu_runtime.cpp:832:93: error: ‘strncmp’ was not declared in this scope
clu_runtime.cpp: In function ‘const char* CLU_GetDeviceInfo(cl_int*)’:
clu_runtime.cpp:1105:90: warning: passing NULL to non-pointer argument 3 of ‘cl_int clGetDeviceIDs(cl_platform_id, cl_device_type, cl_uint, _cl_device_id**, cl_uint*)’ [-Wconversion-null]
The errors related to memset, strlen, strncmp, etc. can be fixed by including cstring:
include
The errors on line 260, 261 and 262 can be fixed by following the compiler's suggestion:
template<>
CLU_Runtime::CLU_Specific<cl_context>::~CLU_Specific() {clReleaseContext(m_o);}
template<>
CLU_Runtime::CLU_Specific<cl_command_queue>::~CLU_Specific() {clReleaseCommandQueue(m_o);}
template<>
CLU_Runtime::CLU_Specific<cl_program>::~CLU_Specific() {clReleaseProgram(m_o);}
Finally, the warning can be dealt with by converting the NULL to a 0:
status = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &numDevices);