使用Alea GPU编程编译VB.net

时间:2019-01-01 04:16:48

标签: vb.net gpu

我是GPU编程的新手,并且将Alea与VB.Net 2013结合使用

我试图编写一个简单的for循环,但是我在For循环上遇到一些编译错误。我尝试了几种语法,但没有一种起作用。

    Imports Alea
    Imports System.Threading
    Imports System.Threading.Tasks
    Imports Alea.Gpu

    Public Class MyClass
        Private Sub TestingGPU(sender As Object, e As EventArgs)

            Dim Length As Integer = 1000
            Dim MyGPU As Gpu = Gpu.Default

            Dim Arg1 = Enumerable.Range(0, Length).ToArray()
            Dim Arg2 = Enumerable.Range(0, Length).ToArray()
            Dim Result = New Integer(Length - 1) {}

            Dim opFactory As Func(Of Integer(), Action(Of Integer)) = Function(res) Function(i)
                                                                                        res(i) = Arg1(i) + Arg2(i)
                                                                                    End Function

            Gpu.Default.for(0, Result.Length, opFactory(Result))   'Compilation Error : For is not a member of Alea.GPU
            Gpu.Default.[for](0, Result.Length, opFactory(Result)) 'Compilation Error : For is not a member of Alea.GPU
            MyGPU.for(0, Result.Length, opFactory(Result))         'Compilation Error : For is not a member of Alea.GPU
            MyGPU.[for](0, Result.Length, opFactory(Result))       'Compilation Error : For is not a member of Alea.GPU
        End Sub
    End Class

请问有人知道错误的原因吗?

谢谢, 干杯

1 个答案:

答案 0 :(得分:2)

您需要导入名称空间导入Alea.Parallel 。然后,所有错误都消失了:d。希望对大家有帮助,新年快乐,我的朋友:))