Esempio n. 1
0
File: queue.go Progetto: xfong/tmpCL
func (q *CommandQueue) GetQueueDevice() (*Device, error) {
	if q.clQueue != nil {
		var outDevice C.cl_device_id
		err := C.clGetCommandQueueInfo(q.clQueue, C.CL_QUEUE_DEVICE, C.size_t(unsafe.Sizeof(outDevice)), unsafe.Pointer(&outDevice), nil)
		return &Device{id: outDevice}, toError(err)
	}
	return nil, toError(C.CL_INVALID_COMMAND_QUEUE)
}
Esempio n. 2
0
File: queue.go Progetto: xfong/tmpCL
func (q *CommandQueue) GetQueueContext() (*Context, error) {
	if q.clQueue != nil {
		var outContext C.cl_context
		err := C.clGetCommandQueueInfo(q.clQueue, C.CL_QUEUE_CONTEXT, C.size_t(unsafe.Sizeof(outContext)), unsafe.Pointer(&outContext), nil)
		return &Context{clContext: outContext, devices: nil}, toError(err)
	}
	return nil, toError(C.CL_INVALID_COMMAND_QUEUE)
}
Esempio n. 3
0
File: queue.go Progetto: xfong/tmpCL
func (q *CommandQueue) GetQueueProperties() (CommandQueueProperty, error) {
	if q.clQueue != nil {
		var outVar CommandQueueProperty
		err := C.clGetCommandQueueInfo(q.clQueue, C.CL_QUEUE_PROPERTIES, C.size_t(unsafe.Sizeof(outVar)), unsafe.Pointer(&outVar), nil)
		return outVar, toError(err)
	}
	return 0, toError(C.CL_INVALID_COMMAND_QUEUE)
}
Esempio n. 4
0
File: queue.go Progetto: xfong/tmpCL
func (q *CommandQueue) GetQueueReferenceCount() (CLUint, error) {
	if q.clQueue != nil {
		var outCount C.cl_uint
		err := C.clGetCommandQueueInfo(q.clQueue, C.CL_QUEUE_REFERENCE_COUNT, C.size_t(unsafe.Sizeof(outCount)), unsafe.Pointer(&outCount), nil)
		return CLUint(outCount), toError(err)
	}
	return 0, toError(C.CL_INVALID_COMMAND_QUEUE)
}
Esempio n. 5
0
func CLGetCommandQueueInfo(command_queue CL_command_queue,
	param_name CL_command_queue_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.clGetCommandQueueInfo(command_queue.cl_command_queue,
				C.cl_command_queue_info(param_name),
				C.size_t(param_value_size),
				nil,
				&c_param_value_size_ret)
		} else {
			switch param_name {
			case CL_QUEUE_CONTEXT:
				var value C.cl_context

				c_errcode_ret = C.clGetCommandQueueInfo(command_queue.cl_command_queue,
					C.cl_command_queue_info(param_name),
					C.size_t(param_value_size),
					unsafe.Pointer(&value),
					&c_param_value_size_ret)

				*param_value = CL_context{value}

			case CL_QUEUE_DEVICE:
				var value C.cl_device_id

				c_errcode_ret = C.clGetCommandQueueInfo(command_queue.cl_command_queue,
					C.cl_command_queue_info(param_name),
					C.size_t(param_value_size),
					unsafe.Pointer(&value),
					&c_param_value_size_ret)

				*param_value = CL_device_id{value}

			case CL_QUEUE_REFERENCE_COUNT,
				CL_QUEUE_SIZE:
				var value C.cl_uint

				c_errcode_ret = C.clGetCommandQueueInfo(command_queue.cl_command_queue,
					C.cl_command_queue_info(param_name),
					C.size_t(param_value_size),
					unsafe.Pointer(&value),
					&c_param_value_size_ret)

				*param_value = CL_uint(value)

			case CL_QUEUE_PROPERTIES:
				var value C.cl_command_queue_properties

				c_errcode_ret = C.clGetCommandQueueInfo(command_queue.cl_command_queue,
					C.cl_command_queue_info(param_name),
					C.size_t(param_value_size),
					unsafe.Pointer(&value),
					&c_param_value_size_ret)

				*param_value = CL_command_queue_properties(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)
	}
}
Esempio n. 6
0
File: package.go Progetto: mantyr/cl
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetCommandQueueInfo.html
func GetCommandQueueInfo(cq CommandQueue, paramName CommandQueueInfo, paramValueSize uint64, data unsafe.Pointer, paramValueSizeRet *uint64) ErrorCode {
	return ErrorCode(C.clGetCommandQueueInfo(cq, C.cl_command_queue_info(paramName), C.size_t(paramValueSize), data, (*C.size_t)(paramValueSizeRet)))
}