OpenCL发行 [英] OpenCL distribution

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

问题描述

我目前正在为一组非常异构的计算机(具体使用JavaCL)开发OpenCL应用程序.为了最大程度地提高性能,我想使用GPU(如果有),否则我希望退回到CPU并使用SIMD指令.我的计划是使用向量类型实现OpenCL代码,因为我的理解是这允许CPU将指令向量化并使用SIMD指令.

I'm currently developing an OpenCL-application for a very heterogeneous set of computers (using JavaCL to be specific). In order to maximize performance I want to use a GPU if it's available otherwise I want to fall back to the CPU and use SIMD-instructions. My plan is to implement the OpenCL-code using vector-types because my understanding is that this allows CPUs to vectorize the instructions and use SIMD-instructions.

但是我的问题是关于使用哪个OpenCL实现.例如.如果计算机具有Nvidia GPU,我认为最好使用Nvidia的库,但是如果没有GPU,我想使用Intel的库来使用SIMD指令.

My question however is regarding which OpenCL-implementation to use. E.g. if the computer has a Nvidia GPU I assume it's best to use Nvidia's library but if no GPU is available I want to use Intel's library to use the SIMD-instructions.

我该如何实现?这是自动处理的吗?还是我必须包括所有库并实现一些逻辑以选择正确的库?感觉这是一个比我面临的人更多的问题.

How do I achieve this? Is this handled automatically or do I have to include all libraries and implement some logic to pick the right one? It feels like this is a problem that more people than I are facing.

更新 在测试了不同的OpenCL驱动程序之后,到目前为止,这是我的经验:

Update After testing the different OpenCL-drivers this is my experience so far:

  • Intel :当JavaCL尝试调用JVM时,JVM崩溃了.重新启动后,它没有使JVM崩溃,但也没有返回任何可用的 设备(我使用的是Intel I7-CPU).当我编译 离线的OpenCL代码似乎可以执行一些操作 自动向量化,因此Intel的编译器看起来非常不错.

  • Intel: crashed the JVM when JavaCL tried to call it. After a restart it didn't crash the JVM but it also didn't return any usable devices (I was using an Intel I7-CPU). When I compiled the OpenCL-code offline it seemed to be able to do some auto-vectorization so Intel's compiler seems quite nice.

Nvidia :拒绝安装其WHQL驱动程序,因为它声称我没有Nvidia卡(该计算机具有Geforce GT 330M).什么时候 我尝试在另一台计算机上尝试了所有方法 创建一个内核,但是在第一次执行时,它使驱动程序崩溃了 (屏幕闪烁了一段时间,Windows 7表示必须 重新启动驱动程序).第二次执行导致蓝屏 死亡.

Nvidia: Refused to install their WHQL-drivers because it claimed I didn't have Nvidia-card (that computer has a Geforce GT 330M). When I tried it on a different computer I managed to get all the way to create a kernel but at the first execution it crashed the drivers (the screen flickered for a while and Windows 7 said it had to restart the drivers). The second execution caused a bluee-screen of death.

AMD/ATI :拒绝安装32位SDK(我尝试这样做是因为我将使用32位JVM),但64位SDK的效果很好.这是唯一的 我设法在上面执行代码的驱动程序(重启后 因为起初它在编译时给出了一个神秘的错误消息). 但是,它似乎无法执行任何隐式矢量化 而且由于我没有任何ATI GPU,所以我没有任何性能 与Java实现相比有所增加.如果我使用向量类型 也许会有所改善.

AMD/ATI: Refused to install 32-bit SDK (I tried that since I will be using a 32-bit JVM) but 64-bit SDK worked well. This is the only driver which I've managed to execute the code on (after a restart because at first it gave a cryptic error-message when compiling). However it doesn't seem to be able to do any implicit vectorization and since I don't have any ATI GPU I didn't get any performance increase compared to the Java-implementation. If I use vector-types I might see some improvements though.

TL; DR 似乎没有任何驱动程序可供商业使用.我可能最好用编译为使用SSE指令的C代码创建JNI模块.

TL;DR None of the drivers seem ready for commercial use. I'm probably better of creating JNI-module with C-code compiled to use SSE-instructions.

推荐答案

首先尝试了解主机&设备: http://www.streamcomputing. eu/blog/2011-07-14/basic-concept-hosts-and-devices/

First try to understand hosts & devices: http://www.streamcomputing.eu/blog/2011-07-14/basic-concept-hosts-and-devices/

基本上,您可以按照描述的步骤进行操作:检查某个驱动程序是否可用,否则,请尝试下一个.您首先选择的内容完全取决于您自己的偏好.我会选择对内核进行最佳测试的设备.在JavaCL中,您可以使用JavaCL.createBestContext和CLPlatform.getBestDevice选择最快的设备,在此处检查主机代码: http://ochafik.com/blog/?p=501

Basically you can just do exactly what you described: check if a certain driver is available and if not, try the next one. What you choose first depends completely on your own preference. I would pick the device I have tested my kernel best on. In JavaCL you can pick the fastest device with JavaCL.createBestContext and CLPlatform.getBestDevice, check the host-code here: http://ochafik.com/blog/?p=501

知道NVidia不通过其驱动程序支持CPU.只有AMD和Intel做.定位多个设备(例如2个GPU和一个CPU)也更加困难.

Know NVidia does not support CPUs via their driver; only AMD and Intel do. Also is targeting multiple devices (say 2 GPUs and a CPU) a bit more difficult.

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

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