Memory 如何计算OpenCL内存最大限制
有人知道如何测量常量、本地、私有、全局内存的最大限制或允许范围大小吗 我使用gpu caps查看器工具获取cl信息并得到结果 这意味着最大内存大小吗Memory 如何计算OpenCL内存最大限制,memory,size,opencl,local,Memory,Size,Opencl,Local,有人知道如何测量常量、本地、私有、全局内存的最大限制或允许范围大小吗 我使用gpu caps查看器工具获取cl信息并得到结果 这意味着最大内存大小吗 open cl device info使用clGetDeviceInfo() 您需要的值是: Global - CL_DEVICE_GLOBAL_MEM_SIZE - Total maximum mem size the device can hold Local - CL_DEVICE_LOCAL_MEM_SIZE - Local group
open cl device info使用
clGetDeviceInfo()
您需要的值是:
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
私有是不可能查询的,它依赖于很多东西,如代码和工作大小,只需尽可能少使用。
< P>这对于使用OpenCL的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;
有关完整的源代码,请参见示例。local:,private:
// 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