I'm new to GPU programming and I'm using Alea with VB.Net 2013
I tried to write a simple for loop but I'm having some compilation errors on the For loop. I tried several syntax but none of them are working.
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
What might be the reason for the error?
You need to import namespace Imports Alea.Parallel. And then, all the errors are gone.