Beispiel #1
0
func CLCreateCommandQueueWithProperties(context CL_context,
	device CL_device_id,
	properties []CL_command_queue_properties,
	errcode_ret *CL_int) CL_command_queue {
	var c_errcode_ret C.cl_int
	var c_command_queue C.cl_command_queue

	var c_properties []C.cl_command_queue_properties
	var c_properties_ptr *C.cl_command_queue_properties

	if properties != nil {
		c_properties = make([]C.cl_command_queue_properties, len(properties))
		for i := 0; i < len(properties); i++ {
			c_properties[i] = C.cl_command_queue_properties(properties[i])
		}
		c_properties_ptr = &c_properties[0]
	} else {
		c_properties_ptr = nil
	}

	c_command_queue = C.clCreateCommandQueueWithProperties(context.cl_context,
		device.cl_device_id,
		c_properties_ptr,
		&c_errcode_ret)

	if errcode_ret != nil {
		*errcode_ret = CL_int(c_errcode_ret)
	}

	return CL_command_queue{c_command_queue}
}
Beispiel #2
0
func (c *Context) NewCommandQueue(device Device, param CommandQueueParameter) (*CommandQueue, error) {
	var c_queue C.cl_command_queue
	var err C.cl_int
	if c_queue = C.clCreateCommandQueue(c.id, device.id, C.cl_command_queue_properties(param), &err); err != C.CL_SUCCESS {
		return nil, Cl_error(err)
	}
	queue := &CommandQueue{id: c_queue}
	runtime.SetFinalizer(queue, (*CommandQueue).release)

	return queue, nil
}
Beispiel #3
0
func (ctx *Context) CreateCommandQueue(device *Device, properties CommandQueueProperty) (*CommandQueue, error) {
	var err C.cl_int
	clQueue := C.clCreateCommandQueue(ctx.clContext, device.id, C.cl_command_queue_properties(properties), &err)
	if err != C.CL_SUCCESS {
		return nil, toError(err)
	}
	if clQueue == nil {
		return nil, ErrUnknown
	}
	commandQueue := &CommandQueue{clQueue: clQueue, device: device}
	runtime.SetFinalizer(commandQueue, releaseCommandQueue)
	return commandQueue, nil
}
Beispiel #4
0
func CLCreateCommandQueue(context CL_context,
	device CL_device_id,
	properties CL_command_queue_properties,
	errcode_ret *CL_int) CL_command_queue {
	var c_errcode_ret C.cl_int
	var c_command_queue C.cl_command_queue

	c_command_queue = C.clCreateCommandQueue(context.cl_context,
		device.cl_device_id,
		C.cl_command_queue_properties(properties),
		&c_errcode_ret)

	if errcode_ret != nil {
		*errcode_ret = CL_int(c_errcode_ret)
	}

	return CL_command_queue{c_command_queue}
}
Beispiel #5
0
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetCommandQueueProperty.html
func SetCommandQueueProperty(cq CommandQueue, properties CommandQueueProperties, enable BOOL, oldproperties *CommandQueueProperties) int {
	return ErrorCode(C.clSetCommandQueueProperty(cq, C.cl_command_queue_properties(properties), C.cl_bool(enable), (*C.cl_command_queue_properties)(oldproperties)))
}
Beispiel #6
0
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateCommandQueue.html
func CreateCommandQueue(context Context, did DeviceId, properties CommandQueueProperties, errcode *ErrorCode) CommandQueue {
	return CommandQueue(C.clCreateCommandQueue(context.clContext, did, C.cl_command_queue_properties(properties), (*C.cl_int)(errcode)))
}