代码之家  ›  专栏  ›  技术社区  ›  Thomas Carlton

用ALEA GPU编程编译vb.net

  •  0
  • Thomas Carlton  · 技术社区  · 7 年前

    我对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 回复  |  直到 7 年前
        1
  •  2
  •   Tomato32    7 年前

    需要导入命名空间 导入alea.parallel . 然后,所有的错误都消失了:D.希望能帮上忙,新年快乐,我的朋友:)