[Question]Solving CL_OUT_OF_HOST_MEMORY issue.

Hi.
I want to create two image2d objects as with the maxium size as possible in the current system for the better performance.

To get the maxium width and height, i queried clGetDeviceInfo() with CL_DEVICE_IMAGE2D_MAX_WIDTH, CL_DEVICE_IMAGE2D_MAX_Height.
But CL_OUT_OF_HOST_MEMORY error happens, calling clCreateImage2D.

Here is the code…

size_t inputAtlasWidth;
clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof(size_t), &inputAtlasWidth, NULL);
size_t inputAtlasHeight;
clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof(size_t), &inputAtlasHeight, NULL);
size_t outputAtlasHeight = inputAtlasHeight / 2;
size_t outputAtlasWidth = inputAtlasWidth / 2;

cl_mem sourceImage = clCreateImage2D(context, CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR, &imageFormat, inputAtlasWidth, inputAtlasHeight, 0, NULL, &error);
if (error)
{
return;
}
CL_OUT_OF_HOST_MEMORY error happens at this point --> cl_mem destinationImage = clCreateImage2D(context, CL_MEM_WRITE_ONLY | CL_MEM_ALLOC_HOST_PTR, &imageFormat, outputAtlasWidth, outputAtlasHeight, 0, NULL, &error);
if (error)
{
return;
}

It seems that i should calculate the values of inputAtlasWidth, inputAtlasHeight, outputAtlasHeight, outputAtlasWidth, additionally taking into account the size of the remaining memory on the host side.
But i don’t know how to get the remaining memory size on the host side.