-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from fgasdia/triangledomain
Support multithreading option
- Loading branch information
Showing
11 changed files
with
297 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
name = "RootsAndPoles" | ||
uuid = "a0859a10-ccb4-11e8-145d-674b3750773a" | ||
authors = ["Forrest Gasdia <[email protected]>"] | ||
version = "1.0.0" | ||
version = "1.1.0" | ||
|
||
[deps] | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
VoronoiDelaunay = "72f80fcb-8c52-57d9-aff0-40c1a3526986" | ||
|
||
[compat] | ||
julia = "1.4" | ||
VoronoiDelaunay = "0.4.0" | ||
julia = "1.4" | ||
|
||
[extras] | ||
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
|
||
[targets] | ||
test = ["SpecialFunctions", "Test"] | ||
benchmark = ["BenchmarkTools", "LinearAlgebra"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# This file is machine-generated - editing it directly is not advised | ||
|
||
[[Base64]] | ||
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | ||
|
||
[[BenchmarkTools]] | ||
deps = ["JSON", "Logging", "Printf", "Statistics", "UUIDs"] | ||
git-tree-sha1 = "9e62e66db34540a0c919d72172cc2f642ac71260" | ||
uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
version = "0.5.0" | ||
|
||
[[Dates]] | ||
deps = ["Printf"] | ||
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||
|
||
[[Distributed]] | ||
deps = ["Random", "Serialization", "Sockets"] | ||
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||
|
||
[[InteractiveUtils]] | ||
deps = ["Markdown"] | ||
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | ||
|
||
[[JSON]] | ||
deps = ["Dates", "Mmap", "Parsers", "Unicode"] | ||
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e" | ||
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" | ||
version = "0.21.0" | ||
|
||
[[Libdl]] | ||
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" | ||
|
||
[[LinearAlgebra]] | ||
deps = ["Libdl"] | ||
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
|
||
[[Logging]] | ||
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
|
||
[[Markdown]] | ||
deps = ["Base64"] | ||
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" | ||
|
||
[[Mmap]] | ||
uuid = "a63ad114-7e13-5084-954f-fe012c677804" | ||
|
||
[[Parsers]] | ||
deps = ["Dates", "Test"] | ||
git-tree-sha1 = "8077624b3c450b15c087944363606a6ba12f925e" | ||
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" | ||
version = "1.0.10" | ||
|
||
[[Printf]] | ||
deps = ["Unicode"] | ||
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" | ||
|
||
[[Random]] | ||
deps = ["Serialization"] | ||
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
|
||
[[SHA]] | ||
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" | ||
|
||
[[Serialization]] | ||
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" | ||
|
||
[[Sockets]] | ||
uuid = "6462fe0b-24de-5631-8697-dd941f90decc" | ||
|
||
[[SparseArrays]] | ||
deps = ["LinearAlgebra", "Random"] | ||
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
|
||
[[Statistics]] | ||
deps = ["LinearAlgebra", "SparseArrays"] | ||
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
|
||
[[Test]] | ||
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] | ||
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[[UUIDs]] | ||
deps = ["Random", "SHA"] | ||
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" | ||
|
||
[[Unicode]] | ||
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using BenchmarkTools | ||
using LinearAlgebra | ||
|
||
using RootsAndPoles | ||
|
||
# Define a parent BenchmarkGroup to contain our suite | ||
const suite = BenchmarkGroup() | ||
|
||
# Add some child groups to our benchmark suite. | ||
suite["grpf"] = BenchmarkGroup(["functions"]) # BenchmarkGroup "tags" | ||
|
||
simplefcn(z) = (z - 1)*(z - im)^2*(z + 1)^3/(z + im) | ||
|
||
function defaultfcn(z) | ||
f = 1e9 | ||
ϵᵣ = 5 - 2im | ||
μᵣ = 1 - 2im | ||
d = 1e-2 | ||
c = 3e8 | ||
ω = 2π*f | ||
k₀ = ω/c | ||
cc = ϵᵣ^2*(k₀*d)^2*(ϵᵣ*μᵣ - 1) | ||
w = ϵᵣ^2*z^2 + z^2*tan(z)^2 - cc | ||
end | ||
|
||
function wvgd(z) | ||
ns = 0.065-4im | ||
n1 = 1.5835 | ||
nc = 1.0 | ||
d1 = 1.81e-6 | ||
λ₀ = 0.6328e-6 | ||
k₀ = 2π/λ₀ | ||
k₀d1 = k₀*d1 | ||
κ1 = sqrt(n1^2 - z^2) | ||
γs = sqrt(z^2 - ns^2) | ||
γc = sqrt(z^2 - nc^2) | ||
m11 = cos(κ1*k₀d1) | ||
m12 = im/κ1*sin(κ1*k₀d1) | ||
m21 = im*κ1*sin(κ1*k₀d1) | ||
m22 = cos(κ1*k₀d1) | ||
w = det([1.0 -m11+im*γc*m12 | ||
im*γs -m21+im*γc*m22]) | ||
end | ||
|
||
function graphenefunction(z) | ||
f = 1e12 | ||
c = 299792458 | ||
μ₀ = 4π*1e-7 | ||
ϵ₀ = 1/(μ₀*c^2) | ||
|
||
e = 1.602176565e-19 | ||
kB = 1.3806488e-23 | ||
hk = 1.05457168e-34 | ||
vFe = 1e6 | ||
muc = 0.05*e | ||
t = 0.135e-12 | ||
T = 300 | ||
ϵᵣ₁ = 1.0 | ||
ϵᵣ₂ = 11.9 | ||
|
||
ω = 2π*f | ||
k₀ = ω/c | ||
kᵣ₀ = -im*z*k₀ | ||
|
||
Slo=-im*e^2*kB*T*log(2+2*cosh(muc/kB/T)) / (π*hk^2*(ω-im/t)) | ||
|
||
a = -3*vFe^2*Slo/(4*(ω-im/t)^2) | ||
b = a/3 | ||
|
||
Y1TM = ω*ϵᵣ₁*ϵ₀/sqrt(ϵᵣ₁*k₀^2 - kᵣ₀^2); | ||
Y2TM = ω*ϵᵣ₂*ϵ₀/sqrt(ϵᵣ₂*k₀^2 - kᵣ₀^2); | ||
YSTM = Slo + 1*a*kᵣ₀^2 + 1*b*kᵣ₀^2; | ||
|
||
w = (Y1TM + Y2TM + YSTM)*(-Y1TM + Y2TM + YSTM)*(Y1TM - Y2TM + YSTM)*(-Y1TM - Y2TM + YSTM) # four Riemann sheets | ||
end | ||
|
||
testfcns = (simplefcn, defaultfcn, wvgd, graphenefunction) | ||
|
||
# Add some benchmarks to the "grpf" group | ||
for f in testfcns | ||
sf = string(f) | ||
if sf == "simplefcn" | ||
origcoords = rectangulardomain(complex(-2, -2), complex(2, 2), 0.1) | ||
suite["grpf"][sf] = @benchmarkable grpf($f, $origcoords) | ||
elseif sf == "defaultfcn" | ||
origcoords = rectangulardomain(complex(-2, -2), complex(2, 2), 0.2) | ||
suite["grpf"][sf] = @benchmarkable grpf($f, $origcoords) | ||
elseif sf == "wvgd" | ||
origcoords = rectangulardomain(complex(1.0, -1.0), complex(2.5, 2.5), 0.5) | ||
suite["grpf"][sf] = @benchmarkable grpf($f, $origcoords) | ||
elseif sf == "graphenefunction" | ||
origcoords = rectangulardomain(complex(-100, -100), complex(400, 400), 18) | ||
suite["grpf"][sf] = @benchmarkable grpf($f, $origcoords) | ||
end | ||
end | ||
|
||
# If a cache of tuned parameters already exists, use it, otherwise, tune and cache | ||
# the benchmark parameters. Reusing cached parameters is faster and more reliable | ||
# than re-tuning `suite` every time the file is included. | ||
paramspath = joinpath(dirname(@__FILE__), "params.json") | ||
|
||
if isfile(paramspath) | ||
loadparams!(suite, BenchmarkTools.load(paramspath)[1], :evals); | ||
else | ||
tune!(suite) | ||
BenchmarkTools.save(paramspath, params(suite)); | ||
end | ||
|
||
# run with a time limit of ~5 second per benchmark | ||
results = run(suite, verbose = true, seconds = 5) | ||
|
||
# Appends results into `paramspath` | ||
BenchmarkTools.save(paramspath, results) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"Julia":"1.5.0","BenchmarkTools":"0.4.3"},[["BenchmarkGroup",{"data":{"grpf":["BenchmarkGroup",{"data":{"graphenefunction":["BenchmarkTools.Trial",{"allocs":1685594,"gctimes":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,3.8377349e7,3.7560222e7,4.2090254e7,4.3536983e7,4.5636256e7,4.3935513e7,4.2781782e7,4.0985667e7,4.5994165e7,4.3518752e7,5.1209756e7,4.4080055e7,5.0555615e7,4.4950588e7,4.538121e7,4.4690217e7,2.5815729e7],"memory":35615056,"params":["BenchmarkTools.Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"times":[1.16774699e8,1.1790765e8,1.18843719e8,1.19018573e8,1.19889117e8,1.20459466e8,1.23482436e8,1.25326429e8,1.27215843e8,1.29410009e8,1.73388478e8,2.00133859e8,2.01600198e8,2.06497644e8,2.0766166e8,2.10527016e8,2.11002776e8,2.11576493e8,2.12367266e8,2.14024589e8,2.15949301e8,2.16793587e8,2.17620736e8,2.19141054e8,2.2049842e8,2.20871796e8,2.44331003e8,2.50976914e8]}],"defaultfcn":["BenchmarkTools.Trial",{"allocs":939326,"gctimes":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,3.023543e7,3.4456552e7,3.5728176e7,3.9456359e7,4.1571941e7,4.2933843e7,3.708878e7,3.9650727e7,4.2477862e7,4.2892042e7,4.1435797e7,4.1050154e7,4.1954723e7,3.9864644e7,4.3373541e7,4.1779057e7,4.2542738e7,4.1369169e7,4.2410585e7],"memory":20342672,"params":["BenchmarkTools.Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"times":[5.7249571e7,5.7596017e7,5.7714169e7,5.7857532e7,5.796645e7,5.8094101e7,5.8152668e7,5.8300313e7,5.8317658e7,5.8406451e7,5.853215e7,5.8622883e7,5.863337e7,5.8784439e7,5.8845108e7,5.88956e7,5.91483e7,5.9226895e7,5.9320294e7,5.9456249e7,5.9563889e7,5.9851044e7,6.0792737e7,6.1099997e7,6.2641904e7,6.3884481e7,6.4152613e7,6.4615093e7,6.5109376e7,6.5257594e7,6.5302257e7,6.6485915e7,6.6906795e7,6.9495708e7,1.25186411e8,1.26972144e8,1.34478052e8,1.41755302e8,1.45367022e8,1.46446274e8,1.49216159e8,1.49304989e8,1.49516083e8,1.51494799e8,1.51542085e8,1.52635021e8,1.52915057e8,1.54242468e8,1.5494753e8,1.56112041e8,1.57093894e8,1.57201147e8,1.59255604e8,1.66389965e8]}],"wvgd":["BenchmarkTools.Trial",{"allocs":1019469,"gctimes":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2.9386304e7,0.0,3.4905534e7,3.3759077e7,3.9559143e7,3.9468545e7,4.0005239e7,3.9517808e7,4.0555033e7,3.679492e7,4.0279999e7,4.2299871e7,4.0045418e7,3.5973045e7,3.8485127e7],"memory":24507872,"params":["BenchmarkTools.Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"times":[1.05196049e8,1.05203842e8,1.0589738e8,1.06068718e8,1.06112954e8,1.06348562e8,1.06733635e8,1.07191338e8,1.08141607e8,1.09699448e8,1.09705338e8,1.10162601e8,1.1109799e8,1.12140929e8,1.12545276e8,1.12922188e8,1.13028329e8,1.13709811e8,1.17297188e8,1.28822539e8,1.73592435e8,1.74473972e8,1.83528033e8,1.84760643e8,1.87161363e8,1.90208378e8,1.91212638e8,1.94663849e8,1.95658729e8,1.9620709e8,1.97058605e8,1.98850271e8,1.98901154e8,2.00208212e8,2.02481013e8]}],"simplefcn":["BenchmarkTools.Trial",{"allocs":1210968,"gctimes":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,3.2871564e7,3.5685863e7,4.1620177e7,3.8835973e7,4.374455e7,4.4678978e7,5.0154919e7,4.4663906e7,4.3873183e7,4.276452e7,4.422872e7,3.9704931e7,3.9711808e7,4.5161195e7,4.0825662e7,4.2414777e7,5.0587504e7],"memory":26013056,"params":["BenchmarkTools.Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"times":[8.3892557e7,8.4098241e7,8.4223144e7,8.4912725e7,8.5119866e7,8.5244104e7,8.5776601e7,8.5930871e7,8.6172936e7,8.6265951e7,8.7520456e7,8.947034e7,9.0291317e7,9.0718493e7,9.1043918e7,9.1314387e7,9.4306066e7,9.664579e7,9.7600447e7,1.20678702e8,1.33173146e8,1.61808386e8,1.70276365e8,1.7342738e8,1.74677113e8,1.77253928e8,1.8121091e8,1.81243803e8,1.8192631e8,1.82996581e8,1.83033048e8,1.83934326e8,1.8411772e8,1.84894951e8,1.85613949e8,1.87803731e8,1.89296369e8,2.12534728e8]}]},"tags":["functions"]}]},"tags":[]}]]] |
Oops, something went wrong.