小编Ina*_*Ira的帖子

在OpenCL中将数组传递给函数参数

如何将数组传递给OpenCL中的函数?我得到错误"..argument of type"_global float*"与行c [n] = FindIndexFromArray(a,3)中类型为"float*"的参数不兼容;

float FindIndexFromArray(float myArray[], float Key)
{
    // simple looping to find the index
    for (int i=0;i<sizeof(myArray);i++)
       if (myArray[i]==Key)
         return i; 

}

kernel void ProcessArray(
    global read_only float* myArray,
    global read_only float* Key,
    global write_only float* c )
{
    int index = get_global_id(0); 
    c[index] = FindIndexFromArray(myArray, Key); // How do I pass myArray parameter?
}
Run Code Online (Sandbox Code Playgroud)

我编辑的源代码:

float FindIndexFromArray(__global read_only float* myArray[], __global read_only float* Key)
{
    // simple looping to find the …
Run Code Online (Sandbox Code Playgroud)

arrays opencl

7
推荐指数
1
解决办法
4337
查看次数

找不到rtl100.bpl吗?

我正在从TMS学习组件。我得到了“ ... rtl100.bpl找不到...”。如果我使用包含“ rtl”的“使用运行时程序包构建”,可能会发生此错误。

rtl100.bpl在哪里(我正在使用D2007)?我该怎么办才能解决此错误?

delphi bpl

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

替换包含#0的字符串?

我使用此函数将文件读取到字符串

function LoadFile(const FileName: TFileName): string;
begin
  with TFileStream.Create(FileName,
      fmOpenRead or fmShareDenyWrite) do begin
    try
      SetLength(Result, Size);
      Read(Pointer(Result)^, Size);
    except
      Result := '';  
      Free;
      raise;
    end;
    Free;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

这是文件的文字:

version  
Run Code Online (Sandbox Code Playgroud)

这是LoadFile的返回值:

'ÿþv'#0'e'#0'r'#0's'#0'i'#0'o'#0'n'#0
Run Code Online (Sandbox Code Playgroud)

我想创建一个包含"verabc"的新文件.问题是我仍然有问题用"abc"替换"sion".我正在使用D2007.如果我删除所有#0,那么结果将成为中文字符.

delphi string unicode utf-16 delphi-2007

0
推荐指数
1
解决办法
2854
查看次数

标签 统计

delphi ×2

arrays ×1

bpl ×1

delphi-2007 ×1

opencl ×1

string ×1

unicode ×1

utf-16 ×1