OpenCL™规范 3.2.2内核实例的执行

2023-12-18

3.2.2. Execution of kernel-instances
3.2.2内核实例的执行

The work carried out by an OpenCL program occurs through the execution of kernel-instances on compute devices. To understand the details of OpenCL’s execution model, we need to consider how a kernel object moves from the kernel-enqueue command, into a command-queue, executes on a device, and completes.

OpenCL程序执行的工作是通过在计算设备上执行内核实例来完成的。为了理解OpenCL执行模型的细节,我们需要考虑内核对象如何从内核入队命令移动到命令队列,在设备上执行并完成。

A kernel object is defined as a function within the program object and a collection of arguments connecting the kernel to a set of argument values. The host program enqueues a kernel object to the command queue along with the NDRange and the work-group decomposition. These define a kernel-instance . In addition, an optional set of events may be defined when the kernel is enqueued. The events associated with a particular kernel-instance are used to constrain when the kernel-instance is launched with respect to other commands in the queue or to commands in other queues within the same context.

内核对象被定义为程序对象中的函数和将内核连接到一组参数值的参数集合。主机程序将内核对象与NDRange和工作组分解一起排入命令队列。这些定义了一个内核实例。此外,当内核入队时,可以定义一组可选的事件。与特定内核实例相关联的事件用于约束内核实例何时相对于队列中的其他命令或同一上下文中的其他队列中的命令启动。

A kernel-instance is submitted to a device. For an in-order command queue, the kernel instances appear to launch and then execute in that same order; where we use the term appear to emphasize that when there are no dependencies between commands and hence differences in the order that commands execute cannot be observed in a program, an implementation can reorder commands even in an in-order command queue. For an out of order command-queue, kernel-instances wait to be launched until:

内核实例被提交到设备。对于按顺序排列的命令队列,内核实例似乎以相同的顺序启动并执行;我们使用这个术语似乎是为了强调,当命令之间没有依赖关系,因此在程序中无法观察到命令执行顺序的差异时,即使在有序的命令队列中,实现也可以对命令进行重新排序。对于无序的命令队列,内核实例等待启动,直到:

  • Synchronization commands enqueued prior to the kernel-instance are satisfied.

  • 满足在内核实例之前排队的同步命令。

  • Each of the events in an optional event list defined when the kernel-instance was enqueued are set to CL_COMPLETE .

  • ​内核实例入队时定义的可选事件列表中的每个事件都设置为CL_COMPLETE。

Once these conditions are met, the kernel-instance is launched and the work-groups associated with the kernel-instance are placed into a pool of ready to execute work-groups. This pool is called a work-pool . The work-pool may be implemented in any manner as long as it assures that work-groups placed in the pool will eventually execute. The device schedules work-groups from the work-pool for execution on the compute units of the device. The kernel-enqueue command is complete when all work-groups associated with the kernel-instance end their execution, updates to global memory associated with a command are visible globally, and the device signals successful completion by setting the event associated with the kernel-enqueue command to CL_COMPLETE .

​一旦满足这些条件,就会启动内核实例,并将与内核实例相关联的工作组放入准备执行的工作组池中。此池称为工作池。工作池可以以任何方式实现,只要它确保放置在池中的工作组最终会执行即可。设备调度工作池中的工作组,以便在设备的计算单元上执行。当与内核实例相关联的所有工作组结束执行时,内核入队命令完成,对与命令相关联的全局内存的更新全局可见,并且设备通过将与内核入队指令相关联的事件设置为CL_complete来发出成功完成的信号。

While a command-queue is associated with only one device, a single device may be associated with multiple command-queues all feeding into the single work-pool. A device may also be associated with command queues associated with different contexts within the same platform, again all feeding into the single work-pool. The device will pull work-groups from the work-pool and execute them on one or several compute units in any order; possibly interleaving execution of work-groups from multiple commands. A conforming implementation may choose to serialize the work-groups so a correct algorithm cannot assume that work-groups will execute in parallel. There is no safe and portable way to synchronize across the independent execution of work-groups since once in the work-pool, they can execute in any order.

虽然命令队列仅与一个设备相关联,但单个设备可以与多个命令队列相关联,所有命令队列都馈送到单个工作池中。设备还可以与同一平台内与不同上下文相关联的命令队列相关联,同样所有命令队列都馈送到单个工作池中。该设备将从工作池中提取工作组,并以任何顺序在一个或多个计算单元上执行它们;可能交错执行来自多个命令的工作组。一致性实现可以选择序列化工作组,因此正确的算法不能假设工作组将并行执行。没有安全和可移植的方式来跨工作组的独立执行进行同步,因为一旦进入工作池,它们就可以按任何顺序执行。

The work-items within a single sub-group execute concurrently but not necessarily in parallel (i.e. they are not guaranteed to make independent forward progress). Therefore, only high-level synchronization constructs (e.g. sub-group functions such as barriers) that apply to all the work-items in a sub-group are well defined and included in OpenCL.

单个子组中的工作项同时执行,但不一定是并行的(即不能保证它们独立向前推进)。因此,只有应用于子组中所有工作项的高级同步结构(例如,子组功能,如栅栏)才被很好地定义并包含在OpenCL中。

Sub-groups are missing before version 2.1.

2.1版本之前缺少子组。

Sub-groups execute concurrently within a given work-group and with appropriate device support (see Querying Devices ), may make independent forward progress with respect to each other, with respect to host threads and with respect to any entities external to the OpenCL system but running on an OpenCL device, even in the absence of work-group barrier operations. In this situation, sub-groups are able to internally synchronize using barrier operations without synchronizing with each other and may perform operations that rely on runtime dependencies on operations other sub-groups perform.

​子组在给定的工作组内同时执行,并具有适当的设备支持(请参阅查询设备),可以相对于彼此、相对于主机线程以及相对于OpenCL系统外部但在OpenCL设备上运行的任何实体进行独立的前向进程,即使在没有工作组栅栏操作的情况下也是如此。在这种情况下,子组能够使用栅栏操作进行内部同步,而无需彼此同步,并且可以执行依赖于其他子组执行的操作的运行时依赖性的操作。

The work-items within a single work-group execute concurrently but are only guaranteed to make independent progress in the presence of sub-groups and device support. In the absence of this capability, only high-level synchronization constructs (e.g. work-group functions such as barriers) that apply to all the work-items in a work-group are well defined and included in OpenCL for synchronization within the work-group.

单个工作组中的工作项同时执行,但只有在有子组和设备支持的情况下才能保证独立进行。在缺乏这种能力的情况下,只有应用于工作组中所有工作项的高级同步结构(例如,工作组功能,如栅栏)才能很好地定义并包含在OpenCL中,用于在工作组内进行同步。

In the absence of synchronization functions (e.g. a barrier), work-items within a sub-group may be serialized. In the presence of sub -group functions, work-items within a sub -group may be serialized before any given sub -group function, between dynamically encountered pairs of sub-group functions and between a work-group function and the end of the kernel.

在没有同步功能(例如栅栏)的情况下,子组内的工作项可以被序列化。在存在子组函数的情况下,子组内的工作项可以在任何给定的子组函数之前、在动态遇到的子组功能对之间以及在工作组函数和内核的末尾之间进行序列化。

In the absence of independent forward progress of constituent sub-groups, work-items within a work-group may be serialized before, after or between work-group synchronization functions.

在不存在组成子组的独立正向进度的情况下,工作组内的工作项可以在工作组同步功能之前、之后或之间序列化。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

OpenCL™规范 3.2.2内核实例的执行 的相关文章

  • 有关 OpenCL 内核编程的教程或书籍? [关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我认为这个问题足够具体 只是为了说清楚 我不是在寻找参考 而是在寻找教程 我对内核编程方面特别感兴趣 市
  • 并行化 std::nth_element 和 std::partition

    我正在移植使用的 C 代码std nth element and std partition到 OpenCL nth element http www cplusplus com reference algorithm nth elemen
  • OpenCL 双精度与 CPU 双精度不同

    我正在 Linux 中使用 GeForce GT 610 卡进行 OpenCL 编程 我的CPU和GPU双精度结果不一致 我可以在这里发布部分代码 但我首先想知道是否有其他人遇到过这个问题 当我运行多次迭代的循环时 GPU 和 CPU 双精
  • 为什么 AMD GCN 使用非零 NULL?

    这次提交 https reviews llvm org rL289252 says In amdgcn https en wikipedia org wiki Graphics Core Next目标 全局 常量和通用地址空间中的空指针取值
  • OpenCL 编译器预处理定义?

    我正在 Snow Leopard 上开发 OpenCL 代码 并且了解 OpenCL 即时编译是由 Clang LLVM 完成的 是否使用了 C 预处理器 有没有办法使用编译器设置预处理定义 存在哪些定义 我希望代码知道它是为 CPU 还是
  • OpenCL clGetPlatformIDs 异常

    我使用此包安装附带的示例中的 HelloWorld 示例 AMD 套件 http developer amd com tools and sdks heterogeneous computing amd accelerated parall
  • 如何消除 opencl 代码中的 CL_INVALID_PLATFORM 错误?

    使用 OpenCL 进行简单的矩阵乘法 Multiply two matrices A B C include
  • 有适用于 mac os X 10.8 的 opencl 分析器吗?

    我试图找到 OpenCL 内核中的瓶颈 是否可以在 mac os X 上分析 OpenCL 程序 我发现 gDebuggerhttp www gremedy com http www gremedy com 但需要 10 5 或 10 6
  • 如何在 Docker 容器内运行 OpenCL + OpenGL?

    目的是在 Docker 容器内运行 OpenCL OpenGL 互操作 应用程序 但我还没有成功 Intro 我有配备 NVidia 显卡的笔记本电脑 因此我认为利用 NVidia Dockerfiles 1 2 将是一个很好的起点 以下
  • 为什么会有 CL_DEVICE_MAX_WORK_GROUP_SIZE?

    我试图了解 OpenCL 设备 例如 GPU 的体系结构 但我不明白为什么本地工作组中的工作项数量有明确的限制 即常量 CL DEVICE MAX WORK GROUP SIZE 在我看来 这应该由编译器处理 即 如果 为简单起见 一维 内
  • OpenCL:在内核中手动引发异常

    是否可以在 OpenCL 中手动引发异常 仅用于调试目的 我的代码中有一个非常奇怪的错误 当我计算两个双精度值并将它们相加时 主机报告 CL OUT OF RESOURCE 但是 如果我不添加这两个值 主机不会报告任何错误 OpenCL 不
  • Linux 上的 OpenCL 编译

    我是 OpenCL 的新手 从昨天开始 我尝试使用 OpenCL 进行并行编程 而不是使用我更熟悉且以前体验过的 CUDA 现在我有 NVIDIA GTX 580 GPU Ubuntu Linux 12 04 操作系统和 CUDA SDK
  • 如何在 pyopencl 中创建可变大小的 __local 内存?

    在我的 C OpenCL 代码中我使用clSetKernelArg创建 可变尺寸 local我的内核中使用的内存 OpenCL 本身不提供该内存 看我的例子 clSetKernelArg clKernel ArgCounter sizeof
  • 是否可以保证 WaveFront (OpenCL) 中的所有线程始终同步?

    众所周知 有WARP 在CUDA中 和WaveFront 在OpenCL中 http courses cs washington edu courses cse471 13sp lectures GPUsStudents pdf http
  • AMD OpenCL 在 Linux 上工作所需的最小必要文件子集是什么?

    我已经使用 buildroot 构建了 Linux 内核 我已将开源 amdgpu 驱动程序和所需的固件合并到其中 驱动程序很好 检测 GPU 模式设置运行良好 调整 小文本 的分辨率 启动后会显示命令行 现在我需要运行 OpenCL 程序
  • 如何在 opencv 3.0 Beta 中从文件读取 UMat?

    我想用UMat所以我的代码可以使用 OpenCL OpenCV 3 0 0 Beta 在 GPU 和 CPU 上运行 但我找不到将图像文件读入的方法UMat或转换一个Mat to UMat 如何将图像读入UMat 样品用于Mat to UM
  • HUGE_VALF 和 INFINITY 常量之间的区别

    在 OpenCL 中 有两个代表无穷大的浮点数学常数 其中之一很简单INFINITY 另一个 HUGE VALF 求值为 无穷大 这两者有什么区别 求值至 无穷大是什么意思 HUGE VALF是一个旧名称 允许不支持无穷大的浮点系统 例如
  • OSX 上的 ATI OpenCL SDK

    我拥有 ATI GK 的新 MPB 我很好奇 我是否可以下载 OSX 的 sdk 特别是示例集合和分析器 或者我必须本地运行 Windows Linux 因为我只找到了 Windows 和 Linux 的版本 提前致谢 只要您有 Mac O
  • OpenCL 内核参数中的 Char***?

    我需要通过一个vector
  • PyOpenCL:如何创建本地内存缓冲区?

    这里可能是非常简单的问题 但我已经搜索了几个小时但没有任何结果 我有这段代码 我希望有一个 256 位 8 uint32 bitstring gpu 作为设备中的本地内存指针 def Get Bitstring GPU Buffer ctx

随机推荐

  • 用于添加新内容的四个 jQuery 方法

    通过jQuery 可以很容易地添加新元素 内容 添加新的HTML内容 我们将学习用于添加新内容的四个jQuery方法 append 在被选元素的结尾插入内容 prepend 在被选元素的开头插入内容 after 在被选元素之后插入内容 be
  • ADP荣膺Everest Group、NelsonHall和Ventana Research评选为全球薪酬市场领导者

    中国上海 2023年12月18日 近日 在三家行业领先的分析机构发布的报告中 ADP 被评为全球薪酬市场的卓越领导者 这三份报告分别由Everest Group NelsonHall 和Ventana Research 现隶属于ISG 编写
  • 题解 | #浙江大学用户题目回答情况#

    快手测开二面面经 国企面经 多家 得物 测开 一面 中国联通陕西省分公司薪资待遇 京东健康前端实习一面凉经 求java推荐项目 面经回馈 秋招及实习历程中笔经 面经 时间梳理 国企银行 秒杀项目常见问题 终焉篇 双非本产品经理35w 终于来
  • 24届还有在看工作机会的吗,求求大家看下小米吧,HC非常多

    一定要反问HR的六个问题 offer比较 华为 vs OPPO 离谱的一周 百度裁应届 拼多多 非必要就别去了吧 阿里云25k gt 美团29k 实习转正啦 进来看耍猴 12 17更新 25届实习招聘信息汇总走起 策论 设计产出 Learn
  • js小技巧 时间格式化 年月日、时间格式化 年月日时分秒

    时间格式化 年月日 export function timestampToTime timestamp var date new Date timestamp 时间戳为10位需 1000 时间戳为13位的话不需乘1000 var Y dat
  • 一级浪涌保护器的行业应用解决方案

    一级浪涌保护器是防雷系统中最重要的一环 它主要用于建筑物总配电柜 低压变压器进线柜等位置 防止浪涌电压直接从外部传导进入内部 使系统设备免遭雷击损坏 一级浪涌保护器的规范要求 应用 作用和原理以及国标 本文将分别进行介绍 一 一级浪涌保护器
  • 快速处理EDI数据映射:知行EDI Profiler 操作指南

    一个完整的EDI项目通常由建立传输通道 处理数据映射以及集成内部业务系统三部分组成 对用户而言 基于知行之桥EDI系统进行自主实施最大的挑战便是处理数据映射 EDI报文读不懂 映射关系太复杂 这些问题给企业造成困扰的同时也阻挡了自主实施ED
  • Codeforces Round 915 (Div. 2) A-F(补题&补写法)

    A Constructive Problems 签到 题解 输出max x y t int input for in range t u v map int input split print max u v B Begginer s Ze
  • 最新AI创作系统ChatGPT系统源码+DALL-E3文生图+支持AI绘画+GPT语音对话功能

    一 AI创作系统 SparkAi创作系统是基于ChatGPT进行开发的Ai智能问答系统和Midjourney绘画系统 支持OpenAI GPT全模型 国内AI全模型 本期针对源码系统整体测试下来非常完美 可以说SparkAi是目前国内一款的
  • Toyota Programming Contest 2023#8(AtCoder Beginner Contest 333)G. Nearest Fraction(有理实数求分母不超过n的最优逼近)

    题目 给一个不超过1的实数r r最多18位小数 和一个分母n n lt 1e10 求分母不超过n的与该有理实数的最优逼近 即二者绝对值之差最小 有理实数显然可以转成分数 思路来源 官方题解 farey序列论文 一类分数问题的研究 pdf 题
  • FL Studio21.2.2963水果音乐软件安装

    FL Studio是功能强大的音乐制作解决方案 使用旨在为用户提供一个友好完整的音乐创建环境 让您能够轻松创建 管理 编辑 混合具有专业品质的音乐 一切的一切都集中在一个软件中 只要您想 只要您需要 它总能满足您的音乐需求 工具方面 包括强
  • Git常用总结

    Git常用总结 Date August 6 2023 项目目前常用代码 常用总结 暂存所有文件 git add 提交版本记录 git commit m 将仓库文件提交到远程仓库 git push 查看版本号 git reflog 回退版本
  • 如何基于企业需求,又便宜又快地定制开发一套CRM客户管理系统?

    如何基于企业需求 又便宜又快地定制开发一套CRM客户管理系统 定制开发CRM客户管理系统是为了满足企业个性化需求而进行的 它可以帮助企业提高客户关系管理效率 提供更好的客户服务和实现精细化运营 本文将为大家介绍CRM定制开发的搭建流程以及如
  • 微积分的链式法则

    微积分的链式法则 两个函数相乘如何求导 https blog csdn net zhangyingjie09 article details 88620119 导数的四则运算法则之一的乘法 链式法则 导数的乘法 是不一样的哦
  • NodeJS药店药品进销存管理系统-计算机毕设 附源码 70874

    node js 药店药品进销存管理系统 摘 要 随着科学技术的飞速发展 各行各业都在努力与现代先进技术接轨 通过科技手段提高自身的优势 对于药店药品进销存管理系统当然也不能排除在外 随着网络技术的不断成熟 带动了药店药品进销存管理系统 它彻
  • 如何写一个二阶的偏微分方程?写一个混合偏微分方程。

    如何写一个二阶的偏微分方程 写一个混合偏微分方程 https blog csdn net ChenglinBen article details 95644133 二阶混合偏导 Second order mixed derivatives
  • 网络安全之等保 2.0 测评

    一 身份鉴别 a 应对登录的用户进行身份标识和鉴别 身份标识具有唯一性 身份鉴别信息具有复杂度要求并定期更换 1 登录 mysql 查看是否使用了口令和密码的组合鉴别身份 mysql h 192 168 100 16 u root p 2
  • c语言题 身份证的奥秘

    题目 身份证的奥秘 题述无关部分已略 1 十七位数字本体码加权求和公式 S Sum Ai Wi i 0 16 先对前17位数字的权求和 Ai 表示第i位置上的身份证号码数字值 Wi 表示第i位置上的加权因子 Wi 7 9 10 5 8 4
  • 【网安入门】怎样花3个月零基础入门网络安全?

    写这篇教程的初衷是很多朋友都想了解如何入门 转行网络安全 实现自己的 黑客梦 文章的宗旨是 1 指出一些自学的误区 2 提供客观可行的学习表 3 推荐我认为适合小白学习的资源 大佬绕道哈 一 自学网络安全学习的误区和陷阱 1 不要试图先成为
  • OpenCL™规范 3.2.2内核实例的执行

    3 2 2 Execution of kernel instances 3 2 2内核实例的执行 The work carried out by an OpenCL program occurs through the execution