[julia-users] Re: Performance compared to Matlab

2015-10-31 Thread jcalliess
Since people seem to recommend de-vectorisation a lot -- I should comment on my observation that de-vectorisation in Julia often makes things slower... will get some code out and start a new topic on this... On Thursday, 22 October 2015 00:56:39 UTC+3, Lindsey Kuper wrote: > > It's fantastic

Re: [julia-users] Re: Performance compared to Matlab

2015-10-21 Thread Stefan Karpinski
On Tue, Oct 20, 2015 at 1:07 PM, Gabriel Gellner wrote: > Is it possible to tell Julia to run the vectorized code in parallel? > Looking at the documentation I see that you can do it easily for the looped > version but is there a macro or something to pass the

[julia-users] Re: Performance compared to Matlab

2015-10-21 Thread Kristoffer Carlsson
For fun (and science) I tried out the new package https://github.com/IntelLabs/ParallelAccelerator.jl for this problem. Here is the code: function Jakes_Flat( fd, Ts, Ns, t0 = 0, E0 = 1, phi_N = 0 ) # Inputs: # # Outputs: N0 = 8; # As suggested by Jakes N = 4*N0+2;

[julia-users] Re: Performance compared to Matlab

2015-10-21 Thread Kristoffer Carlsson
Btw it is really cool to see julia running at 400% CPU when running a list comprehension. I did some more benchmarks with larger N to reduce the noise a bit and the difference is actually not that great between Matlab and Julia. However, tying with Matlabs parallellized vectorized maps is

Re: [julia-users] Re: Performance compared to Matlab

2015-10-21 Thread Kristoffer Carlsson
For fun (and science) I tried out the new package https://github.com/IntelLabs/ParallelAccelerator.jl for this problem. Here is the code: function Jakes_Flat( fd, Ts, Ns, t0 = 0, E0 = 1, phi_N = 0 ) # Inputs: # # Outputs: N0 = 8; # As suggested by Jakes N = 4*N0+2;

[julia-users] Re: Performance compared to Matlab

2015-10-21 Thread Lindsey Kuper
It's fantastic to see some good ParallelAccelerator results "in the wild"! Thanks for sharing. Lindsey On Wednesday, October 21, 2015 at 1:23:53 PM UTC-7, Kristoffer Carlsson wrote: > > Btw it is really cool to see julia running at 400% CPU when running a list > comprehension. > > I did some

Re: [julia-users] Re: Performance compared to Matlab

2015-10-19 Thread Daniel Carrera
Julia vectorized code should certainly be as fast as Matlab and NumPy vectorized code, and to the best of my knowledge, it already is. But de-vectorized code will always have an advantage because you have low-level control, and you can avoid temp variables. Cheers, Daniel. On 19 October 2015 at

[julia-users] Re: Performance compared to Matlab

2015-10-19 Thread Phil Tomson
Several comments here about the need to de-vectorize code and use for-loops instead. However, vectorized code is a lot more compact and generally easier to read than lots of for-loops. I seem to recall that there was discussion in the past about speeding up vectorized code in Julia so that it

[julia-users] Re: Performance compared to Matlab

2015-10-19 Thread Steven G. Johnson
On Monday, October 19, 2015 at 3:05:11 PM UTC-4, Phil Tomson wrote: > > Otherwise, if we keep telling people that they need to convert their code > to use for-loops, I think Julia isn't going to seem very compelling for > people looking for alternatives to Matlab, R, etc. > You only need

[julia-users] Re: Performance compared to Matlab

2015-10-19 Thread David Gold
One doesn't always need to write the loops oneself. Oftentimes switching from a pure operator (e.g. broadcast) to its in-place counterpart (e.g. broadcast!) can make a world of difference: julia> A = rand(5_000_000); julia> function f(A) sum(A .+ A.^2) end f (generic function with 1

Re: [julia-users] Re: Performance compared to Matlab

2015-10-19 Thread Milan Bouchet-Valat
Le lundi 19 octobre 2015 à 12:05 -0700, Phil Tomson a écrit : > Several comments here about the need to de-vectorize code and use for > -loops instead. However, vectorized code is a lot more compact and > generally easier to read than lots of for-loops. I seem to recall > that there was discussion

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Andras Niedermayer
The type instability looks like a bug in Julia to me, filed issue: https://github.com/JuliaLang/julia/issues/13665 On Sunday, October 18, 2015 at 2:54:04 PM UTC+2, Andras Niedermayer wrote: > > There is a type instability (see here >

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Daniel Carrera
Hello, Other people have already given advice on how to speed up the code. I just want to comment that Julia really is faster than Matlab, but the way that you make code faster in Julia is almost the opposite of how you do it in Matlab. Specifically, in Matlab the advice is that if you want

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Kristoffer Carlsson
Worth saying is that Julia is not faster than Matlab if most of your time is spent on doing cosinus on a large array, which this is doing. On Sunday, October 18, 2015 at 3:41:54 PM UTC+2, Daniel Carrera wrote: > > Hello, > > Other people have already given advice on how to speed up the code. I

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Andras Niedermayer
There is a type instability (see here ) that slows down your code. @code_warntype Jakes_Flat( 926, 1e-6, 5, 0, 1, 0 ) shows that variable h has type Any. I managed to track down the type

[julia-users] Re: Performance compared to Matlab

2015-10-18 Thread Jason Merrill
Two quick pieces of advice: Try @code_warntype Jakes_Flat( 926, 1e-6, 5, 0, 1, 0 ) For some reason, the type of the variable "h" is not being inferred tightly (i.e. it has type any). If you can sort things out so that h is typed more concretely, I suspect you'll be able to match matlab's