Hi,
newbie trying to understand how to define the ‘BenchmarkToools’ ?
I installed ‘BenchmarkToools’ with using/add Pkg.
now in jupyter notebook : getting msg:
NameError: name ‘BenchmarkToools’ is not defined
So does one have to set a variable like b = BenchmarkToools(x) or how does this work ?
Thanks
Is it simply that you are misspelling the name, with three ‘o’ characters instead of two? Try rerunning with
using BenchmarkTools.
Hi @John_Gibson,
correct, it was misspeled in the above line - oops thanks -
now entering BenchmarkTools, it just outputs BenchmarkTools…
so, where to go from there to measure some script time exec ?
I get results using @time …but not using @benchmark … ![]()
I’ll point you to the Benchmarks manual and suggest that you post minimal working examples of any issues you are having. This PSA explains how and why.
https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757/81
julia> using BenchmarkTools
julia> @benchmark randn(1000)
BenchmarkTools.Trial:
memory estimate: 7.94 KiB
allocs estimate: 1
--------------
minimum time: 2.196 μs (0.00% GC)
median time: 2.470 μs (0.00% GC)
mean time: 2.590 μs (3.68% GC)
maximum time: 76.003 μs (92.82% GC)
--------------
samples: 10000
evals/sample: 9
oh, of course @John_Gibson , I was so into the basic course that I forgot to mention my code : …
![]()
a = rand(10^7)
sum(a)
@time sum(a)
I think I got it right now with the added line, thanks to the doc you’ve just provided me, Great thanks for that ! have a great end-of-Week-end ! ![]()
@benchmark sum(a) (had tried s/t else that was not working for sure)
its all working fine now…thanks guys
I’ll test it with rand function too…good idea !
Glad to hear you are up and running!
BenchmarkTools.Trial:
memory estimate: 7.94 KiB
allocs estimate: 1
--------------
minimum time: 1.865 μs (0.00% GC)
median time: 2.065 μs (0.00% GC)
mean time: 2.892 μs (8.88% GC)
maximum time: 227.362 μs (98.09% GC)
--------------
samples: 10000
evals/sample: 10
just in the middle of the Parallel julia ac. course but hope to be able to use all Pc Cores for my future scripts… ![]()
Just to add that the closest equivalent to time in BenchmarkTools is @btime, which will just output the runtime and memory allocations.
Hi wisers…
- While with Julia Konsole 1
returns 2 threads
…when restarting jupyter from Konsole2 after that
Threads.nthreads()
still returns 1 thread.… ![]()
How does one have Jupyter to take this julia modif into account ?
thanks
This is quite a different question from the one this thread is about - it’s usually preferable to ask separate questions to make things easier to find for future users.
In this case, someone already did start a thread about this specific question: Enable multiple Cores for Jupyter Lab - #7 by Gaussia