限制AMD OpenCL的GPU数量 [英] Restrict number of GPUs for AMD OpenCL
问题描述
是否有解决方案来限制AMD OpenCL平台使用的GPU数量?对于NVIDIA平台,只需设置环境变量CUDA_VISIBLE_DEVICES
即可限制OpenCL可用的GPU集.
Is there a solution to restrict the used number of GPUs for AMD OpenCL platforms? For NVIDIA platforms one can simply set the environment variable CUDA_VISIBLE_DEVICES
to limit the set of GPUs available to OpenCL.
我知道,我可以使用减少的设备集来创建上下文.但是,我正在寻找从外部控制" OpenCL平台的设备数量的方法.
I know, that I can create a context with a reduced set of devices. However, I am looking for ways to control the number of devices for the OpenCL platform from "outside".
推荐答案
AMD在Windows和Linux上均具有GPU_DEVICE_ORDINAL环境变量.这使您可以指定希望从OpenCL应用程序中可见的GPU的索引.例如:
AMD have the GPU_DEVICE_ORDINAL environment variable for both Windows and Linux. This allows you to specify the indices of the GPUs that you want to be visible from your OpenCL application. For example:
jprice@nowai:~/benchmark$ python benchmark.py -clinfo
Platform 0: AMD Accelerated Parallel Processing
-> Device 0: Tahiti
-> Device 1: Tahiti
-> Device 2: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz
jprice@nowai:~/benchmark$ export GPU_DEVICE_ORDINAL=0
jprice@nowai:~/benchmark$ python benchmark.py -clinfo
Platform 0: AMD Accelerated Parallel Processing
-> Device 0: Tahiti
-> Device 1: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz
更详细的描述可以在《 AMD APP OpenCL编程指南》(当前在第2.4.3节掩盖可见设备"中)中找到: http://developer.amd.com/wordpress/media/2013/07/AMD_Accelerated_Parallel_Processing_OpenCL_Programming_Guide-rev-2.7.pdf
A more detailed description can be found in the AMD APP OpenCL Programming Guide (currently in section 2.4.3 "Masking Visible Devices"): http://developer.amd.com/wordpress/media/2013/07/AMD_Accelerated_Parallel_Processing_OpenCL_Programming_Guide-rev-2.7.pdf
这篇关于限制AMD OpenCL的GPU数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!