-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large overhead using @batch #71
Comments
And here are the benchmarking results I got on an Intel Xeon server with 36 cores. The scaling of multi-threading performance is weird.
|
The version of Polyester is v0.6.4. And
|
If you want to talk overhead: julia> @benchmark batch_X1(x) setup=(x=rand(T, 1<<15))
BenchmarkTools.Trial: 8178 samples with 10 evaluations.
Range (min … max): 2.569 μs … 7.902 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 3.983 μs ┊ GC (median): 0.00%
Time (mean ± σ): 3.997 μs ± 241.912 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▂▅▇███▆▄▂▂▁ ▂
▇▇▇▆▇▅▃▃▃▁▃▁▁▁▁▁▃▁▁▁▁▁▃▄▆████████████▇▆▅▄▁▁▄▄▄▁▃▁▁▃▁▁▁▃▃▁▅▅ █
2.57 μs Histogram: log(frequency) by time 5.41 μs <
Memory estimate: 32 bytes, allocs estimate: 1.
julia> @benchmark threads_X1(x) setup=(x=rand(T, 1<<15))
BenchmarkTools.Trial: 6341 samples with 1 evaluation.
Range (min … max): 133.604 μs … 2.691 ms ┊ GC (min … max): 0.00% … 46.51%
Time (median): 466.104 μs ┊ GC (median): 0.00%
Time (mean ± σ): 617.906 μs ± 447.765 μs ┊ GC (mean ± σ): 0.82% ± 4.65%
▂█▅▇▃▃▂▂▂ ▁
▃█████████▇█▇█▆▇▆▅▅▄▅▄▅▄▄▃▄▃▃▃▃▃▃▃▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▁▁▂▂▂▁▁▁▂▃▃▃ ▃
134 μs Histogram: frequency by time 1.95 ms <
Memory estimate: 15.14 KiB, allocs estimate: 169. When |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I try to use
@batch
to improve the performance with multithreading, I found it has a large overhead which is similar toThreads.@threads
.Here is the code I tested which is the task of applying the X-gate on the first qubit in quantum simulation. And the functions
serial_X1
,batch_X1
, andthreads_X1
are single-thread, multi-thread with@batch
, and multi-threads withThreads.@threads
version of X-gate on the first qubit respectly.The text was updated successfully, but these errors were encountered: