Hi, I have a problem, I ever use the parallel operator to speed up the calculation in vb.net like the following code (project many points on mesh):
But I find that using GPU(like Cuda) could further increase the speed of parallel operation(reach to 500 times vs CPU), what to do? could any one help me? thanks~
Parallel.For(0, num, Sub(iii)
projection_mesh22(iii, pts(iii), kr, msh_new, msh_num)
End Sub)
Function projection_mesh22(ByVal ii As Integer, ByVal pt As Point3d, ByRef pt_inter() As Point3d, ByVal msh() As Mesh, ByVal num As Integer)
Dim mh As MeshPoint
Dim i, idx As Integer
Dim dist, kd, minmin As Double
Dim ptt(num) As Point3d
Dim dd(num) As Double
Dim pt1 As Point3d
’
For i = 0 To num - 1
dist = 0
mh = msh(i).ClosestMeshPoint(pt, dist)
pt1 = mh.Point
kd = (pt1.X - pt.X) * (pt1.X - pt.X) + (pt1.Y - pt.Y) * (pt1.Y - pt.Y) + (pt1.Z - pt.Z) * (pt1.Z - pt.Z)
dd(i) = kd
ptt(i) = pt1
Next
’
minmin = dd(0)
idx = 0
For i = 0 To num - 1
If dd(i) < minmin Then
minmin = dd(i)
idx = i
End If
Next
’
pt_inter(ii) = ptt(idx)
’
End Function