Matrix vector product in Julia

134 views
Skip to first unread message

Perif

unread,
May 29, 2012, 3:13:11 AM5/29/12
to juli...@googlegroups.com
Hello all,

By curiosity I have made some experimentations on the dense matrix vector product using Julia, my goal being to compare the perfs of Julia vs C in serial and parallel (without using blas/lapack, just the language).

I began by making a naive implementation, then extracted the vector doc product in a function. Comparing the naive and the implementation using the extracted dot prod gave me some interesting results :

extracted dot prod -> elapsed time: 2.0150580406188965 seconds
naive -> elapsed time: 14.084102869033813 seconds

The matrix is of n*n size and the vector of size n, n=5000 for presented results. The Julia source code is attached to my post.

I would like to improve these timings in serial using some of the commodities of Julia, do you have any advice/idea on how to improve the matrix vector product using Julia. What about a parallel implementation ?

Thanks.
mvomp.jl

Stefan Karpinski

unread,
May 29, 2012, 5:27:26 AM5/29/12
to juli...@googlegroups.com
Interesting. I get 3s vs 21s on my machine (same one the benchmarks on the julialang.org page are timed on). That's without any extra processes, so all the distributed stuff is pure overhead. If change the code into a non-distributed version, however, I get 

extracted dotprod elapsed time: 0.6609759330749512 seconds
naive elapsed time: 0.471358060836792 seconds

Jeff Bezanson

unread,
May 29, 2012, 2:20:29 PM5/29/12
to juli...@googlegroups.com
Without a doubt, DArrays are not designed to be used an element at a
time. But, having such a totally different programing model for
DArrays isn't very satisfying. It would be nice to make some progress
unifying them.

Perif

unread,
May 29, 2012, 9:17:04 PM5/29/12
to juli...@googlegroups.com
Thanks, that make sense. I will try to see if I can obtain more results in parallel.
Reply all
Reply to author
Forward
0 new messages