OpenCL 是否在 OpenCL 上下文之间具有共享上下文功能? [英] Does OpenCL have shared context feature between OpenCL contexts?

查看:85
本文介绍了OpenCL 是否在 OpenCL 上下文之间具有共享上下文功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像与 opengl 共享缓冲区一样,而是与另一个 opencl 共享.就像将缓冲区迁移到另一个 opencl 上下文但没有事件依赖性一样.

Just like sharing buffers with opengl but another opencl instead. Just like migrating a buffer to another opencl context but without event dependency.

我找不到关于它的任何信息,但我需要将一个 opencl 缓冲区数据复制到另一个使用相同设备的 opencl 上下文缓冲区,并且我需要它远离主机端副本.我需要设备端(到/从同一设备)缓冲区复制.此外,我使用的缓冲区有许多附加到其操作的事件.

I couldn't find any info about it but I need to copy an opencl buffer data to another opencl context buffer that uses same device and I need it stay away from host side copies. I need device-side (to/from same device) buffer copy. Also the buffers I'm using have many events attached to their operations.

我正在处理的一个项目有多个上下文计算,不同内核和多个 GPU 使用双缓冲管道,我试图在不接触 pci-e 桥的情况下将相同的行为适应单个 GPU.

A project I'm working on has multiple contexts computing with different kernels with multiple GPUs using double-buffered pipeline and I'm trying to fit same behavior to a single GPU without touching pci-e bridge.

推荐答案

您不能直接在 OpenCL 上这样做,因为内存是按上下文分配的.请注意,如果平台支持,同一上下文中可以有多个设备,并且同一上下文中的所有设备将共享相同的内存对象.迁移队列操作对每个设备上的内存分配进行粒度控制(尽管这不是必需的).

You cannot do that directly on OpenCL, since memory is allocated per-context. Note that there can be multiple devices in the same context if the platform supports it, and all devices in the same context will share the same memory object. A migration queue operation allows fine grain control over memory allocation on each device (although this is not required).

使用 SYCL(基于 OpenCL 的 Khronos 标准)时,缓冲区与上下文无关,并且运行时在需要时跨上下文迁移数据.在这种情况下,运行时将选择最合适的方法来进行跨上下文的传输.例如,如果平台具有特定于供应商的功能以允许以有效的方式进行此操作,则运行时将利用它而无需使用交互.

When using SYCL(A Khronos standard based on OpenCL), buffers are context-independent, and the runtime migrate data across context whenever is required. In this case, the runtime will chose the most appropriate method to do the transfer across contexts. For example, if the platform has a vendor-specific feature to allow this operation in an efficient way, the runtime will take advantage of it w/o requiring using interaction.

这篇关于OpenCL 是否在 OpenCL 上下文之间具有共享上下文功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆