如何使用2个OpenCL运行时 [英] How to use 2 OpenCL runtimes

查看:119
本文介绍了如何使用2个OpenCL运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个系统中一起使用2个OpenCL运行时(在我的情况下是AMD和Nvidia,但问题很笼统).

I want to use 2 OpenCL runtimes in one system together (in my case AMD and Nvidia, but the question is pretty generic).

我知道我可以使用任何SDK编译我的程序.但是在运行程序时,我需要提供libOpenCL.so.如何提供两个运行时的库,以便在OpenCL程序中看到3个设备(AMD CPU,AMD GPU,Nvidia GPU)?

I know that I can compile my program with any SDK. But when running the program, I need to provide libOpenCL.so. How can I provide the libs of both runtimes so that I see 3 devices (AMD CPU, AMD GPU, Nvidia GPU) in my OpenCL program?

我知道一定有可能实现,但是我还没有找到关于如何在linux上进行描述的说明.

I know that it must be possible somehow, but I didn't find a description on how to do it for linux, yet.

非常感谢, 托马斯

推荐答案

史密斯和托马斯的答案是正确的;这只是在该信息上扩展:枚举OpenCL平台时,每个安装的驱动程序都会得到一个.在每个平台中,您都将枚举设备. AMD和Intel驱动程序还公开了CPU设备.因此,在人满为患的计算机上,您可能会看到一个AMD平台(带有CPU和GPU设备),一个NVIDIA平台(带有GPU设备)和一个英特尔平台(带有CPU和GPU设备).您的代码会在要使用的任何设备上创建上下文,并且一个或多个命令队列可以为它们工作.您可以让他们全都忙于处理事情,但是您只能在同一平台上的设备之间共享数据缓冲区.要跨平台共享数据,它必须在两者之间占用CPU内存.

The Smith and Thomas answers are correct; this is just expanding on that information: When you enumerate the OpenCL platforms, you'll get one for each installed driver. Within each platform you enumerate the devices. The AMD and Intel drivers also expose CPU devices. So on a fully populated machines, you might see an AMD platform (with CPU and GPU devices), an NVIDIA platform (with GPU device), and an Intel platform (with CPU and GPU devices). Your code creates a context on whichever devices you want to use, and one or more command queues to feed them work. You can keep them all busy working on things, but you can only share data buffers between devices from the same platform. To share data across platforms, it must hit CPU memory in between.

这篇关于如何使用2个OpenCL运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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