标签: cloo

OpenCL Cloo:资源不足错误

在OpenCL中运行一些测试代码(使用Cloo C#)时,我开始从OpenCL中获取这些OutOfResource错误,有时Unity在我得到异常之前完全崩溃.我基本上使用不同数量的全局/本地工作项重复调用内核函数来检查时序.我保持参数相同,并以2x2x2全局和2x2x2本地调用内核,并且只检查有效大小.偶尔工作正常,但大多数时候它会完成大约30或40次Execute()调用,然后在下一次Execute()调用时崩溃.

注意:Execute是指计算机上的OpenCL.dll.由于本机代码,我假设堆栈跟踪Unity返回NULL.

任何人都知道是什么原因造成的?

注意:这个版本的Cloo是来自GitHub的Cloo-Unity,我在Unity中使用它.当我得到错误时调用的等效OpenCL函数是clEnqueueNDRangeKernel(),但它在Cloo中称为Execute().

代码示例:

//Setup inputs one time...
foreach (var input in p_inputs)
{
     inputs.Add(input.Function, input);
     profiles.Add(input.Function, new RunProfile(input.Function, input.Weight));
     input.Input.Prepare(package[input.Function]);
}


//Profile...
DateTime start;
int g_state = 0;
int l_state = 0;
long[] g = new long[3] { 2, 2, 2 };
long[] l = new long[3] { 2, 2, 2 };
while(g[0] * g[1] * g[2] < Device.MaxWorkGroupSize)
{
       l[0] = 2; l[1] = 2; l[2] = 2; l_state = 0; //Reset locals
       bool proceed = …
Run Code Online (Sandbox Code Playgroud)

c# exception opencl cloo

6
推荐指数
1
解决办法
800
查看次数

Cloo OpenCL c#问题

我试图让一个简单的Cloo程序运行,但它不起作用,谁能告诉我为什么?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cloo;
using System.Runtime.InteropServices;

namespace HelloWorld
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {


ComputeContextPropertyList cpl = new ComputeContextPropertyList(ComputePlatform.Platforms[0]);
ComputeContext context = new ComputeContext(ComputeDeviceTypes.Gpu, cpl, null, IntPtr.Zero);

string kernelSource = @"
 kernel void VectorAdd(
  global read_only float* a,
  global read_only float* b,
  global write_only float* c )
 {
  int index = …
Run Code Online (Sandbox Code Playgroud)

c# opencl opentk cloo

5
推荐指数
1
解决办法
3948
查看次数

标签 统计

c# ×2

cloo ×2

opencl ×2

exception ×1

opentk ×1