[Clp] CLP exception poped up when solving an LP

John Forrest john.forrest at fastercoin.com
Wed May 18 03:56:43 EDT 2016


Robert,

I agree.  I use CoinMemcpyN which is same as CoinCopyN unless 
-DUSE_MEMCPY defined when it uses memcpy - there is a remark at line 255 
of CoinHelperFunctions.hpp.  So try defining USE_MEMCPY in your 
configuration and using CoinMemcpyN in your code.  If it still errors 
then it may be easier to see what is wrong.

John Forrest
On 17/05/16 22:56, Lacroix, Robert wrote:
>
> This is just a memory copy. Why is Duff’s device being used here?
>
> Hasn’t Duff’s device been obsoleted by modern compilers and machine 
> architectures?
>
> Not even mentioning that the code might not work, depending on how 
> tricky the compiler tries to be about optimization.
>
> Try recompiling CLP with minimal compiler optimization and see if the 
> exception still happens.
>
> Then tell us about the result. It will be of special interest to those 
> of us that rely on CLP for decision support.
>
> Robert Lacroix
>
> Manitoba Hydro
>
> *From:*Clp [mailto:clp-bounces at coin-or.org] *On Behalf Of *usa usa
> *Sent:* Friday, May 13, 2016 11:07 AM
> *To:* clp at list.coin-or.org
> *Subject:* [Clp] CLP exception poped up when solving an LP
>
> Hi, I am using CLP to solve an LP with
>
>    rowNum =  1002 and columNum = 6202 and totalElementNum = 6,214,404
>
>
> In *CoinCopyN* (register const T* from, const int size, register T* 
> to) called from CoinMemcpyN(ind,numels,index_), which is called from 
> gutsOfOpEqual(colordered, minor, major, numels, elem, ind, start, len);
>
> I got an exception:
>
> *
>        Unhandled exception at 0x00217A52 in MyApp.exe: 0xC0000005: 
> Access  violation reading location 0x1BBEFFFC.*
>
> The exception poped up at
>
> *case 2:         *--downto = *--downfrom;*
>
>
> template <class T> inline void
> *CoinCopyN* (register const T* from, const int size, register T* to)
> {
>     if (size == 0 || from == to)
>     return;
>
> #ifndef NDEBUG
>     if (size < 0)
>     throw CoinError("trying to copy negative number of entries",
>             "CoinCopyN", "");
> #endif
>
>     register int n = (size + 7) / 8; *// size = 6214404*
>     if (to > from) {
>     register const T* downfrom = from + size;
>     register T* downto = to + size;
>     // Use Duff's device to copy
>     switch (size % 8) {
>     case 0: do{     *--downto = *--downfrom;
>     case 7:         *--downto = *--downfrom;
>     case 6:         *--downto = *--downfrom;
>     case 5:         *--downto = *--downfrom;
>     case 4:         *--downto = *--downfrom;
>     case 3:         *--downto = *--downfrom;
> *    case 2:         *--downto = *--downfrom;  // exception poped up 
> here,*
>     case 1:         *--downto = *--downfrom;
>     }while(--n>0);
>     }
>
> I do not understand why this happed ?
>
> I have used CLP to solve some large benchmark Lp models without problems.
>
> Any help would be appreciated.
>
> thanks!
>
>
>
> _______________________________________________
> Clp mailing list
> Clp at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/clp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/clp/attachments/20160518/22f16bc3/attachment.html>


More information about the Clp mailing list