[Coin-discuss] CoinPackedMatrix memory management

Jörg Herbers herbers at hotmail.com
Thu Jul 31 09:30:11 EDT 2003


Thanks for your answer and the bugfix, and sorry that I oversaw this "little 
detail"! With standard settings 0.25 for extraGap_ and extraMajor_, the 
performance is acceptable now (even though a previous reserve() is clearly 
still much faster).

Actually, I used CoinPackedMatrix via BCP_lp_relax. The first constructor 
BCP_lp_relax(const bool) calls a CoinPackedMatrix constructor which 
initializes extraGap_ and extraMajor_ to 0. Is there a reason for this? 
Wouldn't it be better to have a BCP_lp_relax(const bool, const double 
extraMajor, const double extraGap) constructor as in CoinPackedMatrix?

Thanks in advance,
Jörg


>>>ladanyi at us.ibm.com 7/30/2003 8:16:23 PM >>>


On Wed, 30 Jul 2003, J÷rg Herbers wrote:

>When building a sparse matrix with several ten thousand non-zero entries 
>with CoinPackedMatrix, I have run into performance problems: When I 
>successively added columns without manual actions wrt. memory management 
>(matrix is column-ordered), it took several minutes to build the matrix. 
>When reserving memory before (via CoinPackedMatrix::reserve), 
>initialization times reduce to fractions of a second.
>
>I have found that a reallocation is done every time a column is added (in 
>resizeForAddingMajorVectors) if memory is not allocated before. 
>Effectively, all data vectors are newly allocated and copied.
>
>Clearly, manual allocation via reserve() is always possible, but the 
>calculation of the number of non-zeros can be cumbersome. Instead, it would 
>be better to have an enhanced memory management, e.g. by using "realloc" 
>style memory management (which does not always copy the memory blocks) and 
>by reserving extra space upon each resize operation (i.e. always 
>reallocating for a given "delta" of additional elements). Is there anything 
>planned in that direction?

Actually, this extra space reservation is in the CoinPackedMatrix class. The
extraGap_ and extraMajor_ members indicate the extra percentage to be
allocated for new nonzeros and columns (for column major ordered matrix).
At least that was the plan. I just looked at the code and found a stupid 
bug.
Fixed it and committed it.

Please, check it out and test it.

>
>J÷rg
>
>_________________________________________________________________
>Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
>http://join.msn.com/?page=features/junkmail
>
>_______________________________________________
>Coin-discuss mailing list
>Coin-discuss at www-124.ibm.com 
>http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss
>

Thanks for the bug report!

--Laci

_______________________________________________
Coin-discuss mailing list
Coin-discuss at www-124.ibm.com
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail




More information about the Coin-discuss mailing list