Re: MTL slow on large matrices?

Peter Gottschling <[email protected]> Tue, 3 Apr 2007 12:06:44 -0400
Newsgroups gmane.comp.lib.mtl.devel
Message-ID <[email protected]>
--===============0094150188==
Content-Type: multipart/alternative; boundary=Apple-Mail-3--259291070


--Apple-Mail-3--259291070
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

Sorry about that Yaron,

This is a known problem with MTL2 that the performance on large  
sparse matrices is critical.  Preallocation might speed up the  
construction somehow but wouldn't solve completely.

I'm working on a new version of MTL, which I plan to prerelease in  
the next weeks.  It won't have the complete functionality of MTL2 but  
the matrix insertion will be clearly faster (maybe faster then  
PETSc ;-) ).  It's a completely different implementation.  I'll let  
you know.

Cheers,
Peter

On Apr 3, 2007, at 11:29 AM, Yaron Kretchmer wrote:

> Hi There.
> I'm trying to construct a large (4e6 * 1e6) sparse matrix, with nnz  
> per row/column at <10.
> MTL gives really horrible performance compared to other sparse  
> matrix libraries (Such as Petsc)- I'm talking about just the  
> construction of the matrix itself, no arithmetic operations. In  
> tests I've conducted the difference is about 30X.
> I'm suspecting this is because MTL does not preallocate sparse  
> matrix memory. but rather enlarges the underlying STL objects as  
> new values are put into the matrix- does that make sense?
>
> Is there a way of enforcing preallocation (preferably individually  
> at a per-row/per-column basis, but even globally would be a good  
> place to start) when creating sparse matrix objects?
>
> Cheers
> Yaron
>
> _______________________________________________
> This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/

------------
Peter Gottschling
Research Associate
Open Systems Laboratory
Indiana University
135 Lindley Hall
Bloomington, IN 47405
Tel.: +1 812 855-3608   Fax: +1 812 856 0853
http://www.osl.iu.edu/~pgottsch



--Apple-Mail-3--259291070
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">Sorry about that Yaron,<DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>This is a known problem =
with MTL2 that the performance on large sparse matrices is critical.=A0 =
Preallocation might speed up the construction somehow but wouldn't solve =
completely.</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>I'm=
 working on a new version of MTL, which I plan to prerelease in the next =
weeks.=A0 It won't have the complete functionality of MTL2 but the =
matrix insertion will be clearly faster (maybe faster then PETSc ;-) ).=A0=
 It's a completely different implementation.=A0 I'll let you =
know.</DIV><DIV>=A0</DIV><DIV>Cheers,</DIV><DIV>Peter</DIV><DIV><BR><DIV><=
DIV>On Apr 3, 2007, at 11:29 AM, Yaron Kretchmer wrote:</DIV><BR =
class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"><P><FONT =
size=3D"2">Hi There.<BR> I'm trying to construct a large (4e6 * 1e6) =
sparse matrix, with nnz per row/column at &lt;10.<BR> MTL gives really =
horrible performance compared to other sparse matrix libraries (Such as =
Petsc)- I'm talking about just the construction of the matrix itself, no =
arithmetic operations. In tests I've conducted the difference is about =
30X.<BR> I'm suspecting this is because MTL does not preallocate sparse =
matrix memory. but rather enlarges the underlying STL objects as new =
values are put into the matrix- does that make sense?<BR> <BR> Is there =
a way of enforcing preallocation (preferably individually at a =
per-row/per-column basis, but even globally would be a good place to =
start) when creating sparse matrix objects?<BR> <BR> Cheers<BR> =
Yaron</FONT> </P><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; =
">_______________________________________________</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">This list is archived at <A =
href=3D"http://www.osl.iu.edu/MailArchives/mtl-devel/">http://www.osl.iu.e=
du/MailArchives/mtl-devel/</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; =
"><DIV>------------</DIV><DIV>Peter Gottschling</DIV><DIV>Research =
Associate</DIV><DIV>Open Systems Laboratory</DIV><DIV>Indiana =
University</DIV><DIV>135=A0Lindley Hall</DIV><DIV>Bloomington, IN =
47405</DIV><DIV>Tel.: +1 812 855-3608=A0 =A0Fax: +1 812 856 =
0853</DIV><DIV><A =
href=3D"http://www.osl.iu.edu/~pgottsch">http://www.osl.iu.edu/~pgottsch</=
A></DIV><BR class=3D"Apple-interchange-newline"></SPAN></SPAN> =
</DIV><BR></DIV></BODY></HTML>=

--Apple-Mail-3--259291070--

--===============0094150188==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
--===============0094150188==--