<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Firstly, especially when you are talking about performance, please provided detailed information on (a) the versions of the compiler and libraries that you used and (b) of the command line options that you used for compilation.</div><div><br></div><div>Secondly, your function 'transposeP' doesn't make for a good nested data-parallel program. I haven't looked at the generated code, but I wouldn't be surprised if it doesn't optimise very well.</div><div><br></div><div>The core benefit of nested data parallelism is that the sub-arrays in a nested array of arrays can be of varying size leading to irregular parallelism. However, that flexibility comes at a price, namely that it is a fairly inefficient representation for *rectangular arrays*, such as regular two-dimensional matrices (as in your example). It shouldn't be quite as inefficient as what you report, but it will never be competitive with a dedicated regular representation.</div><div><br></div><div>Hence, for code, such as yours, we recommend to use our Repa library:&nbsp;<a href="http://hackage.haskell.org/package/repa">http://hackage.haskell.org/package/repa</a></div><div><br></div><div>It generates very fast code for regular array problems, see also <a href="http://www.cse.unsw.edu.au/~chak/papers/LCKP12.html">http://www.cse.unsw.edu.au/~chak/papers/LCKP12.html</a></div><div><br></div><div>Manuel</div><div><br></div><br><div><div>mblanco &lt;<a href="mailto:blancomau@gmail.com">blancomau@gmail.com</a>&gt;:</div><blockquote type="cite"><div style="font-family: arial, sans-serif; ">Hi, I'm trying to implement a matrix product example using DPH. This is the code:</div><div style="font-family: arial, sans-serif; "><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------------------------<br></div><div><div>type MMultType = Double</div><div>type Matrix = [:[:MMultType:]:]</div><div>type MVector = [:MMultType:]</div><div>type Matrix_wrapper = PArray (PArray MMultType)</div></div><div><br></div><div><div>{-# NOINLINE matMult_wrapper #-}</div><div>matMult_wrapper :: Matrix_wrapper -&gt; Matrix_wrapper -&gt; Matrix_wrapper</div><div>matMult_wrapper mA mB = toPArrayP (mapP toPArrayP (matMult (fromNestedPArrayP mA) (fromNestedPArrayP mB)))</div><div><br></div><div>matMult :: Matrix -&gt; Matrix -&gt; Matrix</div><div>matMult mA mB = mapP (\row -&gt; mapP (\col -&gt; dotp row col) (transposeP mB)) mA</div><div><br></div><div>dotp :: MVector -&gt; MVector -&gt; MMultType</div><div>dotp row col = D.sumP (zipWithP (D.*) row col)</div><div><br></div><div>transposeP :: Matrix -&gt; Matrix</div><div>transposeP m =&nbsp;</div><div>&nbsp; &nbsp; let</div><div>&nbsp; &nbsp; &nbsp; &nbsp; h = lengthP m</div><div>&nbsp; &nbsp; &nbsp; &nbsp; w = lengthP (m !: 0)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; rh = I.enumFromToP 0 (h I.- 1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; rw = I.enumFromToP 0 (w I.- 1)</div><div>&nbsp; &nbsp; in</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if h I.== 0 then [: :]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; else mapP (\y -&gt; mapP (\x -&gt; m !: x !: y) rh) rw</div></div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------------------------</div></div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">My problem is at execution time, on matrices of size 300*300 the program does finish (although it is very slow), but on 700*700 it consumes GBs of RAM until the process is aborted.</div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">In the paper "Work Efficient Higher-Order Vectorisation" it is explained that a work complexity problem (wich involved unnecesary array replication) was recently treated. So at first I thought the code implementation related to the paper had not been uploaded to hackage. But as I understand it must have been, as that seems to be the motive of the "dph-lifted-vseg" package.</div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">Does anybody notice the problem with the example or if the problem is related to the subject treated in the paper?</div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">Thanks in advance!</div>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>http://www.haskell.org/mailman/listinfo/haskell-cafe<br></blockquote></div><br></body></html>