在OpenCL中选择CPU内核数 [英] Selecting number of CPU cores in OpenCL

查看:98
本文介绍了在OpenCL中选择CPU内核数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在比较OpenMP和OpenCL在CPU上的性能,我的系统有8个核心.但是我需要分别比较2、4、6和8个内核.我可以通过"set_num_threads(n)"函数或环境变量激活OpenMP中的内核数.但是我不知道如何在OpenCL中执行同样的操作,OpenCL中是否可以替代OpenMP set_num_threads API?

I am comparing performance of OpenMP with that of OpenCL on CPUs and my system has 8 cores. But I need comparisons for 2, 4, 6 and 8 cores respectively. I can activiate number of cores in OpenMP through "set_num_threads(n)" function or an environment variable; But I dont know how could I do same in OpenCL, is there alternative of OpenMP set_num_threads API in OpenCL ?

推荐答案

没有标准方法可以做到这一点. OpenCL将尝试使用OpenCL设备上的所有可用资源.

There is no standard way to do this. OpenCL will try to use all of the resources available on an OpenCL device.

您可能会想到的一种可能性是设备裂变扩展.它允许您将设备(在本例中为CPU)划分为较小的逻辑设备.目前至少由AMD的实现在CPU上支持它.进行搜索,您还会从AMD中找到更多资源.

One possibility you could look into is the device fission extension. It allows you to divide the device (in this case the CPU) into smaller logical devices. It is currently supported on CPUs by AMD's implementation at least. Do a search and you'll find some more resources from AMD as well.

这篇关于在OpenCL中选择CPU内核数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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