func (p *Program) Property(dev Device, prop BuildProperty) string { var count C.size_t if ret := C.clGetProgramBuildInfo(p.id, dev.id, C.cl_program_build_info(prop), 0, nil, &count); ret != C.CL_SUCCESS || count < 1 { return "" } buf := make([]C.char, count) if ret := C.clGetProgramBuildInfo(p.id, dev.id, C.cl_program_build_info(prop), count, unsafe.Pointer(&buf[0]), &count); ret != C.CL_SUCCESS || count < 1 { return "" } return C.GoStringN(&buf[0], C.int(count-1)) }
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetProgramBuildInfo.html func GetProgramBuildInfo(prog Program, device DeviceId, paramName ProgramBuildInfo, paramValueSize uint64, paramValue unsafe.Pointer, paramValueSizeRet *uint64) ErrorCode { return ErrorCode(C.clGetProgramBuildInfo(prog, device, C.cl_program_build_info(paramName), C.size_t(paramValueSize), paramValue, (*C.size_t)(paramValueSizeRet))) }
func CLGetProgramBuildInfo(program CL_program, device CL_device_id, param_name CL_program_build_info, param_value_size CL_size_t, param_value *interface{}, param_value_size_ret *CL_size_t) CL_int { if (param_value_size == 0 || param_value == nil) && param_value_size_ret == nil { return CL_INVALID_VALUE } else { var c_param_value_size_ret C.size_t var c_errcode_ret C.cl_int if param_value_size == 0 || param_value == nil { c_errcode_ret = C.clGetProgramBuildInfo(program.cl_program, device.cl_device_id, C.cl_program_build_info(param_name), C.size_t(param_value_size), nil, &c_param_value_size_ret) } else { switch param_name { case CL_PROGRAM_BUILD_STATUS: var value C.cl_build_status c_errcode_ret = C.clGetProgramBuildInfo(program.cl_program, device.cl_device_id, C.cl_program_build_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value), &c_param_value_size_ret) *param_value = CL_build_status(value) case CL_PROGRAM_BUILD_OPTIONS, CL_PROGRAM_BUILD_LOG: value := make([]C.char, param_value_size) c_errcode_ret = C.clGetProgramBuildInfo(program.cl_program, device.cl_device_id, C.cl_program_build_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value[0]), &c_param_value_size_ret) *param_value = C.GoStringN(&value[0], C.int(c_param_value_size_ret-1)) case CL_PROGRAM_BINARY_TYPE: var value C.cl_program_binary_type c_errcode_ret = C.clGetProgramBuildInfo(program.cl_program, device.cl_device_id, C.cl_program_build_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value), &c_param_value_size_ret) *param_value = CL_program_binary_type(value) case CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE: var value C.size_t c_errcode_ret = C.clGetProgramBuildInfo(program.cl_program, device.cl_device_id, C.cl_program_build_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value), &c_param_value_size_ret) *param_value = CL_size_t(value) default: return CL_INVALID_VALUE } } if param_value_size_ret != nil { *param_value_size_ret = CL_size_t(c_param_value_size_ret) } return CL_int(c_errcode_ret) } }