3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-05 15:33:59 +00:00

parallelizing ccc

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-04-23 14:46:46 -07:00
parent 07fe45e923
commit d052155f6e
8 changed files with 284 additions and 281 deletions

View file

@ -17,6 +17,9 @@ Revision History:
--*/
#ifdef _WINDOWS
#include "windows.h"
#endif
#include"util.h"
static unsigned g_verbosity_level = 0;
@ -35,6 +38,19 @@ void set_verbose_stream(std::ostream& str) {
g_verbose_stream = &str;
}
static int g_thread_id = 0;
static bool g_is_threaded = false;
bool is_threaded() {
if (g_is_threaded) return true;
#ifdef _WINDOWS
int thid = GetCurrentThreadId();
g_is_threaded = g_thread_id != thid && g_thread_id != 0;
g_thread_id = thid;
#endif
return g_is_threaded;
}
std::ostream& verbose_stream() {
return *g_verbose_stream;
}

View file

@ -24,6 +24,7 @@ Revision History:
#include<iostream>
#include<climits>
#include<limits>
#include"z3_omp.h"
#ifndef SIZE_MAX
#define SIZE_MAX std::numeric_limits<std::size_t>::max()
@ -182,16 +183,26 @@ void set_verbosity_level(unsigned lvl);
unsigned get_verbosity_level();
std::ostream& verbose_stream();
void set_verbose_stream(std::ostream& str);
bool is_threaded();
#define IF_VERBOSE(LVL, CODE) { if (get_verbosity_level() >= LVL) { CODE } } ((void) 0)
#ifdef _EXTERNAL_RELEASE
#define IF_IVERBOSE(LVL, CODE) ((void) 0)
#else
#define IF_IVERBOSE(LVL, CODE) { if (get_verbosity_level() >= LVL) { CODE } } ((void) 0)
#endif
#define IF_VERBOSE(LVL, CODE) { \
if (get_verbosity_level() >= LVL) { \
if (is_threaded()) { \
LOCK_CODE(CODE); \
} \
else { \
CODE; \
} \
} } ((void) 0)
#define LOCK_CODE(CODE) \
{ \
__pragma(omp critical (verbose_lock)) \
{ \
CODE; \
} \
}
template<typename T>
struct default_eq {