cadical 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +26 -0
- data/README.md +101 -0
- data/ext/cadical/cadical/LICENSE +28 -0
- data/ext/cadical/cadical/README.md +65 -0
- data/ext/cadical/cadical/VERSION +1 -0
- data/ext/cadical/cadical/src/analyze.cpp +1360 -0
- data/ext/cadical/cadical/src/arena.cpp +30 -0
- data/ext/cadical/cadical/src/arena.hpp +105 -0
- data/ext/cadical/cadical/src/assume.cpp +616 -0
- data/ext/cadical/cadical/src/averages.cpp +34 -0
- data/ext/cadical/cadical/src/averages.hpp +37 -0
- data/ext/cadical/cadical/src/backbone.cpp +631 -0
- data/ext/cadical/cadical/src/backtrack.cpp +177 -0
- data/ext/cadical/cadical/src/backward.cpp +231 -0
- data/ext/cadical/cadical/src/bins.cpp +22 -0
- data/ext/cadical/cadical/src/bins.hpp +22 -0
- data/ext/cadical/cadical/src/block.cpp +824 -0
- data/ext/cadical/cadical/src/block.hpp +37 -0
- data/ext/cadical/cadical/src/cadical.cpp +1026 -0
- data/ext/cadical/cadical/src/cadical.hpp +1419 -0
- data/ext/cadical/cadical/src/ccadical.cpp +208 -0
- data/ext/cadical/cadical/src/ccadical.h +74 -0
- data/ext/cadical/cadical/src/checker.cpp +649 -0
- data/ext/cadical/cadical/src/checker.hpp +173 -0
- data/ext/cadical/cadical/src/clause.cpp +689 -0
- data/ext/cadical/cadical/src/clause.hpp +190 -0
- data/ext/cadical/cadical/src/collect.cpp +545 -0
- data/ext/cadical/cadical/src/compact.cpp +550 -0
- data/ext/cadical/cadical/src/condition.cpp +940 -0
- data/ext/cadical/cadical/src/config.cpp +101 -0
- data/ext/cadical/cadical/src/config.hpp +20 -0
- data/ext/cadical/cadical/src/congruence.cpp +7880 -0
- data/ext/cadical/cadical/src/congruence.hpp +757 -0
- data/ext/cadical/cadical/src/constrain.cpp +64 -0
- data/ext/cadical/cadical/src/contract.cpp +27 -0
- data/ext/cadical/cadical/src/contract.hpp +139 -0
- data/ext/cadical/cadical/src/cover.cpp +704 -0
- data/ext/cadical/cadical/src/cover.hpp +34 -0
- data/ext/cadical/cadical/src/decide.cpp +347 -0
- data/ext/cadical/cadical/src/decompose.cpp +738 -0
- data/ext/cadical/cadical/src/decompose.hpp +23 -0
- data/ext/cadical/cadical/src/deduplicate.cpp +275 -0
- data/ext/cadical/cadical/src/definition.cpp +283 -0
- data/ext/cadical/cadical/src/delay.hpp +38 -0
- data/ext/cadical/cadical/src/drattracer.cpp +153 -0
- data/ext/cadical/cadical/src/drattracer.hpp +55 -0
- data/ext/cadical/cadical/src/elim.cpp +1171 -0
- data/ext/cadical/cadical/src/elim.hpp +53 -0
- data/ext/cadical/cadical/src/elimfast.cpp +570 -0
- data/ext/cadical/cadical/src/ema.cpp +95 -0
- data/ext/cadical/cadical/src/ema.hpp +68 -0
- data/ext/cadical/cadical/src/extend.cpp +289 -0
- data/ext/cadical/cadical/src/external.cpp +1034 -0
- data/ext/cadical/cadical/src/external.hpp +487 -0
- data/ext/cadical/cadical/src/external_propagate.cpp +1316 -0
- data/ext/cadical/cadical/src/factor.cpp +1011 -0
- data/ext/cadical/cadical/src/factor.hpp +54 -0
- data/ext/cadical/cadical/src/file.cpp +506 -0
- data/ext/cadical/cadical/src/file.hpp +210 -0
- data/ext/cadical/cadical/src/flags.cpp +135 -0
- data/ext/cadical/cadical/src/flags.hpp +93 -0
- data/ext/cadical/cadical/src/flip.cpp +269 -0
- data/ext/cadical/cadical/src/format.cpp +89 -0
- data/ext/cadical/cadical/src/format.hpp +36 -0
- data/ext/cadical/cadical/src/frattracer.cpp +277 -0
- data/ext/cadical/cadical/src/frattracer.hpp +67 -0
- data/ext/cadical/cadical/src/gates.cpp +766 -0
- data/ext/cadical/cadical/src/heap.hpp +212 -0
- data/ext/cadical/cadical/src/idruptracer.cpp +566 -0
- data/ext/cadical/cadical/src/idruptracer.hpp +112 -0
- data/ext/cadical/cadical/src/instantiate.cpp +365 -0
- data/ext/cadical/cadical/src/instantiate.hpp +45 -0
- data/ext/cadical/cadical/src/internal.cpp +1265 -0
- data/ext/cadical/cadical/src/internal.hpp +1941 -0
- data/ext/cadical/cadical/src/inttypes.hpp +34 -0
- data/ext/cadical/cadical/src/ipasir.cpp +47 -0
- data/ext/cadical/cadical/src/ipasir.h +37 -0
- data/ext/cadical/cadical/src/kitten.c +2599 -0
- data/ext/cadical/cadical/src/kitten.h +97 -0
- data/ext/cadical/cadical/src/level.hpp +33 -0
- data/ext/cadical/cadical/src/lidruptracer.cpp +657 -0
- data/ext/cadical/cadical/src/lidruptracer.hpp +122 -0
- data/ext/cadical/cadical/src/limit.cpp +146 -0
- data/ext/cadical/cadical/src/limit.hpp +168 -0
- data/ext/cadical/cadical/src/logging.cpp +214 -0
- data/ext/cadical/cadical/src/logging.hpp +98 -0
- data/ext/cadical/cadical/src/lookahead.cpp +520 -0
- data/ext/cadical/cadical/src/lratchecker.cpp +833 -0
- data/ext/cadical/cadical/src/lratchecker.hpp +168 -0
- data/ext/cadical/cadical/src/lrattracer.cpp +200 -0
- data/ext/cadical/cadical/src/lrattracer.hpp +61 -0
- data/ext/cadical/cadical/src/lucky.cpp +506 -0
- data/ext/cadical/cadical/src/message.cpp +218 -0
- data/ext/cadical/cadical/src/message.hpp +65 -0
- data/ext/cadical/cadical/src/minimize.cpp +224 -0
- data/ext/cadical/cadical/src/mobical.cpp +5588 -0
- data/ext/cadical/cadical/src/occs.cpp +52 -0
- data/ext/cadical/cadical/src/occs.hpp +36 -0
- data/ext/cadical/cadical/src/options.cpp +359 -0
- data/ext/cadical/cadical/src/options.hpp +442 -0
- data/ext/cadical/cadical/src/parse.cpp +471 -0
- data/ext/cadical/cadical/src/parse.hpp +75 -0
- data/ext/cadical/cadical/src/phases.cpp +56 -0
- data/ext/cadical/cadical/src/phases.hpp +19 -0
- data/ext/cadical/cadical/src/probe.cpp +990 -0
- data/ext/cadical/cadical/src/profile.cpp +107 -0
- data/ext/cadical/cadical/src/profile.hpp +283 -0
- data/ext/cadical/cadical/src/proof.cpp +691 -0
- data/ext/cadical/cadical/src/proof.hpp +125 -0
- data/ext/cadical/cadical/src/propagate.cpp +584 -0
- data/ext/cadical/cadical/src/queue.cpp +90 -0
- data/ext/cadical/cadical/src/queue.hpp +74 -0
- data/ext/cadical/cadical/src/radix.hpp +180 -0
- data/ext/cadical/cadical/src/random.cpp +207 -0
- data/ext/cadical/cadical/src/random.h +44 -0
- data/ext/cadical/cadical/src/random.hpp +98 -0
- data/ext/cadical/cadical/src/range.hpp +125 -0
- data/ext/cadical/cadical/src/reap.cpp +127 -0
- data/ext/cadical/cadical/src/reap.hpp +28 -0
- data/ext/cadical/cadical/src/reduce.cpp +278 -0
- data/ext/cadical/cadical/src/reluctant.hpp +82 -0
- data/ext/cadical/cadical/src/rephase.cpp +402 -0
- data/ext/cadical/cadical/src/report.cpp +313 -0
- data/ext/cadical/cadical/src/resources.cpp +160 -0
- data/ext/cadical/cadical/src/resources.hpp +16 -0
- data/ext/cadical/cadical/src/restart.cpp +178 -0
- data/ext/cadical/cadical/src/restore.cpp +267 -0
- data/ext/cadical/cadical/src/score.cpp +51 -0
- data/ext/cadical/cadical/src/score.hpp +16 -0
- data/ext/cadical/cadical/src/shrink.cpp +507 -0
- data/ext/cadical/cadical/src/signal.cpp +136 -0
- data/ext/cadical/cadical/src/signal.hpp +33 -0
- data/ext/cadical/cadical/src/solution.cpp +50 -0
- data/ext/cadical/cadical/src/solver.cpp +1871 -0
- data/ext/cadical/cadical/src/stable.cpp +31 -0
- data/ext/cadical/cadical/src/stack.h +110 -0
- data/ext/cadical/cadical/src/stats.cpp +920 -0
- data/ext/cadical/cadical/src/stats.hpp +418 -0
- data/ext/cadical/cadical/src/subsume.cpp +645 -0
- data/ext/cadical/cadical/src/sweep.cpp +1960 -0
- data/ext/cadical/cadical/src/sweep.hpp +61 -0
- data/ext/cadical/cadical/src/terminal.cpp +38 -0
- data/ext/cadical/cadical/src/terminal.hpp +96 -0
- data/ext/cadical/cadical/src/ternary.cpp +450 -0
- data/ext/cadical/cadical/src/testing.hpp +24 -0
- data/ext/cadical/cadical/src/tier.cpp +189 -0
- data/ext/cadical/cadical/src/tracer.hpp +186 -0
- data/ext/cadical/cadical/src/transred.cpp +253 -0
- data/ext/cadical/cadical/src/unstable.cpp +29 -0
- data/ext/cadical/cadical/src/util.cpp +129 -0
- data/ext/cadical/cadical/src/util.hpp +181 -0
- data/ext/cadical/cadical/src/var.cpp +39 -0
- data/ext/cadical/cadical/src/var.hpp +22 -0
- data/ext/cadical/cadical/src/veripbtracer.cpp +427 -0
- data/ext/cadical/cadical/src/veripbtracer.hpp +106 -0
- data/ext/cadical/cadical/src/version.cpp +107 -0
- data/ext/cadical/cadical/src/version.hpp +13 -0
- data/ext/cadical/cadical/src/vivify.cpp +1893 -0
- data/ext/cadical/cadical/src/vivify.hpp +50 -0
- data/ext/cadical/cadical/src/walk.cpp +1088 -0
- data/ext/cadical/cadical/src/walk.hpp +91 -0
- data/ext/cadical/cadical/src/walk_full_occs.cpp +966 -0
- data/ext/cadical/cadical/src/warmup.cpp +403 -0
- data/ext/cadical/cadical/src/watch.cpp +126 -0
- data/ext/cadical/cadical/src/watch.hpp +77 -0
- data/ext/cadical/cadical_ext.c +778 -0
- data/ext/cadical/extconf.rb +26 -0
- data/lib/cadical/version.rb +3 -0
- data/lib/cadical.rb +12 -0
- metadata +218 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#ifndef QUIET
|
|
2
|
+
|
|
3
|
+
#include "internal.hpp"
|
|
4
|
+
|
|
5
|
+
namespace CaDiCaL {
|
|
6
|
+
|
|
7
|
+
// Initialize all profile counters with constant name and profiling level.
|
|
8
|
+
|
|
9
|
+
Profiles::Profiles (Internal *s)
|
|
10
|
+
: internal (s)
|
|
11
|
+
#define PROFILE(NAME, LEVEL) , NAME (#NAME, LEVEL)
|
|
12
|
+
PROFILES
|
|
13
|
+
#undef PROFILE
|
|
14
|
+
{
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void Internal::start_profiling (Profile &profile, double s) {
|
|
18
|
+
assert (profile.level <= opts.profile);
|
|
19
|
+
assert (!profile.active);
|
|
20
|
+
profile.started = s;
|
|
21
|
+
profile.active = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void Internal::stop_profiling (Profile &profile, double s) {
|
|
25
|
+
assert (profile.level <= opts.profile);
|
|
26
|
+
assert (profile.active);
|
|
27
|
+
profile.value += s - profile.started;
|
|
28
|
+
profile.active = false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
double Internal::update_profiles () {
|
|
32
|
+
double now = time ();
|
|
33
|
+
#define PROFILE(NAME, LEVEL) \
|
|
34
|
+
do { \
|
|
35
|
+
Profile &profile = profiles.NAME; \
|
|
36
|
+
if (profile.active) { \
|
|
37
|
+
assert (profile.level <= opts.profile); \
|
|
38
|
+
profile.value += now - profile.started; \
|
|
39
|
+
profile.started = now; \
|
|
40
|
+
} \
|
|
41
|
+
} while (0);
|
|
42
|
+
PROFILES
|
|
43
|
+
#undef PROFILE
|
|
44
|
+
return now;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
double Internal::solve_time () {
|
|
48
|
+
(void) update_profiles ();
|
|
49
|
+
return profiles.solve.value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#define PRT(S, T) \
|
|
53
|
+
MSG ("%s" S "%s", tout.magenta_code (), T, tout.normal_code ())
|
|
54
|
+
|
|
55
|
+
void Internal::print_profile () {
|
|
56
|
+
double now = update_profiles ();
|
|
57
|
+
const char *time_type = opts.realtime ? "real" : "process";
|
|
58
|
+
SECTION ("run-time profiling");
|
|
59
|
+
PRT ("%s time taken by individual solving procedures", time_type);
|
|
60
|
+
PRT ("(percentage relative to %s time for solving)", time_type);
|
|
61
|
+
LINE ();
|
|
62
|
+
const size_t size = sizeof profiles / sizeof (Profile);
|
|
63
|
+
struct Profile *profs[size];
|
|
64
|
+
size_t n = 0;
|
|
65
|
+
#define PROFILE(NAME, LEVEL) \
|
|
66
|
+
do { \
|
|
67
|
+
if (LEVEL > opts.profile) \
|
|
68
|
+
break; \
|
|
69
|
+
Profile *p = &profiles.NAME; \
|
|
70
|
+
if (p == &profiles.solve) \
|
|
71
|
+
break; \
|
|
72
|
+
if (!profiles.NAME.value && p != &profiles.parse && \
|
|
73
|
+
p != &profiles.search && p != &profiles.simplify) \
|
|
74
|
+
break; \
|
|
75
|
+
profs[n++] = p; \
|
|
76
|
+
} while (0);
|
|
77
|
+
PROFILES
|
|
78
|
+
#undef PROFILE
|
|
79
|
+
|
|
80
|
+
assert (n <= size);
|
|
81
|
+
|
|
82
|
+
// Explicit bubble sort to avoid heap allocation since 'print_profile'
|
|
83
|
+
// is also called during catching a signal after out of heap memory.
|
|
84
|
+
// This only makes sense if 'profs' is allocated on the stack, and
|
|
85
|
+
// not the heap, which should be the case.
|
|
86
|
+
|
|
87
|
+
double solve = profiles.solve.value;
|
|
88
|
+
|
|
89
|
+
for (size_t i = 0; i < n; i++) {
|
|
90
|
+
for (size_t j = i + 1; j < n; j++)
|
|
91
|
+
if (profs[j]->value > profs[i]->value)
|
|
92
|
+
swap (profs[i], profs[j]);
|
|
93
|
+
MSG ("%12.2f %7.2f%% %s", profs[i]->value,
|
|
94
|
+
percent (profs[i]->value, solve), profs[i]->name);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
MSG (" =================================");
|
|
98
|
+
MSG ("%12.2f %7.2f%% solve", solve, percent (solve, now));
|
|
99
|
+
|
|
100
|
+
LINE ();
|
|
101
|
+
PRT ("last line shows %s time for solving", time_type);
|
|
102
|
+
PRT ("(percentage relative to total %s time)", time_type);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
} // namespace CaDiCaL
|
|
106
|
+
|
|
107
|
+
#endif // ifndef QUIET
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
#ifndef _profiles_h_INCLUDED
|
|
2
|
+
#define _profiles_h_INCLUDED
|
|
3
|
+
|
|
4
|
+
/*------------------------------------------------------------------------*/
|
|
5
|
+
#ifndef QUIET
|
|
6
|
+
/*------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
namespace CaDiCaL {
|
|
9
|
+
|
|
10
|
+
struct Internal;
|
|
11
|
+
|
|
12
|
+
/*------------------------------------------------------------------------*/
|
|
13
|
+
|
|
14
|
+
// The solver contains some built in profiling (even for optimized code).
|
|
15
|
+
// The idea is that even without using external tools it is possible to get
|
|
16
|
+
// an overview of where time is spent. This is enabled with the option
|
|
17
|
+
// 'profile', e.g., you might want to use '--profile=3', or even higher
|
|
18
|
+
// values for more detailed profiling information. Currently the default is
|
|
19
|
+
// '--profile=2', which should only induce a tiny profiling overhead.
|
|
20
|
+
//
|
|
21
|
+
// Profiling has a Heisenberg effect, since we rely on calling 'getrusage'
|
|
22
|
+
// instead of using profile counters and sampling. For functions which are
|
|
23
|
+
// executed many times, this overhead is substantial (say 10%-20%). For
|
|
24
|
+
// functions which are not executed many times there is in essence no
|
|
25
|
+
// overhead in measuring time spent in them. These get a smaller profiling
|
|
26
|
+
// level, which is the second argument in the 'PROFILE' macro below. Thus
|
|
27
|
+
// using '--profile=1' for instance should not add any penalty to the
|
|
28
|
+
// run-time, while '--profile=3' and higher levels slow down the solver.
|
|
29
|
+
//
|
|
30
|
+
// To profile say 'foo', just add another line 'PROFILE(foo,LEVEL)' and wrap
|
|
31
|
+
// the code to be profiled within a 'START (foo)' / 'STOP (foo)' block.
|
|
32
|
+
|
|
33
|
+
/*------------------------------------------------------------------------*/
|
|
34
|
+
|
|
35
|
+
// Profile counters for functions which are not compiled in should be
|
|
36
|
+
// removed. This is achieved by adding a wrapper macro for them here.
|
|
37
|
+
|
|
38
|
+
/*------------------------------------------------------------------------*/
|
|
39
|
+
|
|
40
|
+
#ifdef PROFILE_MODE
|
|
41
|
+
#define MROFILE PROFILE
|
|
42
|
+
#else
|
|
43
|
+
#define MROFILE(...) /**/
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#define PROFILES \
|
|
47
|
+
PROFILE (analyze, 3) \
|
|
48
|
+
MROFILE (analyzestable, 4) \
|
|
49
|
+
MROFILE (analyzeunstable, 4) \
|
|
50
|
+
PROFILE (backbone, 2) \
|
|
51
|
+
PROFILE (backward, 3) \
|
|
52
|
+
PROFILE (block, 2) \
|
|
53
|
+
PROFILE (bump, 4) \
|
|
54
|
+
PROFILE (checking, 2) \
|
|
55
|
+
PROFILE (cdcl, 1) \
|
|
56
|
+
PROFILE (collect, 3) \
|
|
57
|
+
PROFILE (compact, 3) \
|
|
58
|
+
PROFILE (condition, 2) \
|
|
59
|
+
PROFILE (congruence, 2) \
|
|
60
|
+
PROFILE (congruencemerge, 4) \
|
|
61
|
+
PROFILE (congruencematching, 4) \
|
|
62
|
+
PROFILE (connect, 3) \
|
|
63
|
+
PROFILE (copy, 4) \
|
|
64
|
+
PROFILE (cover, 2) \
|
|
65
|
+
PROFILE (decide, 3) \
|
|
66
|
+
PROFILE (decompose, 3) \
|
|
67
|
+
PROFILE (definition, 2) \
|
|
68
|
+
PROFILE (elim, 2) \
|
|
69
|
+
PROFILE (factor, 2) \
|
|
70
|
+
PROFILE (fastelim, 2) \
|
|
71
|
+
PROFILE (extend, 3) \
|
|
72
|
+
PROFILE (extract, 3) \
|
|
73
|
+
PROFILE (extractands, 4) \
|
|
74
|
+
PROFILE (extractbinaries, 4) \
|
|
75
|
+
PROFILE (extractites, 4) \
|
|
76
|
+
PROFILE (extractxors, 4) \
|
|
77
|
+
PROFILE (instantiate, 2) \
|
|
78
|
+
PROFILE (lucky, 2) \
|
|
79
|
+
PROFILE (lookahead, 2) \
|
|
80
|
+
PROFILE (minimize, 4) \
|
|
81
|
+
PROFILE (shrink, 4) \
|
|
82
|
+
PROFILE (parse, 0) /* As 'opts.profile' might change in parsing*/ \
|
|
83
|
+
PROFILE (probe, 2) \
|
|
84
|
+
PROFILE (deduplicate, 3) \
|
|
85
|
+
PROFILE (propagate, 4) \
|
|
86
|
+
MROFILE (propstable, 4) \
|
|
87
|
+
MROFILE (propunstable, 4) \
|
|
88
|
+
PROFILE (reduce, 3) \
|
|
89
|
+
PROFILE (restart, 3) \
|
|
90
|
+
PROFILE (restore, 2) \
|
|
91
|
+
PROFILE (search, 1) \
|
|
92
|
+
PROFILE (solve, 0) \
|
|
93
|
+
PROFILE (stable, 2) \
|
|
94
|
+
PROFILE (sweep, 2) \
|
|
95
|
+
PROFILE (sweepbackbone, 3) \
|
|
96
|
+
PROFILE (sweepequivalences, 3) \
|
|
97
|
+
PROFILE (sweepflip, 4) \
|
|
98
|
+
PROFILE (sweepimplicant, 4) \
|
|
99
|
+
PROFILE (sweepsolve, 4) \
|
|
100
|
+
PROFILE (preprocess, 2) \
|
|
101
|
+
PROFILE (simplify, 1) \
|
|
102
|
+
PROFILE (subsume, 2) \
|
|
103
|
+
PROFILE (ternary, 2) \
|
|
104
|
+
PROFILE (transred, 3) \
|
|
105
|
+
PROFILE (unstable, 2) \
|
|
106
|
+
PROFILE (vivify, 2) \
|
|
107
|
+
PROFILE (walk, 2) \
|
|
108
|
+
PROFILE (walkpick, 3) \
|
|
109
|
+
PROFILE (walkbreak, 4) \
|
|
110
|
+
PROFILE (walkflip, 3) \
|
|
111
|
+
PROFILE (walkflipbroken, 4) \
|
|
112
|
+
PROFILE (walkflipWL, 4) \
|
|
113
|
+
PROFILE (warmup, 3)
|
|
114
|
+
|
|
115
|
+
/*------------------------------------------------------------------------*/
|
|
116
|
+
|
|
117
|
+
// See 'START' and 'STOP' in 'macros.hpp' too.
|
|
118
|
+
|
|
119
|
+
struct Profile {
|
|
120
|
+
|
|
121
|
+
bool active;
|
|
122
|
+
double value; // accumulated time
|
|
123
|
+
double started; // started time if active
|
|
124
|
+
const char *name; // name of the profiled function (or 'phase')
|
|
125
|
+
const int level; // allows to cheaply test if profiling is enabled
|
|
126
|
+
|
|
127
|
+
Profile (const char *n, int l)
|
|
128
|
+
: active (false), value (0), name (n), level (l) {}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
struct Profiles {
|
|
132
|
+
Internal *internal;
|
|
133
|
+
#define PROFILE(NAME, LEVEL) Profile NAME;
|
|
134
|
+
PROFILES
|
|
135
|
+
#undef PROFILE
|
|
136
|
+
Profiles (Internal *);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
} // namespace CaDiCaL
|
|
140
|
+
|
|
141
|
+
#define NON_QUIET_PROFILE_CODE(CODE) CODE
|
|
142
|
+
|
|
143
|
+
#else // !defined(QUIET)
|
|
144
|
+
|
|
145
|
+
#define NON_QUIET_PROFILE_CODE(CODE) /**/
|
|
146
|
+
|
|
147
|
+
#endif
|
|
148
|
+
|
|
149
|
+
/*------------------------------------------------------------------------*/
|
|
150
|
+
|
|
151
|
+
// Macros for Profiling support and checking and changing the mode.
|
|
152
|
+
|
|
153
|
+
#define START(P) \
|
|
154
|
+
do { \
|
|
155
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
156
|
+
if (internal->profiles.P.level <= internal->opts.profile) \
|
|
157
|
+
internal->start_profiling (internal->profiles.P, \
|
|
158
|
+
internal->time ());) \
|
|
159
|
+
} while (0)
|
|
160
|
+
|
|
161
|
+
#define STOP(P) \
|
|
162
|
+
do { \
|
|
163
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
164
|
+
if (internal->profiles.P.level <= internal->opts.profile) \
|
|
165
|
+
internal->stop_profiling (internal->profiles.P, \
|
|
166
|
+
internal->time ());) \
|
|
167
|
+
} while (0)
|
|
168
|
+
|
|
169
|
+
#define PROFILE_ACTIVE(P) \
|
|
170
|
+
((internal->profiles.P.level <= internal->opts.profile) && \
|
|
171
|
+
(internal->profiles.P.active))
|
|
172
|
+
|
|
173
|
+
/*------------------------------------------------------------------------*/
|
|
174
|
+
|
|
175
|
+
#define START_SIMPLIFIER(S, M) \
|
|
176
|
+
do { \
|
|
177
|
+
NON_QUIET_PROFILE_CODE (const double N = time (); \
|
|
178
|
+
const int L = internal->opts.profile;) \
|
|
179
|
+
if (!internal->preprocessing && !internal->lookingahead) { \
|
|
180
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
181
|
+
if (internal->stable && internal->profiles.stable.level <= L) \
|
|
182
|
+
internal->stop_profiling (internal->profiles.stable, N); \
|
|
183
|
+
if (!internal->stable && internal->profiles.unstable.level <= L) \
|
|
184
|
+
internal->stop_profiling (internal->profiles.unstable, N); \
|
|
185
|
+
if (internal->profiles.search.level <= L) \
|
|
186
|
+
internal->stop_profiling (internal->profiles.search, N);) \
|
|
187
|
+
reset_mode (SEARCH); \
|
|
188
|
+
} \
|
|
189
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
190
|
+
if (internal->profiles.simplify.level <= L) \
|
|
191
|
+
internal->start_profiling (internal->profiles.simplify, N); \
|
|
192
|
+
if (internal->profiles.S.level <= L) \
|
|
193
|
+
internal->start_profiling (internal->profiles.S, N);) \
|
|
194
|
+
set_mode (SIMPLIFY); \
|
|
195
|
+
set_mode (M); \
|
|
196
|
+
} while (0)
|
|
197
|
+
|
|
198
|
+
/*------------------------------------------------------------------------*/
|
|
199
|
+
|
|
200
|
+
#define STOP_SIMPLIFIER(S, M) \
|
|
201
|
+
do { \
|
|
202
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
203
|
+
const double N = internal->time (); \
|
|
204
|
+
const int L = internal->opts.profile; \
|
|
205
|
+
if (internal->profiles.S.level <= L) \
|
|
206
|
+
internal->stop_profiling (internal->profiles.S, N); \
|
|
207
|
+
if (internal->profiles.simplify.level <= L) \
|
|
208
|
+
internal->stop_profiling (internal->profiles.simplify, N);) \
|
|
209
|
+
reset_mode (M); \
|
|
210
|
+
reset_mode (SIMPLIFY); \
|
|
211
|
+
if (!internal->preprocessing && !internal->lookingahead) { \
|
|
212
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
213
|
+
if (internal->profiles.search.level <= L) \
|
|
214
|
+
internal->start_profiling (internal->profiles.search, N); \
|
|
215
|
+
if (internal->stable && internal->profiles.stable.level <= L) \
|
|
216
|
+
internal->start_profiling (internal->profiles.stable, N); \
|
|
217
|
+
if (!internal->stable && internal->profiles.unstable.level <= L) \
|
|
218
|
+
internal->start_profiling (internal->profiles.unstable, N);) \
|
|
219
|
+
set_mode (SEARCH); \
|
|
220
|
+
} \
|
|
221
|
+
} while (0)
|
|
222
|
+
|
|
223
|
+
/*------------------------------------------------------------------------*/
|
|
224
|
+
// Used in 'walk' before calling 'walk_round' within the CDCL loop.
|
|
225
|
+
|
|
226
|
+
#define START_INNER_WALK() \
|
|
227
|
+
do { \
|
|
228
|
+
require_mode (Mode::SEARCH); \
|
|
229
|
+
assert (!internal->preprocessing); \
|
|
230
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
231
|
+
const double N = internal->time (); \
|
|
232
|
+
const int L = internal->opts.profile; \
|
|
233
|
+
if (internal->stable && internal->profiles.stable.level <= L) \
|
|
234
|
+
internal->stop_profiling (internal->profiles.stable, N); \
|
|
235
|
+
if (!internal->stable && internal->profiles.unstable.level <= L) \
|
|
236
|
+
internal->stop_profiling (internal->profiles.unstable, N); \
|
|
237
|
+
if (internal->profiles.walk.level <= L) \
|
|
238
|
+
internal->start_profiling (internal->profiles.walk, N);) \
|
|
239
|
+
set_mode (Mode::WALK); \
|
|
240
|
+
} while (0)
|
|
241
|
+
|
|
242
|
+
/*------------------------------------------------------------------------*/
|
|
243
|
+
// Used in 'walk' after calling 'walk_round' within the CDCL loop.
|
|
244
|
+
|
|
245
|
+
#define STOP_INNER_WALK() \
|
|
246
|
+
do { \
|
|
247
|
+
require_mode (Mode::SEARCH); \
|
|
248
|
+
assert (!internal->preprocessing); \
|
|
249
|
+
reset_mode (WALK); \
|
|
250
|
+
NON_QUIET_PROFILE_CODE ( \
|
|
251
|
+
const double N = time (); const int L = internal->opts.profile; \
|
|
252
|
+
if (internal->profiles.walk.level <= L) \
|
|
253
|
+
internal->stop_profiling (internal->profiles.walk, N); \
|
|
254
|
+
if (internal->stable && internal->profiles.stable.level <= L) \
|
|
255
|
+
internal->start_profiling (internal->profiles.stable, N); \
|
|
256
|
+
if (!internal->stable && internal->profiles.unstable.level <= L) \
|
|
257
|
+
internal->start_profiling (internal->profiles.unstable, N); \
|
|
258
|
+
internal->profiles.walk.started = (N);) \
|
|
259
|
+
} while (0)
|
|
260
|
+
|
|
261
|
+
/*------------------------------------------------------------------------*/
|
|
262
|
+
// Used in 'local_search' before calling 'walk_round'.
|
|
263
|
+
|
|
264
|
+
#define START_OUTER_WALK() \
|
|
265
|
+
do { \
|
|
266
|
+
require_mode (Mode::SEARCH); \
|
|
267
|
+
assert (!internal->preprocessing); \
|
|
268
|
+
NON_QUIET_PROFILE_CODE (START (walk);) \
|
|
269
|
+
set_mode (Mode::WALK); \
|
|
270
|
+
} while (0)
|
|
271
|
+
|
|
272
|
+
/*------------------------------------------------------------------------*/
|
|
273
|
+
// Used in 'local_search' after calling 'walk_round'.
|
|
274
|
+
|
|
275
|
+
#define STOP_OUTER_WALK() \
|
|
276
|
+
do { \
|
|
277
|
+
require_mode (Mode::SEARCH); \
|
|
278
|
+
assert (!internal->preprocessing); \
|
|
279
|
+
reset_mode (WALK); \
|
|
280
|
+
NON_QUIET_PROFILE_CODE (STOP (walk);) \
|
|
281
|
+
} while (0)
|
|
282
|
+
|
|
283
|
+
#endif // ifndef _profiles_h_INCLUDED
|