[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Can Lua/Ravi beat Fortran?
- From: Dibyendu Majumdar <mobile@...>
- Date: Sat, 8 Aug 2015 01:39:38 +0100
I mentioned before that I intend to build and maintain a bunch of
standard libraries for Ravi. One of the first ones I am working on is
a Matrix library (https://github.com/dibyendumajumdar/ravi-matrix). I
am aware of numlua project before anyone asks!
The Ravi Matrix library is designed so that it will work both with
standard Lua and Ravi. When using standard Lua, the matrices are
stored in Userdata objects, when using Ravi the matrices are stored in
number[] objects.
Interestingly on Windows 64, using reference BLAS implementation
(compiled using gfortran) - I get following result for a matrix
multiplication - matrix size is 2000x2000.
C:\github\ravi-matrix\tests>..\..\ravi\build\Release\lua matmul1.lua 2000 1
Initializing RaviMatrix
RaviMatrix initialized successfully
using Ravi matrix
gen: time 0.051
using Ravi matrix
gen: time 0.05
total time taken 29.841
Now using Ravi's number[] and a native implementation I get:
using Ravi matrix
gen: time 0.054000000000002
using Ravi matrix
gen: time 0.087999999999997
using Ravi matrix
mmul: time 7.742
total time taken 7.885
comp ok
Of course if I switch the BLAS implementation to a more optimized
version then results will be different. Still, I found this
interesting and wanted to share.
The test program is this:
https://github.com/dibyendumajumdar/ravi-matrix/blob/master/tests/matmul1.lua
Regards
Dibyendu