I think you'll have to write something like julia> f()=@elapsed @sync @parallel for i=1:10000000 b[i]=a[i] end to be sure that the all calculations are done before the clock stops.
You should also be aware that the calculation is probably not doing what you expect as explained in http://julia.readthedocs.org/en/latest/manual/parallel-computing/#parallel-map-and-loops Med venlig hilsen Andreas Noack 2014-10-28 22:46 GMT-04:00 Kapil Agarwal <kapil6...@gmail.com>: > Hi > > I wrote the following benchmark and I got some weird results which I am > unsure of their correctness. > > a=fill(1.0,10000000); > b=fill(0.0,10000000); > > f()=@elapsed @parallel for i=1:10000000 > b[i]=a[i] > end > > I get the following results- > > julia> f() > 0.001288817 > > julia> f() > 4.0828e-5 > > julia> f() > 4.3807e-5 > > julia> f() > 4.2003e-5 > > The first result is probably due to function f() being compiled and after > that, there is couple of orders of magnitude gain in performance. Is this > benchmark correct or there is some problem with the code ? > > The corresponding C code takes on average 0.029588 seconds. Is Julia that > much faster than C ? > > -- > Kapil >