[Clp] CLP exception poped up when solving an LP
Lacroix, Robert
ralacroix at hydro.mb.ca
Wed May 18 12:17:56 EDT 2016
Read the source, Luke.
According to CoinHelperFunctions.hpp
USE_MEMCPY is unavailable to code compiled by Microsoft C++ because _MSC_VER is defined by the compiler. This is the reason the previous suggestion doesn’t work.
There is a comment that CoinMemcpy (which just calls CoinMemcpyN) throws an exception if you are trying to copy overlapping arrays. This is something worth checking. Look to see if you have incorrect or mis-ordered arguments in a function call.
I also note a comment which says the compiler may produce better code if you define COIN_USE_RESTRICT in the configuration when building CoinUtils. If this is an improvement, why isn’t it the default? In Linux I would set an environment variable in the shell (export CXXDEFS=-DCOIN_USE_RESTRICT) before running the “configure” script for CLP, but I don’t know how you would do that in Visual Studio.
Robert Lacroix
From: usa usa [mailto:usact2012 at gmail.com]
Sent: Wednesday, May 18, 2016 9:15 AM
To: John Forrest; Lacroix, Robert
Cc: clp at list.coin-or.org
Subject: Re: [Clp] CLP exception poped up when solving an LP
After recompiled all libs, I got the exception same as the original one:
Unhandled exception at 0x00217A52 in MyApp.exe: 0xC0000005: Access violation reading location 0x1BBEFFFC.
even though I have defined USE_MEMCPY in CoinHelperFunctions.hpp and disabled all compile optimization for speed for all Clp libs.
thanks
On Wed, May 18, 2016 at 9:45 AM, usa usa <usact2012 at gmail.com<mailto:usact2012 at gmail.com>> wrote:
Hi,
I have defined USE_MEMCPY in CoinHelperFunctions.hpp and disabled all compile optimization for speed for all Clp libs. When I run myApp.exe in debug mode from Visual Studio 2013, I got error:
Unhandled exception at 0x7541C54F in myApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
which is different from last error.
It seems that a NULL pointer is dereference ?
Thanks,
On Wed, May 18, 2016 at 3:56 AM, John Forrest <john.forrest at fastercoin.com<mailto:john.forrest at fastercoin.com>> wrote:
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<mailto: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<mailto:Clp at list.coin-or.org>
http://list.coin-or.org/mailman/listinfo/clp
_______________________________________________
Clp mailing list
Clp at list.coin-or.org<mailto: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/23ca1a68/attachment-0001.html>
More information about the Clp
mailing list