Reputation: 153
Does anyone know how to measure maximum limit or allow range size for constant,local.private,global memory
i use gpu caps viewer tool for cl info and get the result
https://www.dropbox.com/s/lb1y94njg5y37jv/4.jpg
Global memory = 2048 MB,
Local memory =32 KB,
constant memory =64 KB,
is that means maximum memory size
the open-cl device info https://www.dropbox.com/s/2fr827ikcrjvoe0/new%20%204.txt
Upvotes: 1
Views: 1654
Reputation: 8046
This is fairly easy using the Boost.Compute C++ wrapper library for OpenCL:
// 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;
Which will print something like this:
device: Tahiti
global memory size: 2511 MB
local memory size: 32 KB
constant memory size: 64 KB
See the memory_limits.cpp example for the full source code.
Upvotes: 0
Reputation: 8420
Query the device properties with clGetDeviceInfo()
OpenCL Doc
The values you want are:
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
Private is impossible to query, and depends on many things like the code and work size, just use as little as you can.
Upvotes: 1