p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sc.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6 
7  The SC Library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  The SC Library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with the SC Library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301, USA.
21 */
22 
33 #ifndef SC_H
34 #define SC_H
35 
36 /* include the sc_config header first */
37 
38 #include <sc_config.h>
39 #ifndef _sc_const
40 #define _sc_const const
41 #endif
42 #ifndef _sc_restrict
43 #define _sc_restrict restrict
44 #endif
45 
46 /* use this in case mpi.h includes stdint.h */
47 
48 #ifndef __STDC_LIMIT_MACROS
49 #define __STDC_LIMIT_MACROS
50 #endif
51 
52 /* include MPI before stdio.h */
53 
54 #ifdef SC_ENABLE_MPI
55 #include <mpi.h>
56 #else
57 #ifdef MPI_SUCCESS
58 #error "mpi.h is included. Use --enable-mpi."
59 #endif
60 #endif
61 
62 /* include system headers */
63 
64 #include <math.h>
65 #include <ctype.h>
66 #include <float.h>
67 #include <libgen.h>
68 #include <limits.h>
69 #include <stdarg.h>
70 #include <stddef.h>
71 #include <stdint.h>
72 #include <stdio.h>
73 #include <stdlib.h>
74 #include <string.h>
75 #include <unistd.h>
76 
77 /* provide extern C defines */
78 
79 /* the hacks below enable semicolons after the SC_EXTERN_C_ macros */
80 #ifdef __cplusplus
81 #define SC_EXTERN_C_BEGIN extern "C" { void sc_extern_c_hack_1 (void)
82 #define SC_EXTERN_C_END } void sc_extern_c_hack_2 (void)
83 #else
84 #define SC_EXTERN_C_BEGIN void sc_extern_c_hack_3 (void)
85 #define SC_EXTERN_C_END void sc_extern_c_hack_4 (void)
86 #endif
87 
88 /* this libsc header is always included */
89 #include <sc_mpi.h>
90 
91 SC_EXTERN_C_BEGIN;
92 
93 /* extern variables */
94 
95 extern const int sc_log2_lookup_table[256];
96 extern int sc_package_id;
97 
98 /* control a trace file by environment variables (see sc_init) */
99 extern FILE *sc_trace_file;
100 extern int sc_trace_prio;
101 
102 /* define math constants if necessary */
103 #ifndef M_E
104 #define M_E 2.7182818284590452354 /* e */
105 #endif
106 #ifndef M_LOG2E
107 #define M_LOG2E 1.4426950408889634074 /* log_2 e */
108 #endif
109 #ifndef M_LOG10E
110 #define M_LOG10E 0.43429448190325182765 /* log_10 e */
111 #endif
112 #ifndef M_LN2
113 #define M_LN2 0.69314718055994530942 /* log_e 2 */
114 #endif
115 #ifndef M_LN10
116 #define M_LN10 2.30258509299404568402 /* log_e 10 */
117 #endif
118 #ifndef M_PI
119 #define M_PI 3.14159265358979323846 /* pi */
120 #endif
121 #ifndef M_PI_2
122 #define M_PI_2 1.57079632679489661923 /* pi/2 */
123 #endif
124 #ifndef M_PI_4
125 #define M_PI_4 0.78539816339744830962 /* pi/4 */
126 #endif
127 #ifndef M_1_PI
128 #define M_1_PI 0.31830988618379067154 /* 1/pi */
129 #endif
130 #ifndef M_2_PI
131 #define M_2_PI 0.63661977236758134308 /* 2/pi */
132 #endif
133 #ifndef M_2_SQRTPI
134 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
135 #endif
136 #ifndef M_SQRT2
137 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
138 #endif
139 #ifndef M_SQRT1_2
140 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
141 #endif
142 
143 #define SC_EPS 2.220446049250313e-16
144 #define SC_1000_EPS (1000. * 2.220446049250313e-16)
145 
146 #if 0
147 /*@ignore@*/
148 #define index DONT_USE_NAME_CONFLICT_1 ---
149 #define rindex DONT_USE_NAME_CONFLICT_2 ---
150 #define link DONT_USE_NAME_CONFLICT_3 ---
151 #define NO_DEFINE_DONT_USE_CONFLICT SPLINT_IS_STUPID_ALSO
152 /*@end@*/
153 #endif /* 0 */
154 
155 /* check macros, always enabled */
156 
157 #define SC_NOOP() ((void) (0))
158 #define SC_ABORT(s) \
159  sc_abort_verbose (__FILE__, __LINE__, (s))
160 #define SC_ABORT_NOT_REACHED() SC_ABORT ("Unreachable code")
161 #define SC_CHECK_ABORT(q,s) \
162  ((q) ? (void) 0 : SC_ABORT (s))
163 #define SC_CHECK_MPI(r) SC_CHECK_ABORT ((r) == sc_MPI_SUCCESS, "MPI error")
164 #define SC_CHECK_ZLIB(r) SC_CHECK_ABORT ((r) == Z_OK, "zlib error")
165 
166 /*
167  * C++98 does not allow variadic macros
168  * 1. Declare a default variadic function for C and C++
169  * 2. Use macros in C instead of the function
170  * This loses __FILE__ and __LINE__ in the C++ ..F log functions
171  */
172 void SC_ABORTF (const char *fmt, ...)
173  __attribute__ ((format (printf, 1, 2)))
174  __attribute__ ((noreturn));
175 void SC_CHECK_ABORTF (int success, const char *fmt, ...)
176  __attribute__ ((format (printf, 2, 3)));
177 #ifndef __cplusplus
178 #define SC_ABORTF(fmt,...) \
179  sc_abort_verbosef (__FILE__, __LINE__, (fmt), __VA_ARGS__)
180 #define SC_CHECK_ABORTF(q,fmt,...) \
181  ((q) ? (void) 0 : SC_ABORTF (fmt, __VA_ARGS__))
182 #endif
183 #define SC_ABORT1(fmt,a) \
184  sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a))
185 #define SC_ABORT2(fmt,a,b) \
186  sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b))
187 #define SC_ABORT3(fmt,a,b,c) \
188  sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c))
189 #define SC_ABORT4(fmt,a,b,c,d) \
190  sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d))
191 #define SC_ABORT5(fmt,a,b,c,d,e) \
192  sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d), (e))
193 #define SC_ABORT6(fmt,a,b,c,d,e,f) \
194  sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d), (e), (f))
195 #define SC_CHECK_ABORT1(q,fmt,a) \
196  ((q) ? (void) 0 : SC_ABORT1 ((fmt), (a)))
197 #define SC_CHECK_ABORT2(q,fmt,a,b) \
198  ((q) ? (void) 0 : SC_ABORT2 ((fmt), (a), (b)))
199 #define SC_CHECK_ABORT3(q,fmt,a,b,c) \
200  ((q) ? (void) 0 : SC_ABORT3 ((fmt), (a), (b), (c)))
201 #define SC_CHECK_ABORT4(q,fmt,a,b,c,d) \
202  ((q) ? (void) 0 : SC_ABORT4 ((fmt), (a), (b), (c), (d)))
203 #define SC_CHECK_ABORT5(q,fmt,a,b,c,d,e) \
204  ((q) ? (void) 0 : SC_ABORT5 ((fmt), (a), (b), (c), (d), (e)))
205 #define SC_CHECK_ABORT6(q,fmt,a,b,c,d,e,f) \
206  ((q) ? (void) 0 : SC_ABORT6 ((fmt), (a), (b), (c), (d), (e), (f)))
207 
208 /* assertions, only enabled in debug mode */
209 
210 #ifdef SC_DEBUG
211 #define SC_ASSERT(c) SC_CHECK_ABORT ((c), "Assertion '" #c "'")
212 #define SC_EXECUTE_ASSERT_FALSE(expression) \
213  do { int _sc_i = (int) (expression); \
214  SC_CHECK_ABORT (!_sc_i, "Expected false: '" #expression "'"); \
215  } while (0)
216 #define SC_EXECUTE_ASSERT_TRUE(expression) \
217  do { int _sc_i = (int) (expression); \
218  SC_CHECK_ABORT (_sc_i, "Expected true: '" #expression "'"); \
219  } while (0)
220 #else
221 #define SC_ASSERT(c) SC_NOOP ()
222 #define SC_EXECUTE_ASSERT_FALSE(expression) \
223  do { (void) (expression); } while (0)
224 #define SC_EXECUTE_ASSERT_TRUE(expression) \
225  do { (void) (expression); } while (0)
226 #endif
227 
228 /* macros for memory allocation, will abort if out of memory */
229 
230 #define SC_ALLOC(t,n) (t *) sc_malloc (sc_package_id, (n) * sizeof(t))
231 #define SC_ALLOC_ZERO(t,n) (t *) sc_calloc (sc_package_id, \
232  (size_t) (n), sizeof(t))
233 #define SC_REALLOC(p,t,n) (t *) sc_realloc (sc_package_id, \
234  (p), (n) * sizeof(t))
235 #define SC_STRDUP(s) sc_strdup (sc_package_id, (s))
236 #define SC_FREE(p) sc_free (sc_package_id, (p))
237 
242 #define SC_BZERO(p,n) ((void) memset ((p), 0, (n) * sizeof (*(p))))
243 
244 /* min, max and square helper macros */
245 
246 #define SC_MIN(a,b) (((a) < (b)) ? (a) : (b))
247 #define SC_MAX(a,b) (((a) > (b)) ? (a) : (b))
248 #define SC_SQR(a) ((a) * (a))
249 
250 /* hopefully fast binary logarithms and binary round up */
251 
252 #define SC_LOG2_8(x) (sc_log2_lookup_table[(x)])
253 #define SC_LOG2_16(x) (((x) > 0xff) ? \
254  (SC_LOG2_8 ((x) >> 8) + 8) : SC_LOG2_8 (x))
255 #define SC_LOG2_32(x) (((x) > 0xffff) ? \
256  (SC_LOG2_16 ((x) >> 16)) + 16 : SC_LOG2_16 (x))
257 #define SC_LOG2_64(x) (((x) > 0xffffffffLL) ? \
258  (SC_LOG2_32 ((x) >> 32)) + 32 : SC_LOG2_32 (x))
259 #define SC_ROUNDUP2_32(x) \
260  (((x) <= 0) ? 0 : (1 << (SC_LOG2_32 ((x) - 1) + 1)))
261 #define SC_ROUNDUP2_64(x) \
262  (((x) <= 0) ? 0 : (1LL << (SC_LOG2_64 ((x) - 1LL) + 1)))
263 
264 /* log categories */
265 
266 #define SC_LC_GLOBAL 1
267 #define SC_LC_NORMAL 2
281 
282 /* log priorities */
283 #define SC_LP_DEFAULT (-1)
284 #define SC_LP_ALWAYS 0
285 #define SC_LP_TRACE 1
286 #define SC_LP_DEBUG 2
287 #define SC_LP_VERBOSE 3
288 #define SC_LP_INFO 4
289 #define SC_LP_STATISTICS 5
290 #define SC_LP_PRODUCTION 6
291 #define SC_LP_ESSENTIAL 7
292 #define SC_LP_ERROR 8
293 #define SC_LP_SILENT 9
295 
296 
299 #ifdef SC_LOG_PRIORITY
300 #define SC_LP_THRESHOLD SC_LOG_PRIORITY
301 #else
302 #ifdef SC_DEBUG
303 #define SC_LP_THRESHOLD SC_LP_TRACE
304 #else
305 #define SC_LP_THRESHOLD SC_LP_INFO
306 #endif
307 #endif
308 
309 /* generic log macros */
310 #define SC_GEN_LOG(package,category,priority,s) \
311  ((priority) < SC_LP_THRESHOLD ? (void) 0 : \
312  sc_log (__FILE__, __LINE__, (package), (category), (priority), (s)))
313 #define SC_GLOBAL_LOG(p,s) SC_GEN_LOG (sc_package_id, SC_LC_GLOBAL, (p), (s))
314 #define SC_LOG(p,s) SC_GEN_LOG (sc_package_id, SC_LC_NORMAL, (p), (s))
315 void SC_GEN_LOGF (int package, int category, int priority,
316  const char *fmt, ...)
317  __attribute__ ((format (printf, 4, 5)));
318 void SC_GLOBAL_LOGF (int priority, const char *fmt, ...)
319  __attribute__ ((format (printf, 2, 3)));
320 void SC_LOGF (int priority, const char *fmt, ...)
321  __attribute__ ((format (printf, 2, 3)));
322 #ifndef __cplusplus
323 #define SC_GEN_LOGF(package,category,priority,fmt,...) \
324  ((priority) < SC_LP_THRESHOLD ? (void) 0 : \
325  sc_logf (__FILE__, __LINE__, (package), (category), (priority), \
326  (fmt), __VA_ARGS__))
327 #define SC_GLOBAL_LOGF(p,fmt,...) \
328  SC_GEN_LOGF (sc_package_id, SC_LC_GLOBAL, (p), (fmt), __VA_ARGS__)
329 #define SC_LOGF(p,fmt,...) \
330  SC_GEN_LOGF (sc_package_id, SC_LC_NORMAL, (p), (fmt), __VA_ARGS__)
331 #endif
332 
333 /* convenience global log macros will only output if identifier <= 0 */
334 #define SC_GLOBAL_TRACE(s) SC_GLOBAL_LOG (SC_LP_TRACE, (s))
335 #define SC_GLOBAL_LDEBUG(s) SC_GLOBAL_LOG (SC_LP_DEBUG, (s))
336 #define SC_GLOBAL_VERBOSE(s) SC_GLOBAL_LOG (SC_LP_VERBOSE, (s))
337 #define SC_GLOBAL_INFO(s) SC_GLOBAL_LOG (SC_LP_INFO, (s))
338 #define SC_GLOBAL_STATISTICS(s) SC_GLOBAL_LOG (SC_LP_STATISTICS, (s))
339 #define SC_GLOBAL_PRODUCTION(s) SC_GLOBAL_LOG (SC_LP_PRODUCTION, (s))
340 #define SC_GLOBAL_ESSENTIAL(s) SC_GLOBAL_LOG (SC_LP_ESSENTIAL, (s))
341 #define SC_GLOBAL_LERROR(s) SC_GLOBAL_LOG (SC_LP_ERROR, (s))
342 void SC_GLOBAL_TRACEF (const char *fmt, ...)
343  __attribute__ ((format (printf, 1, 2)));
344 void SC_GLOBAL_LDEBUGF (const char *fmt, ...)
345  __attribute__ ((format (printf, 1, 2)));
346 void SC_GLOBAL_VERBOSEF (const char *fmt, ...)
347  __attribute__ ((format (printf, 1, 2)));
348 void SC_GLOBAL_INFOF (const char *fmt, ...)
349  __attribute__ ((format (printf, 1, 2)));
350 void SC_GLOBAL_STATISTICSF (const char *fmt, ...)
351  __attribute__ ((format (printf, 1, 2)));
352 void SC_GLOBAL_PRODUCTIONF (const char *fmt, ...)
353  __attribute__ ((format (printf, 1, 2)));
354 void SC_GLOBAL_ESSENTIALF (const char *fmt, ...)
355  __attribute__ ((format (printf, 1, 2)));
356 void SC_GLOBAL_LERRORF (const char *fmt, ...)
357  __attribute__ ((format (printf, 1, 2)));
358 #ifndef __cplusplus
359 #define SC_GLOBAL_TRACEF(fmt,...) \
360  SC_GLOBAL_LOGF (SC_LP_TRACE, (fmt), __VA_ARGS__)
361 #define SC_GLOBAL_LDEBUGF(fmt,...) \
362  SC_GLOBAL_LOGF (SC_LP_DEBUG, (fmt), __VA_ARGS__)
363 #define SC_GLOBAL_VERBOSEF(fmt,...) \
364  SC_GLOBAL_LOGF (SC_LP_VERBOSE, (fmt), __VA_ARGS__)
365 #define SC_GLOBAL_INFOF(fmt,...) \
366  SC_GLOBAL_LOGF (SC_LP_INFO, (fmt), __VA_ARGS__)
367 #define SC_GLOBAL_STATISTICSF(fmt,...) \
368  SC_GLOBAL_LOGF (SC_LP_STATISTICS, (fmt), __VA_ARGS__)
369 #define SC_GLOBAL_PRODUCTIONF(fmt,...) \
370  SC_GLOBAL_LOGF (SC_LP_PRODUCTION, (fmt), __VA_ARGS__)
371 #define SC_GLOBAL_ESSENTIALF(fmt,...) \
372  SC_GLOBAL_LOGF (SC_LP_ESSENTIAL, (fmt), __VA_ARGS__)
373 #define SC_GLOBAL_LERRORF(fmt,...) \
374  SC_GLOBAL_LOGF (SC_LP_ERROR, (fmt), __VA_ARGS__)
375 #endif
376 
377 /* convenience log macros that output regardless of identifier */
378 #define SC_TRACE(s) SC_LOG (SC_LP_TRACE, (s))
379 #define SC_LDEBUG(s) SC_LOG (SC_LP_DEBUG, (s))
380 #define SC_VERBOSE(s) SC_LOG (SC_LP_VERBOSE, (s))
381 #define SC_INFO(s) SC_LOG (SC_LP_INFO, (s))
382 #define SC_STATISTICS(s) SC_LOG (SC_LP_STATISTICS, (s))
383 #define SC_PRODUCTION(s) SC_LOG (SC_LP_PRODUCTION, (s))
384 #define SC_ESSENTIAL(s) SC_LOG (SC_LP_ESSENTIAL, (s))
385 #define SC_LERROR(s) SC_LOG (SC_LP_ERROR, (s))
386 void SC_TRACEF (const char *fmt, ...)
387  __attribute__ ((format (printf, 1, 2)));
388 void SC_LDEBUGF (const char *fmt, ...)
389  __attribute__ ((format (printf, 1, 2)));
390 void SC_VERBOSEF (const char *fmt, ...)
391  __attribute__ ((format (printf, 1, 2)));
392 void SC_INFOF (const char *fmt, ...)
393  __attribute__ ((format (printf, 1, 2)));
394 void SC_STATISTICSF (const char *fmt, ...)
395  __attribute__ ((format (printf, 1, 2)));
396 void SC_PRODUCTIONF (const char *fmt, ...)
397  __attribute__ ((format (printf, 1, 2)));
398 void SC_ESSENTIALF (const char *fmt, ...)
399  __attribute__ ((format (printf, 1, 2)));
400 void SC_LERRORF (const char *fmt, ...)
401  __attribute__ ((format (printf, 1, 2)));
402 #ifndef __cplusplus
403 #define SC_TRACEF(fmt,...) \
404  SC_LOGF (SC_LP_TRACE, (fmt), __VA_ARGS__)
405 #define SC_LDEBUGF(fmt,...) \
406  SC_LOGF (SC_LP_DEBUG, (fmt), __VA_ARGS__)
407 #define SC_VERBOSEF(fmt,...) \
408  SC_LOGF (SC_LP_VERBOSE, (fmt), __VA_ARGS__)
409 #define SC_INFOF(fmt,...) \
410  SC_LOGF (SC_LP_INFO, (fmt), __VA_ARGS__)
411 #define SC_STATISTICSF(fmt,...) \
412  SC_LOGF (SC_LP_STATISTICS, (fmt), __VA_ARGS__)
413 #define SC_PRODUCTIONF(fmt,...) \
414  SC_LOGF (SC_LP_PRODUCTION, (fmt), __VA_ARGS__)
415 #define SC_ESSENTIALF(fmt,...) \
416  SC_LOGF (SC_LP_ESSENTIAL, (fmt), __VA_ARGS__)
417 #define SC_LERRORF(fmt,...) \
418  SC_LOGF (SC_LP_ERROR, (fmt), __VA_ARGS__)
419 #endif
420 
421 /* callback typedefs */
422 
423 typedef void (*sc_handler_t) (void *data);
424 typedef void (*sc_log_handler_t) (FILE * log_stream,
425  const char *filename, int lineno,
426  int package, int category,
427  int priority, const char *msg);
428 
429 /* memory allocation functions, will abort if out of memory */
430 
431 void *sc_malloc (int package, size_t size);
432 void *sc_calloc (int package, size_t nmemb, size_t size);
433 void *sc_realloc (int package, void *ptr, size_t size);
434 char *sc_strdup (int package, const char *s);
435 void sc_free (int package, void *ptr);
436 int sc_memory_status (int package);
437 void sc_memory_check (int package);
438 
439 /* comparison functions for various integer sizes */
440 
441 int sc_int_compare (const void *v1, const void *v2);
442 int sc_int8_compare (const void *v1, const void *v2);
443 int sc_int16_compare (const void *v1, const void *v2);
444 int sc_int32_compare (const void *v1, const void *v2);
445 int sc_int64_compare (const void *v1, const void *v2);
446 int sc_double_compare (const void *v1, const void *v2);
447 
454 void sc_set_log_defaults (FILE * log_stream,
455  sc_log_handler_t log_handler,
456  int log_thresold);
457 
464 void sc_log (const char *filename, int lineno,
465  int package, int category, int priority,
466  const char *msg);
467 void sc_logf (const char *filename, int lineno,
468  int package, int category, int priority,
469  const char *fmt, ...)
470  __attribute__ ((format (printf, 6, 7)));
471 void sc_logv (const char *filename, int lineno,
472  int package, int category, int priority,
473  const char *fmt, va_list ap);
474 
476 void sc_log_indent_push_count (int package, int count);
477 
479 void sc_log_indent_pop_count (int package, int count);
480 
482 void sc_log_indent_push (void);
483 
485 void sc_log_indent_pop (void);
486 
488 void sc_abort (void)
489  __attribute__ ((noreturn));
490 
492 void sc_abort_verbose (const char *filename, int lineno,
493  const char *msg)
494  __attribute__ ((noreturn));
495 
497 void sc_abort_verbosef (const char *filename, int lineno,
498  const char *fmt, ...)
499  __attribute__ ((format (printf, 3, 4)))
500  __attribute__ ((noreturn));
501 
503 void sc_abort_verbosev (const char *filename, int lineno,
504  const char *fmt, va_list ap)
505  __attribute__ ((noreturn));
506 
508 void sc_abort_collective (const char *msg)
509  __attribute__ ((noreturn));
510 
516 int sc_package_register (sc_log_handler_t log_handler,
517  int log_threshold,
518  const char *name, const char *full);
519 int sc_package_is_registered (int package_id);
520 
524 void sc_package_unregister (int package_id);
525 
530 void sc_package_print_summary (int log_priority);
531 
546 void sc_init (sc_MPI_Comm mpicomm,
547  int catch_signals, int print_backtrace,
548  sc_log_handler_t log_handler, int log_threshold);
549 
555 void sc_finalize (void);
556 
563 int sc_is_root (void);
564 
565 SC_EXTERN_C_END;
566 
567 #endif /* SC_H */
void sc_abort_verbosev(const char *filename, int lineno, const char *fmt, va_list ap) __attribute__((noreturn))
Print a message to stderr and then call sc_abort ().
void sc_package_print_summary(int log_priority)
Print a summary of all packages registered with SC.
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_abort_verbose(const char *filename, int lineno, const char *msg) __attribute__((noreturn))
Print a message to stderr and then call sc_abort ().
void sc_abort_verbosef(const char *filename, int lineno, const char *fmt,...) __attribute__((format(printf
Print a message to stderr and then call sc_abort ().
void sc_log_indent_pop(void)
Remove one space from the start of a sc's default log format.
void sc_abort_collective(const char *msg) __attribute__((noreturn))
Collective abort where only root prints a message.
void sc_log_indent_push(void)
Add one space to the start of sc's default log format.
void sc_abort(void) __attribute__((noreturn))
Print a stack trace, call the abort handler and then call abort ().
int sc_is_root(void)
Identify the root process.
void sc_log_indent_pop_count(int package, int count)
Remove spaces from the start of a package's default log format.
void sc_package_unregister(int package_id)
Unregister a software package with SC.
void sc_finalize(void)
Unregisters all packages, runs the memory check, removes the signal handlers and resets sc_identifier...
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 sc_log_indent_push_count(int package, int count)
Add spaces to the start of a package's default log format.
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_set_log_defaults(FILE *log_stream, sc_log_handler_t log_handler, int log_thresold)
Controls the default SC log behavior.