有没有人知道如何测量常量,local.private,全局内存的最大限制或允许范围大小
我使用gpu caps viewer工具获取cl信息并获得结果
https://www.dropbox.com/s/lb1y94njg5y37jv/4.jpg
Global memory = 2048 MB,
Local memory =32 KB,
constant memory =64 KB,
表示最大内存大小
open-cl设备信息https://www.dropbox.com/s/2fr827ikcrjvoe0/new%20%204.txt
答案 0 :(得分:1)
使用clGetDeviceInfo()
OpenCL Doc
您想要的值是:
Global - CL_DEVICE_GLOBAL_MEM_SIZE - Total maximum mem size the device can hold
Local - CL_DEVICE_LOCAL_MEM_SIZE - Local group temporal shared max mem size
Constant - CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE - Constant arguments max mem size
私人是不可能查询的,并且取决于很多东西,比如代码和工作量,只需尽可能少地使用。
答案 1 :(得分:0)
使用OpenCL的Boost.Compute C ++包装器库非常容易:
// get the default device
boost::compute::device device = boost::compute::system::default_device();
// print out memory sizes
std::cout << "device: " << device.name() << std::endl;
std::cout << " global memory size: "
<< device.get_info<cl_ulong>(CL_DEVICE_GLOBAL_MEM_SIZE) / 1024 / 1024
<< " MB"
<< std::endl;
std::cout << " local memory size: "
<< device.get_info<cl_ulong>(CL_DEVICE_LOCAL_MEM_SIZE) / 1024
<< " KB"
<< std::endl;
std::cout << " constant memory size: "
<< device.get_info<cl_ulong>(CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024
<< " KB"
<< std::endl;
将打印出类似这样的内容:
device: Tahiti
global memory size: 2511 MB
local memory size: 32 KB
constant memory size: 64 KB
有关完整的源代码,请参阅memory_limits.cpp示例。