OpenCL™规范 5.12. 标记、屏障和等待事件

5.12. Markers, Barriers and Waiting for Events

5.12. 标记、屏障和等待事件

To enqueue a marker command which waits for events or commands to complete, call the function

要将等待事件或命令完成的标记命令排队,请调用函数

// Provided by CL_VERSION_1_2
cl_int clEnqueueMarkerWithWaitList(
    cl_command_queue command_queue,
    cl_uint num_events_in_wait_list,
    const cl_event* event_wait_list,
    cl_event* event);

clEnqueueMarkerWithWaitList is missing before version 1.2.

clEnqueueMarkerWithWaitList在1.2版本之前缺失。

  • command_queue is a valid host command-queue.

  • command_queue是一个有效的主机命令队列。

  • event_wait_list and num_events_in_wait_list specify events that need to complete before this particular command can be executed.

  • event_wait_list 和num_events_in_wait_list 指定了在执行此特定命令之前需要完成的事件。

  • event returns an event object that identifies this command and can be used to query or wait for this command to complete. If event is NULL or the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are not NULLevent must not refer to an element of the event_wait_list array.

  • event返回一个事件对象,该对象标识此命令,可用于查询或等待此命令完成。如果event 为NULL或排队不成功,则不会创建任何事件,因此无法查询此命令的状态或等待此命令完成。若event_wait_list和event不为NULL,则事件不得引用event_wait_list数组的元素。

If event_wait_list is NULLnum_events_in_wait_list must be 0. If event_wait_list is not NULL, the list of events pointed to by event_wait_list must be valid and num_events_in_wait_list must be greater than 0. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_queue must be the same. The memory associated with event_wait_list can be reused or freed after the function returns.

如果event_wait_list为NULL,则num_events_in_wait_lit必须为0。如果event_wait_list不为NULL,则event_wait_list指向的事件列表必须有效,num_events_in_wait_list必须大于0。event_wait_list中指定的事件充当同步点。与event_wait_list和command_queue中的事件关联的上下文必须相同。函数返回后,可以重用或释放与event_wait_list关联的内存。

If event_wait_list is NULL, then this particular command waits until all previous enqueued commands to command_queue have completed.

如果event_wait_list为NULL,则此特定命令将等待,直到所有先前向command_queue排队的命令都已完成。

The marker command either waits for a list of events to complete, or if the list is empty it waits for all commands previously enqueued in command_queue to complete before it completes. This command returns an event which can be waited on, i.e. this event can be waited on to insure that all events either in the event_wait_list or all previously enqueued commands, queued before this command to command_queue, have completed.

marker命令要么等待事件列表完成,要么如果列表为空,则等待之前在command_queue中排队的所有命令完成,然后再完成。此命令返回一个可以等待的事件,即可以等待此事件以确保event_wait_list中的所有事件或在此命令之前排队到command_queue的所有先前排队的命令都已完成。

clEnqueueMarkerWithWaitList returns CL_SUCCESS if the function is successfully executed. Otherwise, it returns one of the following errors:

如果函数成功执行,clEnqueueMarkerWithWaitList将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMD_QUEUE(如果command_queue 不是有效的主机命令队列)。

  • CL_INVALID_CONTEXT if context associated with command_queue and events in event_wait_list are not the same.

  • 如果与command_queue关联的上下文和event_wait_list中的事件不相同,则返回CL_INVALID_CONTEXT。

  • CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.

  • 如果event_wait_list 为NULL且num_events_in_wait_list >0,或者event_wait_list 不为NULL且num_events_in_wait_list 为0,或者event_wait_list 中的事件对象不是有效事件,则CL_INVALID_EVENT_WAIT_LIST。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果无法在设备上分配OpenCL实现所需的资源。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。

To enqueue a marker command which waits for previous commands to complete, call the function

要将等待前一个命令完成的标记命令排队,请调用函数

// Provided by CL_VERSION_1_0
cl_int clEnqueueMarker(
    cl_command_queue command_queue,
    cl_event* event);

clEnqueueMarker is deprecated by version 1.2.

clEnqueueMarker在1.2版本中已弃用。

  • command_queue is a valid host command-queue.

  • command_queue是一个有效的主机命令队列。

  • event returns an event object that identifies this command and can be used to query or wait for this command to complete. If event is NULL or the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are not NULLevent must not refer to an element of the event_wait_list array.

  • event返回一个事件对象,该对象标识此命令,可用于查询或等待此命令完成。如果event 为NULL或排队不成功,则不会创建任何事件,因此无法查询此命令的状态或等待此命令完成。若event_wait_list和event不为NULL,则event 不得引用event_wait_list 数组的元素。

The marker command waits for all commands previously enqueued in command_queue to complete before it completes. This command returns an event which can be waited on, i.e. this event can be waited on to insure that all previously enqueued commands, queued before this command to command_queue, have completed.

marker命令在完成之前等待先前在command_queue中排队的所有命令完成。此命令返回一个可以等待的事件,即可以等待此事件以确保在此命令之前排队到command_queue的所有先前排队的命令都已完成。

clEnqueueMarker returns CL_SUCCESS if the function is successfully executed. Otherwise, it returns one of the following errors:

如果函数成功执行,clEnqueueMarker将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMD_QUEUE(如果command_queue 不是有效的主机命令队列)。

  • CL_INVALID_VALUE if event is NULL.

  • 如果event 为空,则返回CL_INVALID_VALUE。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果无法在设备上分配OpenCL实现所需的资源。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。

To enqueue a wait for a specific event or a list of events to complete before any future commands queued in a command-queue are executed, call the function

要在执行命令队列中排队的任何未来命令之前排队等待特定事件或事件列表完成,请调用以下函数

// Provided by CL_VERSION_1_0
cl_int clEnqueueWaitForEvents(
    cl_command_queue command_queue,
    cl_uint num_events,
    const cl_event* event_list);

clEnqueueWaitForEvents is deprecated by version 1.2.

clEnqueueWaitForEvents在1.2版本中已弃用。

  • command_queue is a valid host command-queue.

  • command_queue是一个有效的主机命令队列。

  • event_list and num_events specify events that need to complete before this particular command can be executed.

  • event_list 和num_events 指定了在执行此特定命令之前需要完成的事件。

The events specified in event_list act as synchronization points. The context associated with events in event_list and command_queue must be the same. The memory associated with event_list can be reused or freed after the function returns.

event_list中指定的事件充当同步点。与event_list和command_queue中的事件关联的上下文必须相同。函数返回后,可以重用或释放与event_list关联的内存。

clEnqueueWaitForEvents returns CL_SUCCESS if the function is successfully executed. Otherwise, it returns one of the following errors:

如果函数成功执行,clEnqueueWaitForEvents将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMD_QUEUE(如果command_queue 不是有效的主机命令队列)。

  • CL_INVALID_CONTEXT if context associated with command_queue and events in event_list are not the same.

  • 如果与command_queue关联的上下文和event_list中的事件不相同,则返回CL_INVALID_CONTEXT。

  • CL_INVALID_VALUE if num_events is 0 or event_list is NULL.

  • 如果num_events为0或event_list为NULL,则CL_INVALID_VALUE。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果无法在设备上分配OpenCL实现所需的资源。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。

To enqueue a barrier command which waits for events or commands to complete, call the function

要将等待事件或命令完成的屏障命令排队,请调用函数

// Provided by CL_VERSION_1_2
cl_int clEnqueueBarrierWithWaitList(
    cl_command_queue command_queue,
    cl_uint num_events_in_wait_list,
    const cl_event* event_wait_list,
    cl_event* event);

clEnqueueBarrierWithWaitList is missing before version 1.2.

clEnqueueBarrierWithWaitList在1.2版本之前缺失。

  • command_queue is a valid host command-queue.

  • command_queue是一个有效的主机命令队列。

  • event_wait_list and num_events_in_wait_list specify events that need to complete before this particular command can be executed.

  • event_wait_list 和num_events_in_wait_list 指定了在执行此特定命令之前需要完成的事件。

  • If event_wait_list is NULLnum_events_in_wait_list must be 0. If event_wait_list is not NULL, the list of events pointed to by event_wait_list must be valid and num_events_in_wait_list must be greater than 0. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_queue must be the same. The memory associated with event_wait_list can be reused or freed after the function returns.

  • 如果event_wait_list为NULL,则num_events_in_wait_lit必须为0。如果event_wait_list不为NULL,则event_wait_list 指向的事件列表必须有效,num_events_in_wait_list 必须大于0。event_wait_list中指定的事件充当同步点。与event_wait_list和command_queue中的事件关联的上下文必须相同。函数返回后,可以重用或释放与event_wait_list关联的内存。

  • event returns an event object that identifies this command and can be used to query or wait for this command to complete. If event is NULL or the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are not NULLevent must not refer to an element of the event_wait_list array.

  • event返回一个事件对象,该对象标识此命令,可用于查询或等待此命令完成。如果event 为NULL或排队不成功,则不会创建任何事件,因此无法查询此命令的状态或等待此命令完成。若event_wait_list和event不为NULL,则事件不得引用event_wait_list 数组的元素。

If event_wait_list is NULL, then this particular command waits until all previous enqueued commands to command_queue have completed.

如果event_wait_list为NULL,则此特定命令将等待,直到所有先前向command_queue排队的命令都已完成。

The barrier command either waits for a list of events to complete, or if the list is empty it waits for all commands previously enqueued in command_queue to complete before it completes. This command blocks command execution, that is, any following commands enqueued after it do not execute until it completes. This command returns an event which can be waited on, i.e. this event can be waited on to insure that all events either in the event_wait_list or all previously enqueued commands, queued before this command to command_queue, have completed.

barrier命令要么等待事件列表完成,要么如果列表为空,则等待之前在command_queue中排队的所有命令完成,然后再完成。此命令阻止命令执行,也就是说,在它完成之后排队的任何后续命令都不会执行。此命令返回一个可以等待的event ,即可以等待此事件以确保event_wait_list中的所有事件或在此命令之前排队到command_queue的所有先前排队的命令都已完成。

clEnqueueBarrierWithWaitList returns CL_SUCCESS if the function is successfully executed. Otherwise, it returns one of the following errors:

如果函数成功执行,clEnqueueBarrierWithWaitList将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMAND_QUEUE(如果command_queue 不是有效的主机命令队列)。

  • CL_INVALID_CONTEXT if context associated with command_queue and events in event_wait_list are not the same.

  • 如果与command_queue关联的上下文和event_wait_list中的事件不相同,则返回CL_INVALID_CONTEXT。

  • CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.

  • 如果event_wait_list 为NULL且num_events_in_wait_list >0,或者event_wait_list 不为NULL且num_events_in_wait_list 为0,或者event_wait_list 中的事件对象不是有效事件,则CL_INVALID_EVENT_WAIT_LIST。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果无法在设备上分配OpenCL实现所需的资源。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。

To enqueue a barrier command which waits for commands to complete, call the function

要将等待命令完成的屏障命令排队,请调用函数

// Provided by CL_VERSION_1_0
cl_int clEnqueueBarrier(
    cl_command_queue command_queue);

clEnqueueBarrier is deprecated by version 1.2.

clEnqueueBarrier在1.2版本中已弃用。

  • command_queue is a valid host command-queue.

  • command_queue是一个有效的主机命令队列。

The barrier command waits for all commands previously enqueued in command_queue to complete before it completes. This command blocks command execution, that is, any following commands enqueued after it do not execute until it completes. The barrier command is a synchronization point.

barrier命令在完成之前等待之前在command_queue中排队的所有命令完成。此命令阻止命令执行,也就是说,在它完成之后排队的任何后续命令都不会执行。屏障命令是一个同步点。

clEnqueueBarrier returns CL_SUCCESS if the function is successfully executed. Otherwise, it returns one of the following errors:

如果函数成功执行,clEnqueueBarrier将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMD_QUEUE(如果command_queue 不是有效的主机命令队列)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果无法在设备上分配OpenCL实现所需的资源。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值