0
我正在编写一个图像处理程序,并试图使用OpenCLTemplate实现gpgpu和opencl。在完成教程之后,我已经想出了如何让我的代码运行,但我遇到了更大图像的问题。我通过将图像分成块并通过代码运行来解决了这个问题,但我想这样做是为了不用设置一定数量的块来分割它,而是让它确定所需的最大内存量并将图像分割成许多部分来运行代码。在opencltemplate中执行内核时的内存使用情况
虽然我遇到的问题是,我不知道究竟有多少内存被扔在GPU上,以及如何弄清楚。下面是我正在使用的代码,是否有可能解释如何处理这里的内存或关于在哪里寻找的建议。
我已经浏览了opencltemplate文档无济于事,不再知道去哪里看。
CLCalc.Program.Compile(openCLInvert);
CLCalc.Program.Kernel kernel = new CLCalc.Program.Kernel("Filter");
CLCalc.Program.Variable CLData = new CLCalc.Program.Variable(Data);
float[] imgProcessed = new float[Data.Length];
CLCalc.Program.Variable CLFiltered = new CLCalc.Program.Variable(imgProcessed);
CLCalc.Program.Variable[] args =
new CLCalc.Program.Variable[] { CLData, CLFiltered };
int[] test = new int[] { imageData.Width, imageData.Height };
float size = 0;
for (int x = 0; x <= 1; x++)
{
size += args[x].Size;
}
kernel.Execute(args, test);
CLCalc.Program.Sync();
如上所示,我可以找到用作参数的大小数量,但我仍然不知道总内存用量是多少。