This is a place where people can discuss massiv and possibly other array libraries in Haskell.
openblas
makes hmatrix just a little bit slower. I don't remember how I got "orders of magnitude" difference, but in my defence it has been a while since I looked at it:benchmarking HMatrix/MxM Double  (500x800 X 800x500)/Par
time 9.140 ms (4.980 ms .. 12.18 ms)
0.527 R² (0.349 R² .. 0.651 R²)
mean 4.794 ms (2.775 ms .. 6.977 ms)
std dev 5.082 ms (3.646 ms .. 5.969 ms)
variance introduced by outliers: 98% (severely inflated)
benchmarking HMatrix/MxM Float  (500x800 X 800x500)/Par
time 6.678 ms (4.953 ms .. 8.027 ms)
0.743 R² (0.519 R² .. 0.907 R²)
mean 6.208 ms (5.417 ms .. 6.890 ms)
std dev 1.838 ms (1.391 ms .. 2.718 ms)
variance introduced by outliers: 94% (severely inflated)
benchmarking Massiv/MxM P Double  (500x800 X 800x500)/Par
time 6.874 ms (6.559 ms .. 7.147 ms)
0.991 R² (0.987 R² .. 0.995 R²)
mean 7.485 ms (7.157 ms .. 8.063 ms)
std dev 1.246 ms (789.7 μs .. 1.867 ms)
variance introduced by outliers: 79% (severely inflated)
benchmarking Massiv/MxM P Float  (500x800 X 800x500)/Par
time 6.783 ms (6.671 ms .. 6.896 ms)
0.997 R² (0.993 R² .. 0.999 R²)
mean 6.832 ms (6.766 ms .. 6.933 ms)
std dev 238.9 μs (168.5 μs .. 365.5 μs)
variance introduced by outliers: 16% (moderately inflated)
98% (severely inflated)
taht's normal for multi core benchmarks
N
since it uses parallelization on C side
we are talking results without openblas now, right?
openblas or blas
Cause it seems hmatrix
uses either or:
if flag(openblas)
if !flag(disabledefaultpaths)
extralibdirs: /usr/lib/openblas/lib
extralibraries: openblas
else
extralibraries: blas lapack
openblas
flag in hmatrix
it still uses all cores
I read in blas/lapack docs that they are strictly single core and my experience confirms it, but there must be other versions in new Ubuntus for which it doesn't apply any more or perhaps it stopped applying long ago, but now they have different default setting and run multicore
Ok, so this is exactly where I got my impression that massiv was much faster than hmatrix without an openblas
flag on my older computer whre I used Ubuntu
blas
:$ stack bench :mult ba 'match pattern Par +RTS N1'
hmatrixbench> benchmarks
Running 1 benchmarks...
Benchmark mult: RUNNING...
benchmarking HMatrix/MxM Double  (500x800 X 800x500)/Par
time 1.254 ms (1.124 ms .. 1.413 ms)
0.940 R² (0.914 R² .. 0.992 R²)
mean 1.238 ms (1.178 ms .. 1.358 ms)
std dev 267.3 μs (172.2 μs .. 436.6 μs)
variance introduced by outliers: 94% (severely inflated)
benchmarking HMatrix/MxM Float  (500x800 X 800x500)/Par
time 718.8 μs (673.9 μs .. 774.4 μs)
0.942 R² (0.903 R² .. 0.978 R²)
mean 772.8 μs (710.1 μs .. 991.5 μs)
std dev 339.4 μs (120.9 μs .. 675.6 μs)
variance introduced by outliers: 99% (severely inflated)
benchmarking Massiv/MxM P Double  (500x800 X 800x500)/Par
time 62.91 ms (62.26 ms .. 63.55 ms)
1.000 R² (1.000 R² .. 1.000 R²)
mean 63.97 ms (63.25 ms .. 66.65 ms)
std dev 2.304 ms (455.6 μs .. 4.013 ms)
benchmarking Massiv/MxM P Float  (500x800 X 800x500)/Par
time 79.19 ms (78.63 ms .. 79.77 ms)
1.000 R² (1.000 R² .. 1.000 R²)
mean 80.06 ms (79.75 ms .. 80.38 ms)
std dev 557.9 μs (372.2 μs .. 849.1 μs)
What it means is that I should be comparing this massiv's performance:
benchmarking Massiv/MxM P Double  (500x800 X 800x500)/Par
time 6.887 ms (6.749 ms .. 7.048 ms)
0.993 R² (0.978 R² .. 0.999 R²)
mean 7.009 ms (6.888 ms .. 7.235 ms)
std dev 425.6 μs (220.2 μs .. 638.2 μs)
variance introduced by outliers: 33% (moderately inflated)
To hmatrix
as such:
benchmarking HMatrix/MxM Double  (500x800 X 800x500)/Par
time 1.254 ms (1.124 ms .. 1.413 ms)
0.940 R² (0.914 R² .. 0.992 R²)
mean 1.238 ms (1.178 ms .. 1.358 ms)
std dev 267.3 μs (172.2 μs .. 436.6 μs)
variance introduced by outliers: 94% (severely inflated)
benchmarking Massiv/MxM P Double  (500x800 X 800x500)/Par
time 6.887 ms (6.749 ms .. 7.048 ms)
0.993 R² (0.978 R² .. 0.999 R²)
mean 7.009 ms (6.888 ms .. 7.235 ms)
std dev 425.6 μs (220.2 μs .. 638.2 μs)
variance introduced by outliers: 33% (moderately inflated)
benchmarking HMatrix/MxM Double  (500x800 X 800x500)/Par
time 2.457 ms (1.275 ms .. 4.701 ms)
0.276 R² (0.256 R² .. 0.971 R²)
mean 1.716 ms (1.392 ms .. 3.427 ms)
std dev 1.666 ms (311.3 μs .. 3.915 ms)
variance introduced by outliers: 98% (severely inflated)
src/Data/Massiv/Array/Manifest/Unboxed.hs:147:33: error:
• Couldn't match type ‘m’ with ‘ST (PrimState m)’
‘m’ is a rigid type variable bound by
the type signature for:
initialize :: forall ix (m :: * > *).
(Index ix, PrimMonad m) =>
MArray (PrimState m) U ix e > m ()
at src/Data/Massiv/Array/Manifest/Unboxed.hs:147:312
Expected type: m ()
Actual type: ST (PrimState m) ()
• In the expression: VGM.basicInitialize marr
In an equation for ‘initialize’:
initialize (MUArray _ marr) = VGM.basicInitialize marr
In the instance declaration for ‘Manifest U e’
• Relevant bindings include
marr :: MVU.MVector (PrimState m) e
(bound at src/Data/Massiv/Array/Manifest/Unboxed.hs:147:25)
initialize :: MArray (PrimState m) U ix e > m ()
(bound at src/Data/Massiv/Array/Manifest/Unboxed.hs:147:3)

147  initialize (MUArray _ marr) = VGM.basicInitialize marr
 ^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build massiv1.0.1.1 (which is required by exe:massivstuff