我想在 managedCuda 中使用字符串匹配。但是我怎样才能初始化它呢?
我试过使用 C# 版本,这里是例子:
stringAr = new List<string>();
stringAr.Add("you");
stringAr.Add("your");
stringAr.Add("he");
stringAr.Add("she");
stringAr.Add("shes");
对于字符串匹配,我使用了以下代码:
bool found = false;
for (int i = 0; i < stringAr.Count; i++)
{
found = (stringAr[i]).IndexOf(textBox2.Text) > -1;
if (found) break;
}
if (found && textBox2.Text != "")
{
label1.Text = "Found!";
}
else
{
label1.Text = "Not Found!";
}
我还在主机内存中分配输入 h_A
string[] h_B = new string[N];
当我想在设备内存中分配并将向量从主机内存复制到设备内存时
CudaDeviceVariable<string[]> d_B = h_B;
它给了我这个错误
The type 'string[]' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'CudaDeviceVariable<T>'
有什么帮助吗?