Skip to content

Instantly share code, notes, and snippets.

@MikaelSlevinsky
Last active February 26, 2018 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikaelSlevinsky/aadfbf695c8821e6d04237cbc779e2e9 to your computer and use it in GitHub Desktop.
Save MikaelSlevinsky/aadfbf695c8821e6d04237cbc779e2e9 to your computer and use it in GitHub Desktop.
Test the experimental use of multithreading for spherical harmonic transforms in FastTransforms.jl
Pkg.build("FastTransforms")
using FastTransforms
N = 2.^(7:12)
tSP = zeros(length(N), 3)
Nr = 3
j = 1
for n in N
A = sphrandn(Float64, n+1, n+1)
SlowSphericalHarmonicPlan(A)
SP, tSP[j, 1] = @timed SlowSphericalHarmonicPlan(A)
for kk = 1:Nr
A = sphrandn(Float64, n+1, n+1)
Ac = copy(A)
B = zero(A)
tSP[j, 2] += @elapsed A_mul_B!(B, SP, A)
fill!(A, 0.0)
tSP[j, 3] += @elapsed At_mul_B!(A, SP, B)
sleep(1)
end
println("n = $n")
tSP[j,2] /= Nr
tSP[j,3] /= Nr
j+=1
end
# Single-threaded on master
#=
tSP = [0.00174305 0.0027038 0.00198762; 0.010723 0.0128799 0.0112375; 0.0118157 0.101545 0.101526; 0.0493047 0.734511 0.737739; 0.131887 8.23267 5.65757; 0.804201 82.9072 46.5227]
tFIs = [0.00469142; 0.0241174; 0.203071; 1.47225; 13.8902; 129.43]
=#
# OpenMP Multi-threaded on feat-triangular-harmonics
#=
tSP = [0.00982159 0.00128552 0.0011545; 0.00419718 0.00545299 0.00464592; 0.0170309 0.0374069 0.0353221; 0.122011 0.223568 0.207995; 0.251984 1.80025 1.4789; 1.02663 15.1506 11.4626]
tFIp = [0.00244002; 0.0100989; 0.072729; 0.431563; 3.27915; 26.6132]
=#
# Native Julia multi-threaded using Threads.@threads
#=
tSP = [0.00115427 0.00174678 0.00130938; 0.00465569 0.0109809 0.0109122; 0.0149411 0.0562675 0.0556749; 0.0458536 0.350998 0.358563; 0.145042 4.08708 2.14871; 0.632156 28.7748 15.6262]
tFIjp = [0.00305616; 0.0218931; 0.111942; 0.709561; 6.2358; 44.401]
=#
# Native Julia multi-threaded using FastTransforms.@stepthreads on feat-triangular-harmonics
#=
tSP = [0.00148656 0.001418 0.00113814; 0.00469842 0.0080027 0.0068785; 0.0150929 0.0516621 0.050767; 0.042609 0.315481 0.315983; 0.148373 2.57675 1.83582; 0.674589 20.1461 14.2719]
tFIftp = [0.00255615; 0.0148812; 0.102429; 0.631464; 4.41257; 34.418]
=#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment