Some threading

Sat, 14 Dec 2019 14:59:59 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 14 Dec 2019 14:59:59 +0200
changeset 17
8ff7da7bc77d
parent 16
9b0cfc67d6cb
child 18
0d99f8f7d261

Some threading

src/Translate.jl file | annotate | diff | comparison | revisions
--- a/src/Translate.jl	Wed Dec 11 18:46:02 2019 +0200
+++ b/src/Translate.jl	Sat Dec 14 14:59:59 2019 +0200
@@ -96,10 +96,10 @@
 # Translation
 ##############
 
-@polly function translate_image!(x, z, u::DisplacementFull)
+function translate_image!(x, z, u::DisplacementFull)
     @assert(size(u, 1)==2 && size(x)==size(u)[2:end] && size(x)==size(z))
 
-    @inbounds @simd for i=1:size(x, 1)
+    @inbounds Threads.@threads for i=1:size(x, 1)
         @simd for j=1:size(x, 2)
             pt = (i - u[1, i, j], j - u[2, i, j])
             x[i, j] = interpolate2d_quadrants(z, pt)
@@ -107,10 +107,10 @@
     end
 end
 
-@polly function translate_image!(x, z, u::DisplacementConstant)
+function translate_image!(x, z, u::DisplacementConstant)
     @assert(size(u)==(2,) && size(x)==size(z))
 
-    @inbounds @simd for i=1:size(x, 1)
+    @inbounds Threads.@threads for i=1:size(x, 1)
         @simd for j=1:size(x, 2)
             pt = (i - u[1], j - u[2])
             x[i, j] = interpolate2d_quadrants(z, pt)
@@ -122,7 +122,7 @@
 # Subimage extraction
 ######################
 
-@polly function extract_subimage!(b, im, v::DisplacementConstant)
+function extract_subimage!(b, im, v::DisplacementConstant)
     (imx, imy) = size(im)
     (bx, by) = size(b)
 
@@ -138,8 +138,8 @@
     
     b .= 0
 
-    @inbounds @simd for i=px:qx
-        for j=py:qy
+    @inbounds Threads.@threads for i=px:qx
+        @simd for j=py:qy
             b[i, j] = interpolate2d_quadrants(im, (i+vxʹ, j+vyʹ))
         end
     end

mercurial