COIN-OR::LEMON - Graph Library

Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#477 closed defect (fixed)

Turn on LEMON_ENABLE_DEBUG in Debug mode

Reported by: Alpar Juttner Owned by: Alpar Juttner
Priority: major Milestone: LEMON 1.4 release
Component: core Version: hg main
Keywords: Cc:
Revision id:

Description

CMAKE should set -DLEMON_ENABLE_DEBUG in Debug mode. (This is basically relevant to the test and demo codes only)

Attachments (2)

dd57dfa12bd5.patch (1.2 KB) - added by Alpar Juttner 6 years ago.
ce896fa7fd65.patch (751 bytes) - added by Alpar Juttner 6 years ago.

Download all attachments as: .zip

Change History (9)

Changed 6 years ago by Alpar Juttner

Attachment: dd57dfa12bd5.patch added

comment:1 Changed 6 years ago by Alpar Juttner

The attached changeset [dd57dfa12bd5] implements this by adding

#define LEMON_ENABLE_DEBUG 1

to lemon/config.h in Debug and Maintainer build types. The drawback of this solution is that LEMON_ENABLE_DEBUG will always be turned on in these modes. Which may or may not be desired.

What is your opinion?

The alternative solution would be to pass -DLEMON_ENABLE_DEBUG as a compilation flag when the test and demo codes are compiled.

By the way LEMON_ENABLE_DEBUG seems to reveal a bug in test/min_cost_flow_test.cc, see #478

Last edited 4 years ago by Alpar Juttner (previous) (diff)

Changed 6 years ago by Alpar Juttner

Attachment: ce896fa7fd65.patch added

comment:2 Changed 6 years ago by Alpar Juttner

The attached changeset [ce896fa7fd65] is an alternative implementation. It passes -DLEMON_ENABLE_DEBUG to the compiler instead of hard-wiring it in lemon/config.h. The difference is that if LEMON is built in debug mode, then [dd57dfa12bd5] will also set LEMON_ENABLE_DEBUG in external codes using LEMON, while [ce896fa7fd65] will not.

Always using -DLEMON_ENABLE_DEBUG helps revealing bugs, but may also slow down the execution in DEBUG mode too much. Note that -DLEMON_ENABLE_DEBUG may do extensive consistency checks, and will probably do even more in the future, see #462, #466

All in all, the question is --- which solution do you prefer?

comment:3 Changed 6 years ago by Alpar Juttner

Milestone: LEMON 1.4 release

comment:4 Changed 6 years ago by Balazs Dezso

I would prefer [ce896fa7fd65]. Users can still define LEMON_ENABLE_DEBUG, when they compile external code.

comment:5 in reply to:  4 Changed 6 years ago by Alpar Juttner

Replying to deba:

I would prefer [ce896fa7fd65]. Users can still define LEMON_ENABLE_DEBUG, when they compile external code.

Yes they can. What I'm a bit uncertain whether they will actually do.

An alternative solution would be if Debug modes turned on LEMON_ENABLE_DEBUG, but the user could switch is off if it slows the execution down too much.

Last edited 4 years ago by Alpar Juttner (previous) (diff)

comment:6 Changed 4 years ago by Alpar Juttner

Resolution: fixed
Status: newclosed

[ce896fa7fd65] has been merged into the main branch.

comment:7 in reply to:  6 Changed 4 years ago by Alpar Juttner

Replying to alpar:

[ce896fa7fd65] has been merged into the main branch.

In fact a little bit modified version of it: [ee96cd1cad8a]

Note: See TracTickets for help on using tickets.