Skip to content

Instantly share code, notes, and snippets.

@natschil
Created October 15, 2018 17:32
Show Gist options
  • Save natschil/57e9adb11c84e3d388aadf6ebfb2c3a1 to your computer and use it in GitHub Desktop.
Save natschil/57e9adb11c84e3d388aadf6ebfb2c3a1 to your computer and use it in GitHub Desktop.
using SharedArrays,BenchmarkTools,StaticArrays
U = SharedArray{Float64}(zeros(100,100,100))
function mytestfun(U)
function getIndices(i,j,k)
#return U[i,j,k]
return U[mod(i,3)+1,j,k]
end
uvals = @SArray [getIndices(i,j,k) for i in 1:4, j in 1:4, k in 1:4]
return uvals[1]
end
@btime mytestfun($U)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment