46#define _sc_const const
50#define _sc_restrict restrict
54#define SC_CALC_VERSION(major,minor,patchlevel) \
55 (((major) * 1000 + (minor)) * 1000 + (patchlevel))
57#define SC_GCC_VERSION \
58 SC_CALC_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
61#define SC_GCC_VERSION \
62 SC_CALC_VERSION (0, 0, 0)
66#ifdef SC_ENABLE_MEMALIGN
68#ifdef SC_HAVE_ANY_MEMALIGN
69#undef SC_HAVE_ANY_MEMALIGN
72#ifdef SC_HAVE_ANY_MEMALIGN
73#ifndef SC_HAVE_POSIX_MEMALIGN
74#ifdef SC_HAVE_ALIGNED_ALLOC
83#ifndef SC_ENABLE_USE_COUNTERS
84#define SC_NOCOUNT_MALLOC
85#define SC_NOCOUNT_REFCOUNT
86#define SC_NOCOUNT_LOGINDENT
91#if defined _WIN32 || defined __CYGWIN__
96 #define SC_DLL_PUBLIC __attribute__ ((dllexport))
98 #define SC_DLL_PUBLIC __declspec(dllexport)
102 #define SC_DLL_PUBLIC __attribute__ ((dllimport))
104 #define SC_DLL_PUBLIC __declspec(dllimport)
109 #define SC_DLL_PUBLIC
113 #define SC_DLL_PUBLIC __attribute__ ((visibility ("default")))
115 #define SC_DLL_PUBLIC
121#ifndef __STDC_LIMIT_MACROS
123#define __STDC_LIMIT_MACROS
125#ifndef __STDC_CONSTANT_MACROS
127#define __STDC_CONSTANT_MACROS
133#define SC_NORETURN __declspec(noreturn)
134#define SC_PRINTF_LIKE(fmt_idx, first_arg)
135#define SC_PRINTF_FMT _Printf_format_string_
137#define SC_NORETURN __attribute__((noreturn))
138#define SC_PRINTF_LIKE(fmt_idx, first_arg) __attribute__((format(printf, fmt_idx, first_arg)))
148#error "mpi.h is included. Use --enable-mpi."
154#define _USE_MATH_DEFINES
157#define M_E 2.71828182845904523536
160#define M_LOG2E 1.44269504088896340736
163#define M_LOG10E 0.434294481903251827651
166#define M_LN2 0.693147180559945309417
169#define M_LN10 2.30258509299404568402
172#define M_PI 3.14159265358979323846
175#define M_PI_2 1.57079632679489661923
178#define M_PI_4 0.785398163397448309616
181#define M_1_PI 0.318309886183790671538
184#define M_2_PI 0.636619772367581343076
187#define M_2_SQRTPI 1.12837916709551257390
190#define M_SQRT2 1.41421356237309504880
193#define M_SQRT1_2 0.707106781186547524401
197#ifdef SC_HAVE_LIBGEN_H
203#ifdef SC_HAVE_STDINT_H
207#ifdef SC_HAVE_STDLIB_H
210#ifdef SC_HAVE_STRING_H
213#ifdef SC_HAVE_SYS_TIME_H
215#elif defined(_MSC_VER) && !defined(SC_HAVE_GETTIMEOFDAY)
216#define WIN32_LEAN_AND_MEAN
223int gettimeofday (
struct timeval*,
struct timezone*);
225#ifdef SC_HAVE_UNISTD_H
229typedef SSIZE_T ssize_t;
234#define SC_INIT_COMM_CLEAN
241#define SC_EXTERN_C_BEGIN extern "C" { void sc_extern_c_hack_1 (void)
242#define SC_EXTERN_C_END } extern "C" void sc_extern_c_hack_2 (void)
245#define SC_EXTERN_C_BEGIN void sc_extern_c_hack_1 (void)
246#define SC_EXTERN_C_END void sc_extern_c_hack_2 (void)
279#define SC_EPS 2.220446049250313e-16
282#define SC_1000_EPS (1000. * 2.220446049250313e-16)
287#define SC_NOOP() ((void) (0))
289 sc_abort_verbose (__FILE__, __LINE__, (s))
290#define SC_ABORT_NOT_REACHED() SC_ABORT ("Unreachable code")
291#define SC_CHECK_ABORT(q,s) \
292 ((q) ? (void) 0 : SC_ABORT (s))
293#define SC_CHECK_MPI(r) SC_CHECK_ABORT ((r) == sc_MPI_SUCCESS, "MPI error")
302void SC_ABORTF (SC_PRINTF_FMT
const char *fmt, ...)
303 SC_PRINTF_LIKE(1, 2);
304void SC_CHECK_ABORTF (
int success, SC_PRINTF_FMT const
char *fmt, ...)
305 SC_PRINTF_LIKE(2, 3);
307#define SC_ABORTF(fmt,...) \
308 sc_abort_verbosef (__FILE__, __LINE__, (fmt), __VA_ARGS__)
309#define SC_CHECK_ABORTF(q,fmt,...) \
310 ((q) ? (void) 0 : SC_ABORTF (fmt, __VA_ARGS__))
312#define SC_ABORT1(fmt,a) \
313 sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a))
314#define SC_ABORT2(fmt,a,b) \
315 sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b))
316#define SC_ABORT3(fmt,a,b,c) \
317 sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c))
318#define SC_ABORT4(fmt,a,b,c,d) \
319 sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d))
320#define SC_ABORT5(fmt,a,b,c,d,e) \
321 sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d), (e))
322#define SC_ABORT6(fmt,a,b,c,d,e,f) \
323 sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d), (e), (f))
324#define SC_CHECK_ABORT1(q,fmt,a) \
325 ((q) ? (void) 0 : SC_ABORT1 ((fmt), (a)))
326#define SC_CHECK_ABORT2(q,fmt,a,b) \
327 ((q) ? (void) 0 : SC_ABORT2 ((fmt), (a), (b)))
328#define SC_CHECK_ABORT3(q,fmt,a,b,c) \
329 ((q) ? (void) 0 : SC_ABORT3 ((fmt), (a), (b), (c)))
330#define SC_CHECK_ABORT4(q,fmt,a,b,c,d) \
331 ((q) ? (void) 0 : SC_ABORT4 ((fmt), (a), (b), (c), (d)))
332#define SC_CHECK_ABORT5(q,fmt,a,b,c,d,e) \
333 ((q) ? (void) 0 : SC_ABORT5 ((fmt), (a), (b), (c), (d), (e)))
334#define SC_CHECK_ABORT6(q,fmt,a,b,c,d,e,f) \
335 ((q) ? (void) 0 : SC_ABORT6 ((fmt), (a), (b), (c), (d), (e), (f)))
339#ifdef SC_ENABLE_DEBUG
340#define SC_ASSERT(c) SC_CHECK_ABORT ((c), "Assertion '" #c "'")
341#define SC_EXECUTE_ASSERT_FALSE(expression) \
342 do { int _sc_i = (int) (expression); \
343 SC_CHECK_ABORT (!_sc_i, "Expected false: '" #expression "'"); \
345#define SC_EXECUTE_ASSERT_TRUE(expression) \
346 do { int _sc_i = (int) (expression); \
347 SC_CHECK_ABORT (_sc_i, "Expected true: '" #expression "'"); \
350#define SC_ASSERT(c) SC_NOOP ()
351#define SC_EXECUTE_ASSERT_FALSE(expression) \
352 do { (void) (expression); } while (0)
353#define SC_EXECUTE_ASSERT_TRUE(expression) \
354 do { (void) (expression); } while (0)
359#define SC_ALLOC(t,n) (t *) sc_malloc (sc_package_id, (n) * sizeof(t))
360#define SC_ALLOC_ZERO(t,n) (t *) sc_calloc (sc_package_id, \
361 (size_t) (n), sizeof(t))
362#define SC_REALLOC(p,t,n) (t *) sc_realloc (sc_package_id, \
363 (p), (n) * sizeof(t))
364#define SC_STRDUP(s) sc_strdup (sc_package_id, (s))
365#define SC_FREE(p) sc_free (sc_package_id, (p))
370#define SC_ALIGN_UP(x,n) ( ((n) <= 0) ? (x) : ((x) + (n) - 1) / (n) * (n) )
373#define SC_ARG_ALIGN(p,t,n) __alignx((n), (p))
375#define SC_ARG_ALIGN(p,t,n) __assume_aligned((p), (n))
376#elif defined (__clang__)
377#define SC_ARG_ALIGN(p,t,n) SC_NOOP ()
378#elif defined (__GNUC__) || defined (__GNUG__)
380#if SC_GCC_VERSION >= SC_CALC_VERSION (4, 7, 0)
381#define SC_ARG_ALIGN(p,t,n) do { \
382 (p) = (t) __builtin_assume_aligned((void *) (p), (n)); \
385#define SC_ARG_ALIGN(p,t,n) SC_NOOP ()
389#define SC_ARG_ALIGN(p,t,n) SC_NOOP ()
392#if (defined __GNUC__) || (defined __PGI) || (defined __IBMC__)
393#define SC_ATTR_ALIGN(n) __attribute__ ((aligned(n)))
395#define SC_ATTR_ALIGN(n)
402#define SC_BZERO(p,n) ((void) memset ((p), 0, (n) * sizeof (*(p))))
406#define SC_MIN(a,b) (((a) < (b)) ? (a) : (b))
407#define SC_MAX(a,b) (((a) > (b)) ? (a) : (b))
408#define SC_SQR(a) ((a) * (a))
412#define SC_LOG2_8(x) (sc_log2_lookup_table[(x)])
413#define SC_LOG2_16(x) (((x) > 0xff) ? \
414 (SC_LOG2_8 ((x) >> 8) + 8) : SC_LOG2_8 (x))
415#define SC_LOG2_32(x) (((x) > 0xffff) ? \
416 (SC_LOG2_16 ((x) >> 16)) + 16 : SC_LOG2_16 (x))
417#define SC_LOG2_64(x) (((x) > 0xffffffffLL) ? \
418 (SC_LOG2_32 ((x) >> 32)) + 32 : SC_LOG2_32 (x))
419#define SC_ROUNDUP2_32(x) \
420 (((x) <= 0) ? 0 : (1 << (SC_LOG2_32 ((x) - 1) + 1)))
421#define SC_ROUNDUP2_64(x) \
422 (((x) <= 0) ? 0 : (1LL << (SC_LOG2_64 ((x) - 1LL) + 1)))
426#define SC_LC_GLOBAL 1
427#define SC_LC_NORMAL 2
457#define SC_LP_DEFAULT (-1)
458#define SC_LP_ALWAYS 0
461#define SC_LP_VERBOSE 3
463#define SC_LP_STATISTICS 5
464#define SC_LP_PRODUCTION 6
465#define SC_LP_ESSENTIAL 7
467#define SC_LP_SILENT 9
471#ifdef SC_LOG_PRIORITY
472#define SC_LP_THRESHOLD SC_LOG_PRIORITY
473#define SC_LP_APPLICATION SC_LOG_PRIORITY
475#ifdef SC_ENABLE_DEBUG
476#define SC_LP_THRESHOLD SC_LP_TRACE
477#define SC_LP_APPLICATION SC_LP_DEBUG
480#define SC_LP_THRESHOLD SC_LP_INFO
482#define SC_LP_APPLICATION SC_LP_STATISTICS
487#define SC_GEN_LOG(package,category,priority,s) \
488 ((priority) < SC_LP_THRESHOLD ? (void) 0 : \
489 sc_log (__FILE__, __LINE__, (package), (category), (priority), (s)))
490#define SC_GLOBAL_LOG(p,s) SC_GEN_LOG (sc_package_id, SC_LC_GLOBAL, (p), (s))
491#define SC_LOG(p,s) SC_GEN_LOG (sc_package_id, SC_LC_NORMAL, (p), (s))
492void SC_GEN_LOGF (
int package,
int category,
int priority,
493 SC_PRINTF_FMT
const char *fmt, ...)
494 SC_PRINTF_LIKE(4, 5);
495void SC_GLOBAL_LOGF (
int priority, SC_PRINTF_FMT const
char *fmt, ...)
496 SC_PRINTF_LIKE(2, 3);
497void SC_LOGF (
int priority, SC_PRINTF_FMT const
char *fmt, ...)
498 SC_PRINTF_LIKE(2, 3);
500#define SC_GEN_LOGF(package,category,priority,fmt,...) \
501 ((priority) < SC_LP_THRESHOLD ? (void) 0 : \
502 sc_logf (__FILE__, __LINE__, (package), (category), (priority), \
504#define SC_GLOBAL_LOGF(p,fmt,...) \
505 SC_GEN_LOGF (sc_package_id, SC_LC_GLOBAL, (p), (fmt), __VA_ARGS__)
506#define SC_LOGF(p,fmt,...) \
507 SC_GEN_LOGF (sc_package_id, SC_LC_NORMAL, (p), (fmt), __VA_ARGS__)
511#define SC_GLOBAL_TRACE(s) SC_GLOBAL_LOG (SC_LP_TRACE, (s))
512#define SC_GLOBAL_LDEBUG(s) SC_GLOBAL_LOG (SC_LP_DEBUG, (s))
513#define SC_GLOBAL_VERBOSE(s) SC_GLOBAL_LOG (SC_LP_VERBOSE, (s))
514#define SC_GLOBAL_INFO(s) SC_GLOBAL_LOG (SC_LP_INFO, (s))
515#define SC_GLOBAL_STATISTICS(s) SC_GLOBAL_LOG (SC_LP_STATISTICS, (s))
516#define SC_GLOBAL_PRODUCTION(s) SC_GLOBAL_LOG (SC_LP_PRODUCTION, (s))
517#define SC_GLOBAL_ESSENTIAL(s) SC_GLOBAL_LOG (SC_LP_ESSENTIAL, (s))
518#define SC_GLOBAL_LERROR(s) SC_GLOBAL_LOG (SC_LP_ERROR, (s))
519void SC_GLOBAL_TRACEF (SC_PRINTF_FMT
const char *fmt, ...)
520 SC_PRINTF_LIKE(1, 2);
521void SC_GLOBAL_LDEBUGF (SC_PRINTF_FMT const
char *fmt, ...)
522 SC_PRINTF_LIKE(1, 2);
523void SC_GLOBAL_VERBOSEF (SC_PRINTF_FMT const
char *fmt, ...)
524 SC_PRINTF_LIKE(1, 2);
525void SC_GLOBAL_INFOF (SC_PRINTF_FMT const
char *fmt, ...)
526 SC_PRINTF_LIKE(1, 2);
527void SC_GLOBAL_STATISTICSF (SC_PRINTF_FMT const
char *fmt, ...)
528 SC_PRINTF_LIKE(1, 2);
529void SC_GLOBAL_PRODUCTIONF (const
char *fmt, ...)
530 SC_PRINTF_LIKE(1, 2);
531void SC_GLOBAL_ESSENTIALF (SC_PRINTF_FMT const
char *fmt, ...)
532 SC_PRINTF_LIKE(1, 2);
533void SC_GLOBAL_LERRORF (SC_PRINTF_FMT const
char *fmt, ...)
534 SC_PRINTF_LIKE(1, 2);
536#define SC_GLOBAL_TRACEF(fmt,...) \
537 SC_GLOBAL_LOGF (SC_LP_TRACE, (fmt), __VA_ARGS__)
538#define SC_GLOBAL_LDEBUGF(fmt,...) \
539 SC_GLOBAL_LOGF (SC_LP_DEBUG, (fmt), __VA_ARGS__)
540#define SC_GLOBAL_VERBOSEF(fmt,...) \
541 SC_GLOBAL_LOGF (SC_LP_VERBOSE, (fmt), __VA_ARGS__)
542#define SC_GLOBAL_INFOF(fmt,...) \
543 SC_GLOBAL_LOGF (SC_LP_INFO, (fmt), __VA_ARGS__)
544#define SC_GLOBAL_STATISTICSF(fmt,...) \
545 SC_GLOBAL_LOGF (SC_LP_STATISTICS, (fmt), __VA_ARGS__)
546#define SC_GLOBAL_PRODUCTIONF(fmt,...) \
547 SC_GLOBAL_LOGF (SC_LP_PRODUCTION, (fmt), __VA_ARGS__)
548#define SC_GLOBAL_ESSENTIALF(fmt,...) \
549 SC_GLOBAL_LOGF (SC_LP_ESSENTIAL, (fmt), __VA_ARGS__)
550#define SC_GLOBAL_LERRORF(fmt,...) \
551 SC_GLOBAL_LOGF (SC_LP_ERROR, (fmt), __VA_ARGS__)
555#define SC_TRACE(s) SC_LOG (SC_LP_TRACE, (s))
556#define SC_LDEBUG(s) SC_LOG (SC_LP_DEBUG, (s))
557#define SC_VERBOSE(s) SC_LOG (SC_LP_VERBOSE, (s))
558#define SC_INFO(s) SC_LOG (SC_LP_INFO, (s))
559#define SC_STATISTICS(s) SC_LOG (SC_LP_STATISTICS, (s))
560#define SC_PRODUCTION(s) SC_LOG (SC_LP_PRODUCTION, (s))
561#define SC_ESSENTIAL(s) SC_LOG (SC_LP_ESSENTIAL, (s))
562#define SC_LERROR(s) SC_LOG (SC_LP_ERROR, (s))
563void SC_TRACEF (SC_PRINTF_FMT
const char *fmt, ...)
564 SC_PRINTF_LIKE(1, 2);
565void SC_LDEBUGF (SC_PRINTF_FMT const
char *fmt, ...)
566 SC_PRINTF_LIKE(1, 2);
567void SC_VERBOSEF (SC_PRINTF_FMT const
char *fmt, ...)
568 SC_PRINTF_LIKE(1, 2);
569void SC_INFOF (SC_PRINTF_FMT const
char *fmt, ...)
570 SC_PRINTF_LIKE(1, 2);
571void SC_STATISTICSF (SC_PRINTF_FMT const
char *fmt, ...)
572 SC_PRINTF_LIKE(1, 2);
573void SC_PRODUCTIONF (SC_PRINTF_FMT const
char *fmt, ...)
574 SC_PRINTF_LIKE(1, 2);
575void SC_ESSENTIALF (SC_PRINTF_FMT const
char *fmt, ...)
576 SC_PRINTF_LIKE(1, 2);
577void SC_LERRORF (SC_PRINTF_FMT const
char *fmt, ...)
578 SC_PRINTF_LIKE(1, 2);
580#define SC_TRACEF(fmt,...) \
581 SC_LOGF (SC_LP_TRACE, (fmt), __VA_ARGS__)
582#define SC_LDEBUGF(fmt,...) \
583 SC_LOGF (SC_LP_DEBUG, (fmt), __VA_ARGS__)
584#define SC_VERBOSEF(fmt,...) \
585 SC_LOGF (SC_LP_VERBOSE, (fmt), __VA_ARGS__)
586#define SC_INFOF(fmt,...) \
587 SC_LOGF (SC_LP_INFO, (fmt), __VA_ARGS__)
588#define SC_STATISTICSF(fmt,...) \
589 SC_LOGF (SC_LP_STATISTICS, (fmt), __VA_ARGS__)
590#define SC_PRODUCTIONF(fmt,...) \
591 SC_LOGF (SC_LP_PRODUCTION, (fmt), __VA_ARGS__)
592#define SC_ESSENTIALF(fmt,...) \
593 SC_LOGF (SC_LP_ESSENTIAL, (fmt), __VA_ARGS__)
594#define SC_LERRORF(fmt,...) \
595 SC_LOGF (SC_LP_ERROR, (fmt), __VA_ARGS__)
600#define _SC_TOSTRING(x) #x
604#define SC_TOSTRING(x) _SC_TOSTRING(x)
608 const char *filename,
int lineno,
609 int package,
int category,
610 int priority,
const char *msg);
617void *sc_malloc (
int package,
size_t size);
618void *sc_calloc (
int package,
size_t nmemb,
size_t size);
619void *sc_realloc (
int package,
void *ptr,
size_t size);
620char *sc_strdup (
int package,
const char *s);
621void sc_free (
int package,
void *ptr);
622int sc_memory_status (
int package);
623void sc_memory_check (
int package);
630int sc_int_compare (
const void *v1,
const void *v2);
631int sc_int8_compare (
const void *v1,
const void *v2);
632int sc_int16_compare (
const void *v1,
const void *v2);
633int sc_int32_compare (
const void *v1,
const void *v2);
634int sc_int64_compare (
const void *v1,
const void *v2);
635int sc_double_compare (
const void *v1,
const void *v2);
676void sc_log (
const char *filename,
int lineno,
677 int package,
int category,
int priority,
689void sc_logf (
const char *filename,
int lineno,
690 int package,
int category,
int priority,
691 SC_PRINTF_FMT
const char *fmt, ...)
692 SC_PRINTF_LIKE(6, 7);
704void sc_logv (const
char *filename,
int lineno,
705 int package,
int category,
int priority,
706 const
char *fmt, va_list ap);
732 SC_PRINTF_FMT const
char *fmt, ...)
733 SC_PRINTF_LIKE(3, 4);
738 const
char *fmt, va_list ap);
751 const
char *name, const
char *full);
829 int catch_signals,
int print_backtrace,
903 SC_PRINTF_FMT const
char *format, ...)
904 SC_PRINTF_LIKE(3, 4);
942int sc_version_point (
void);
int sc_have_json(void)
Return whether we have found a JSON library at configure time.
void sc_set_log_defaults(FILE *log_stream, sc_log_handler_t log_handler, int log_threshold)
Controls the default SC log behavior.
int sc_atoi(const char *nptr)
Safe version of the standard library atoi (3) function.
void sc_log_indent_pop(void)
Remove one space from the start of a sc's default log format.
SC_DLL_PUBLIC FILE * sc_trace_file
Optional trace file for logging (see sc_init).
void sc_package_unregister(int package_id)
Unregister a software package with SC.
int sc_have_zlib(void)
Return a boolean indicating whether zlib has been configured.
SC_NORETURN void SC_NORETURN void sc_abort_verbosev(const char *filename, int lineno, const char *fmt, va_list ap)
Print a message to stderr and then call sc_abort ().
void sc_finalize(void)
Unregisters all packages, runs the memory check, removes the signal handlers and resets sc_identifier...
int sc_package_is_registered(int package_id)
Query whether an identifier matches a registered package.
int sc_is_littleendian(void)
Perform a runtime check for the integer endian convention.
int sc_memory_check_noerr(int package)
Return error count or zero if all is ok.
void sc_package_set_verbosity(int package_id, int log_priority)
Set the logging verbosity of a registered package.
void(* sc_abort_handler_t)(void)
Type of the abort handler function.
Definition sc.h:613
int sc_finalize_noabort(void)
Unregisters all packages, runs the memory check, removes the signal handlers and resets sc_identifier...
#define SC_NORETURN
Platform-specific noreturn and printf format string checks
Definition sc.h:137
SC_NORETURN void sc_abort(void)
Print a stack trace, call the abort handler and then call abort ().
void sc_package_unlock(int package_id)
Release a pthread mutex lock.
void sc_snprintf(char *str, size_t size, SC_PRINTF_FMT const char *format,...) SC_PRINTF_LIKE(3
Wrap the system snprintf function, allowing for truncation.
void sc_log_indent_pop_count(int package, int count)
Remove spaces from the start of a package's default log format.
void sc_log(const char *filename, int lineno, int package, int category, int priority, const char *msg)
The central log function to be called by all packages.
void sc_init(sc_MPI_Comm mpicomm, int catch_signals, int print_backtrace, sc_log_handler_t log_handler, int log_threshold)
Sets the global program identifier (e.g.
void void sc_logv(const char *filename, int lineno, int package, int category, int priority, const char *fmt, va_list ap)
The vprintf-style log function to be called by all packages.
void sc_set_abort_handler(sc_abort_handler_t abort_handler)
Set the default SC abort behavior.
void sc_logf(const char *filename, int lineno, int package, int category, int priority, SC_PRINTF_FMT const char *fmt,...) SC_PRINTF_LIKE(6
The printf-style log function to be called by all packages.
int sc_get_package_id(void)
Query SC's own package identity.
void sc_package_lock(int package_id)
Acquire a pthread mutex lock.
int sc_is_initialized(void)
Return whether SC has been initialized or not.
SC_DLL_PUBLIC int sc_package_id
libsc allows for multiple packages to use their own log priorities etc.
void sc_log_indent_push_count(int package, int count)
Add spaces to the start of a package's default log format.
int sc_version_major(void)
Return the major version of libsc.
SC_DLL_PUBLIC int sc_trace_prio
Optional minimum log priority for messages that go into the trace file.
const int sc_log2_lookup_table[256]
Lookup table to provide fast base-2 logarithm of integers.
int sc_package_register(sc_log_handler_t log_handler, int log_threshold, const char *name, const char *full)
Register a software package with SC.
void sc_strcopy(char *dest, size_t size, const char *src)
Provide a string copy function.
SC_NORETURN void sc_abort_verbosef(const char *filename, int lineno, SC_PRINTF_FMT const char *fmt,...) SC_PRINTF_LIKE(3
Print a message to stderr and then call sc_abort ().
void sc_sleep(unsigned milliseconds)
Portable function to sleep a prescribed amount of milliseconds.
void const char * sc_version(void)
Return the full version of libsc.
void sc_package_set_abort_alloc_mismatch(int package_id, int set_abort)
Set the unregister behavior of sc_package_unregister().
void sc_log_indent_push(void)
Add one space to the start of sc's default log format.
void(* sc_log_handler_t)(FILE *log_stream, const char *filename, int lineno, int package, int category, int priority, const char *msg)
Type of the log handler function.
Definition sc.h:607
int sc_version_minor(void)
Return the minor version of libsc.
SC_NORETURN void sc_abort_verbose(const char *filename, int lineno, const char *msg)
Print a message to stderr and then call sc_abort ().
int sc_is_root(void)
Identify the root process.
SC_NORETURN void sc_abort_collective(const char *msg)
Collective abort where only root prints a message.
long sc_atol(const char *nptr)
Safe version of the standard library atol (3) function.
void sc_package_print_summary(int log_priority)
Print a summary of all packages registered with SC.
Provide a consistent MPI interface with and without MPI configured.
sc3_MPI_Comm_t sc_MPI_Comm
Emulate an MPI communicator.
Definition sc_mpi.h:460