[英]ILGPU in VB.NET basic memory buffer allocation
I am trying to get ILGPU work with VB.NET, but I am struggling even with the basic variable declaration from the tutorials.我试图让 ILGPU 与 VB.NET 一起工作,但即使使用教程中的基本变量声明,我也很挣扎。
This is the C# declaration for the memory buffer.这是内存缓冲区的 C# 声明。 It is pretty straight forward.这是非常直接的。
// Gets array of 1000 doubles on host.
double[] doubles = new double[1000];
// Gets MemoryBuffer on device with same size and contents as doubles.
MemoryBuffer<double> doublesOnDevice = accelerator.Allocate<double>(doubles);
In VB.NET I have the following:在 VB.NET 中,我有以下内容:
Dim context As New ILGPU.Context
Dim accel As ILGPU.Runtime.Accelerator = New CPUAccelerator(context)
Dim dataArray As Double() = {0, 1, 2, 4, 5, 6, 7, 8, 9}
Dim dataArrayDevice = accel.Allocate(Of Double)(dataArray)
I get an error in the last line saying "is an unsupported type".我在最后一行收到一条错误消息,说“是一种不受支持的类型”。 I have tried to split it like this:我试图像这样拆分它:
Dim dataArrayDevice As MemoryBuffer(Of Double)
dataArrayDevice = accel.Allocate(Of Double, dataArray)
but it does not help.但它没有帮助。 I get the error on the first line on the "of Double", saying also "unsupported type"我在“of Double”的第一行收到错误,还说“不支持的类型”
Does anybody has a basic example how to allocate the buffer in ILGPU with VB.NET?有没有人有一个基本的例子,如何在 ILGPU 中使用 VB.NET 分配缓冲区?
Thank you谢谢
PS: I have set the Project to x64 PS:我已将项目设置为 x64
After some more reading, I come to the conclusion that ILGPU is not compatible with VB.NET.经过更多阅读,我得出结论,ILGPU 与 VB.NET 不兼容。
The solution to my problem is to add ac# library to my VB project where I handle the ILGPU only.我的问题的解决方案是将 ac# 库添加到我仅处理 ILGPU 的 VB 项目中。
I confirm that ILGPU is not compatible with VB.NET.我确认 ILGPU 与 VB.NET 不兼容。 You would need to write a C# project which uses ILGPU and reference the C# project in your VB project.您需要编写一个使用 ILGPU 的 C# 项目并在您的 VB 项目中引用 C# 项目。
You can also use the project: https://github.com/MPSQUARK/DataScience您也可以使用该项目: https : //github.com/MPSQUARK/DataScience
Which provides functionality for any .NET language.它为任何 .NET 语言提供功能。 It uses ILGPU to provide a fast plug and play solution with various performance optimisations.它使用 ILGPU 提供具有各种性能优化的快速即插即用解决方案。 However it is a WIP.然而,它是一个 WIP。
For help from the community:从社区寻求帮助:
Discord: https://discord.gg/X6RBCff不和谐: https : //discord.gg/X6RBCff
Website: https://www.ilgpu.net/网址: https : //www.ilgpu.net/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.