libsc  1.6.0
src/sc.h
Go to the documentation of this file.
00001 /*
00002   This file is part of the SC Library.
00003   The SC Library provides support for parallel scientific applications.
00004 
00005   Copyright (C) 2010 The University of Texas System
00006 
00007   The SC Library is free software; you can redistribute it and/or
00008   modify it under the terms of the GNU Lesser General Public
00009   License as published by the Free Software Foundation; either
00010   version 2.1 of the License, or (at your option) any later version.
00011 
00012   The SC Library is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015   Lesser General Public License for more details.
00016 
00017   You should have received a copy of the GNU Lesser General Public
00018   License along with the SC Library; if not, write to the Free Software
00019   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020   02110-1301, USA.
00021 */
00022 
00033 #ifndef SC_H
00034 #define SC_H
00035 
00036 /* include the sc_config header first */
00037 
00038 #include <sc_config.h>
00039 #ifndef _sc_const
00040 #define _sc_const const
00041 #endif
00042 #ifndef _sc_restrict
00043 #define _sc_restrict restrict
00044 #endif
00045 
00046 /* use this in case mpi.h includes stdint.h */
00047 
00048 #ifndef __STDC_LIMIT_MACROS
00049 #define __STDC_LIMIT_MACROS
00050 #endif
00051 
00052 /* include MPI before stdio.h */
00053 
00054 #ifdef SC_ENABLE_MPI
00055 #include <mpi.h>
00056 #else
00057 #ifdef MPI_SUCCESS
00058 #error "mpi.h is included.  Use --enable-mpi."
00059 #endif
00060 #endif
00061 
00062 /* include system headers */
00063 
00064 #include <math.h>
00065 #include <ctype.h>
00066 #include <float.h>
00067 #include <libgen.h>
00068 #include <limits.h>
00069 #include <stdarg.h>
00070 #include <stddef.h>
00071 #include <stdint.h>
00072 #include <stdio.h>
00073 #include <stdlib.h>
00074 #include <string.h>
00075 #include <unistd.h>
00076 
00077 /* provide extern C defines */
00078 
00079 /* the hacks below enable semicolons after the SC_EXTERN_C_ macros */
00080 #ifdef __cplusplus
00081 #define SC_EXTERN_C_BEGIN       extern "C" { void sc_extern_c_hack_1 (void)
00082 #define SC_EXTERN_C_END                    } void sc_extern_c_hack_2 (void)
00083 #else
00084 #define SC_EXTERN_C_BEGIN                    void sc_extern_c_hack_3 (void)
00085 #define SC_EXTERN_C_END                      void sc_extern_c_hack_4 (void)
00086 #endif
00087 
00088 /* these two libsc headers are always included */
00089 
00090 #include <sc_c99_functions.h>
00091 #include <sc_mpi.h>
00092 
00093 SC_EXTERN_C_BEGIN;
00094 
00095 /* extern variables */
00096 
00097 extern const int    sc_log2_lookup_table[256];
00098 extern int          sc_package_id;
00099 
00100 /* control a trace file by environment variables (see sc_init) */
00101 extern FILE        *sc_trace_file;
00102 extern int          sc_trace_prio;
00103 
00104 /* define math constants if necessary */
00105 #ifndef M_E
00106 #define M_E 2.7182818284590452354       /* e */
00107 #endif
00108 #ifndef M_LOG2E
00109 #define M_LOG2E 1.4426950408889634074   /* log_2 e */
00110 #endif
00111 #ifndef M_LOG10E
00112 #define M_LOG10E 0.43429448190325182765 /* log_10 e */
00113 #endif
00114 #ifndef M_LN2
00115 #define M_LN2 0.69314718055994530942    /* log_e 2 */
00116 #endif
00117 #ifndef M_LN10
00118 #define M_LN10 2.30258509299404568402   /* log_e 10 */
00119 #endif
00120 #ifndef M_PI
00121 #define M_PI 3.14159265358979323846     /* pi */
00122 #endif
00123 #ifndef M_PI_2
00124 #define M_PI_2 1.57079632679489661923   /* pi/2 */
00125 #endif
00126 #ifndef M_PI_4
00127 #define M_PI_4 0.78539816339744830962   /* pi/4 */
00128 #endif
00129 #ifndef M_1_PI
00130 #define M_1_PI 0.31830988618379067154   /* 1/pi */
00131 #endif
00132 #ifndef M_2_PI
00133 #define M_2_PI 0.63661977236758134308   /* 2/pi */
00134 #endif
00135 #ifndef M_2_SQRTPI
00136 #define M_2_SQRTPI 1.12837916709551257390       /* 2/sqrt(pi) */
00137 #endif
00138 #ifndef M_SQRT2
00139 #define M_SQRT2 1.41421356237309504880  /* sqrt(2) */
00140 #endif
00141 #ifndef M_SQRT1_2
00142 #define M_SQRT1_2 0.70710678118654752440        /* 1/sqrt(2) */
00143 #endif
00144 
00145 #define SC_EPS               2.220446049250313e-16
00146 #define SC_1000_EPS (1000. * 2.220446049250313e-16)
00147 
00148 #if 0
00149 /*@ignore@*/
00150 #define index   DONT_USE_NAME_CONFLICT_1 ---
00151 #define rindex  DONT_USE_NAME_CONFLICT_2 ---
00152 #define link    DONT_USE_NAME_CONFLICT_3 ---
00153 #define NO_DEFINE_DONT_USE_CONFLICT SPLINT_IS_STUPID_ALSO
00154 /*@end@*/
00155 #endif /* 0 */
00156 
00157 /* check macros, always enabled */
00158 
00159 #define SC_NOOP() ((void) (0))
00160 #define SC_ABORT(s)                             \
00161   sc_abort_verbose (__FILE__, __LINE__, (s))
00162 #define SC_ABORT_NOT_REACHED() SC_ABORT ("Unreachable code")
00163 #define SC_CHECK_ABORT(q,s)                     \
00164   ((q) ? (void) 0 : SC_ABORT (s))
00165 #define SC_CHECK_MPI(r) SC_CHECK_ABORT ((r) == sc_MPI_SUCCESS, "MPI error")
00166 #define SC_CHECK_ZLIB(r) SC_CHECK_ABORT ((r) == Z_OK, "zlib error")
00167 
00168 /*
00169  * C++98 does not allow variadic macros
00170  * 1. Declare a default variadic function for C and C++
00171  * 2. Use macros in C instead of the function
00172  * This loses __FILE__ and __LINE__ in the C++ ..F log functions
00173  */
00174 void                SC_ABORTF (const char *fmt, ...)
00175   __attribute__ ((format (printf, 1, 2)))
00176   __attribute__ ((noreturn));
00177 void                SC_CHECK_ABORTF (int success, const char *fmt, ...)
00178   __attribute__ ((format (printf, 2, 3)));
00179 #ifndef __cplusplus
00180 #define SC_ABORTF(fmt,...)                                      \
00181   sc_abort_verbosef (__FILE__, __LINE__, (fmt), __VA_ARGS__)
00182 #define SC_CHECK_ABORTF(q,fmt,...)                      \
00183   ((q) ? (void) 0 : SC_ABORTF (fmt, __VA_ARGS__))
00184 #endif
00185 #define SC_ABORT1(fmt,a)                                \
00186   sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a))
00187 #define SC_ABORT2(fmt,a,b)                                      \
00188   sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b))
00189 #define SC_ABORT3(fmt,a,b,c)                                    \
00190   sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c))
00191 #define SC_ABORT4(fmt,a,b,c,d)                                          \
00192   sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d))
00193 #define SC_ABORT5(fmt,a,b,c,d,e)                                        \
00194   sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d), (e))
00195 #define SC_ABORT6(fmt,a,b,c,d,e,f)                                      \
00196   sc_abort_verbosef (__FILE__, __LINE__, (fmt), (a), (b), (c), (d), (e), (f))
00197 #define SC_CHECK_ABORT1(q,fmt,a)                \
00198   ((q) ? (void) 0 : SC_ABORT1 ((fmt), (a)))
00199 #define SC_CHECK_ABORT2(q,fmt,a,b)                      \
00200   ((q) ? (void) 0 : SC_ABORT2 ((fmt), (a), (b)))
00201 #define SC_CHECK_ABORT3(q,fmt,a,b,c)                    \
00202   ((q) ? (void) 0 : SC_ABORT3 ((fmt), (a), (b), (c)))
00203 #define SC_CHECK_ABORT4(q,fmt,a,b,c,d)                          \
00204   ((q) ? (void) 0 : SC_ABORT4 ((fmt), (a), (b), (c), (d)))
00205 #define SC_CHECK_ABORT5(q,fmt,a,b,c,d,e)                        \
00206   ((q) ? (void) 0 : SC_ABORT5 ((fmt), (a), (b), (c), (d), (e)))
00207 #define SC_CHECK_ABORT6(q,fmt,a,b,c,d,e,f)                              \
00208   ((q) ? (void) 0 : SC_ABORT6 ((fmt), (a), (b), (c), (d), (e), (f)))
00209 
00210 /* assertions, only enabled in debug mode */
00211 
00212 #ifdef SC_DEBUG
00213 #define SC_ASSERT(c) SC_CHECK_ABORT ((c), "Assertion '" #c "'")
00214 #define SC_EXECUTE_ASSERT_FALSE(expression)                             \
00215   do { int _sc_i = (int) (expression);                                  \
00216        SC_CHECK_ABORT (!_sc_i, "Expected false: '" #expression "'");    \
00217   } while (0)
00218 #define SC_EXECUTE_ASSERT_TRUE(expression)                              \
00219   do { int _sc_i = (int) (expression);                                  \
00220        SC_CHECK_ABORT (_sc_i, "Expected true: '" #expression "'");      \
00221   } while (0)
00222 #else
00223 #define SC_ASSERT(c) SC_NOOP ()
00224 #define SC_EXECUTE_ASSERT_FALSE(expression) \
00225   do { (void) (expression); } while (0)
00226 #define SC_EXECUTE_ASSERT_TRUE(expression) \
00227   do { (void) (expression); } while (0)
00228 #endif
00229 
00230 /* macros for memory allocation, will abort if out of memory */
00231 
00232 #define SC_ALLOC(t,n)         (t *) sc_malloc (sc_package_id, (n) * sizeof(t))
00233 #define SC_ALLOC_ZERO(t,n)    (t *) sc_calloc (sc_package_id, \
00234                                                (size_t) (n), sizeof(t))
00235 #define SC_REALLOC(p,t,n)     (t *) sc_realloc (sc_package_id,          \
00236                                              (p), (n) * sizeof(t))
00237 #define SC_STRDUP(s)                sc_strdup (sc_package_id, (s))
00238 #define SC_FREE(p)                  sc_free (sc_package_id, (p))
00239 
00244 #define SC_BZERO(p,n) ((void) memset ((p), 0, (n) * sizeof (*(p))))
00245 
00246 /* min, max and square helper macros */
00247 
00248 #define SC_MIN(a,b) (((a) < (b)) ? (a) : (b))
00249 #define SC_MAX(a,b) (((a) > (b)) ? (a) : (b))
00250 #define SC_SQR(a) ((a) * (a))
00251 
00252 /* hopefully fast binary logarithms and binary round up */
00253 
00254 #define SC_LOG2_8(x) (sc_log2_lookup_table[(x)])
00255 #define SC_LOG2_16(x) (((x) > 0xff) ?                                   \
00256                        (SC_LOG2_8 ((x) >> 8) + 8) : SC_LOG2_8 (x))
00257 #define SC_LOG2_32(x) (((x) > 0xffff) ?                                 \
00258                        (SC_LOG2_16 ((x) >> 16)) + 16 : SC_LOG2_16 (x))
00259 #define SC_LOG2_64(x) (((x) > 0xffffffffLL) ?                           \
00260                        (SC_LOG2_32 ((x) >> 32)) + 32 : SC_LOG2_32 (x))
00261 #define SC_ROUNDUP2_32(x)                               \
00262   (((x) <= 0) ? 0 : (1 << (SC_LOG2_32 ((x) - 1) + 1)))
00263 #define SC_ROUNDUP2_64(x)                               \
00264   (((x) <= 0) ? 0 : (1LL << (SC_LOG2_64 ((x) - 1LL) + 1)))
00265 
00266 /* log categories */
00267 
00268 #define SC_LC_GLOBAL      1     
00269 #define SC_LC_NORMAL      2     
00283 
00284 /* log priorities */
00285 #define SC_LP_DEFAULT   (-1)    
00286 #define SC_LP_ALWAYS      0     
00287 #define SC_LP_TRACE       1     
00288 #define SC_LP_DEBUG       2     
00289 #define SC_LP_VERBOSE     3     
00290 #define SC_LP_INFO        4     
00291 #define SC_LP_STATISTICS  5     
00292 #define SC_LP_PRODUCTION  6     
00293 #define SC_LP_ESSENTIAL   7     
00294 #define SC_LP_ERROR       8     
00295 #define SC_LP_SILENT      9     
00297 
00298 
00301 #ifdef SC_LOG_PRIORITY
00302 #define SC_LP_THRESHOLD SC_LOG_PRIORITY
00303 #else
00304 #ifdef SC_DEBUG
00305 #define SC_LP_THRESHOLD SC_LP_TRACE
00306 #else
00307 #define SC_LP_THRESHOLD SC_LP_INFO
00308 #endif
00309 #endif
00310 
00311 /* generic log macros */
00312 #define SC_GEN_LOG(package,category,priority,s)                         \
00313   ((priority) < SC_LP_THRESHOLD ? (void) 0 :                            \
00314    sc_log (__FILE__, __LINE__, (package), (category), (priority), (s)))
00315 #define SC_GLOBAL_LOG(p,s) SC_GEN_LOG (sc_package_id, SC_LC_GLOBAL, (p), (s))
00316 #define SC_LOG(p,s) SC_GEN_LOG (sc_package_id, SC_LC_NORMAL, (p), (s))
00317 void                SC_GEN_LOGF (int package, int category, int priority,
00318                                  const char *fmt, ...)
00319   __attribute__ ((format (printf, 4, 5)));
00320 void                SC_GLOBAL_LOGF (int priority, const char *fmt, ...)
00321   __attribute__ ((format (printf, 2, 3)));
00322 void                SC_LOGF (int priority, const char *fmt, ...)
00323   __attribute__ ((format (printf, 2, 3)));
00324 #ifndef __cplusplus
00325 #define SC_GEN_LOGF(package,category,priority,fmt,...)                  \
00326   ((priority) < SC_LP_THRESHOLD ? (void) 0 :                            \
00327    sc_logf (__FILE__, __LINE__, (package), (category), (priority),      \
00328             (fmt), __VA_ARGS__))
00329 #define SC_GLOBAL_LOGF(p,fmt,...)                                       \
00330   SC_GEN_LOGF (sc_package_id, SC_LC_GLOBAL, (p), (fmt), __VA_ARGS__)
00331 #define SC_LOGF(p,fmt,...)                                              \
00332   SC_GEN_LOGF (sc_package_id, SC_LC_NORMAL, (p), (fmt), __VA_ARGS__)
00333 #endif
00334 
00335 /* convenience global log macros will only output if identifier <= 0 */
00336 #define SC_GLOBAL_TRACE(s) SC_GLOBAL_LOG (SC_LP_TRACE, (s))
00337 #define SC_GLOBAL_LDEBUG(s) SC_GLOBAL_LOG (SC_LP_DEBUG, (s))
00338 #define SC_GLOBAL_VERBOSE(s) SC_GLOBAL_LOG (SC_LP_VERBOSE, (s))
00339 #define SC_GLOBAL_INFO(s) SC_GLOBAL_LOG (SC_LP_INFO, (s))
00340 #define SC_GLOBAL_STATISTICS(s) SC_GLOBAL_LOG (SC_LP_STATISTICS, (s))
00341 #define SC_GLOBAL_PRODUCTION(s) SC_GLOBAL_LOG (SC_LP_PRODUCTION, (s))
00342 #define SC_GLOBAL_ESSENTIAL(s) SC_GLOBAL_LOG (SC_LP_ESSENTIAL, (s))
00343 #define SC_GLOBAL_LERROR(s) SC_GLOBAL_LOG (SC_LP_ERROR, (s))
00344 void                SC_GLOBAL_TRACEF (const char *fmt, ...)
00345   __attribute__ ((format (printf, 1, 2)));
00346 void                SC_GLOBAL_LDEBUGF (const char *fmt, ...)
00347   __attribute__ ((format (printf, 1, 2)));
00348 void                SC_GLOBAL_VERBOSEF (const char *fmt, ...)
00349   __attribute__ ((format (printf, 1, 2)));
00350 void                SC_GLOBAL_INFOF (const char *fmt, ...)
00351   __attribute__ ((format (printf, 1, 2)));
00352 void                SC_GLOBAL_STATISTICSF (const char *fmt, ...)
00353   __attribute__ ((format (printf, 1, 2)));
00354 void                SC_GLOBAL_PRODUCTIONF (const char *fmt, ...)
00355   __attribute__ ((format (printf, 1, 2)));
00356 void                SC_GLOBAL_ESSENTIALF (const char *fmt, ...)
00357   __attribute__ ((format (printf, 1, 2)));
00358 void                SC_GLOBAL_LERRORF (const char *fmt, ...)
00359   __attribute__ ((format (printf, 1, 2)));
00360 #ifndef __cplusplus
00361 #define SC_GLOBAL_TRACEF(fmt,...)                       \
00362   SC_GLOBAL_LOGF (SC_LP_TRACE, (fmt), __VA_ARGS__)
00363 #define SC_GLOBAL_LDEBUGF(fmt,...)                      \
00364   SC_GLOBAL_LOGF (SC_LP_DEBUG, (fmt), __VA_ARGS__)
00365 #define SC_GLOBAL_VERBOSEF(fmt,...)                     \
00366   SC_GLOBAL_LOGF (SC_LP_VERBOSE, (fmt), __VA_ARGS__)
00367 #define SC_GLOBAL_INFOF(fmt,...)                        \
00368   SC_GLOBAL_LOGF (SC_LP_INFO, (fmt), __VA_ARGS__)
00369 #define SC_GLOBAL_STATISTICSF(fmt,...)                  \
00370   SC_GLOBAL_LOGF (SC_LP_STATISTICS, (fmt), __VA_ARGS__)
00371 #define SC_GLOBAL_PRODUCTIONF(fmt,...)                  \
00372   SC_GLOBAL_LOGF (SC_LP_PRODUCTION, (fmt), __VA_ARGS__)
00373 #define SC_GLOBAL_ESSENTIALF(fmt,...)                   \
00374   SC_GLOBAL_LOGF (SC_LP_ESSENTIAL, (fmt), __VA_ARGS__)
00375 #define SC_GLOBAL_LERRORF(fmt,...)                      \
00376   SC_GLOBAL_LOGF (SC_LP_ERROR, (fmt), __VA_ARGS__)
00377 #endif
00378 
00379 /* convenience log macros that output regardless of identifier */
00380 #define SC_TRACE(s) SC_LOG (SC_LP_TRACE, (s))
00381 #define SC_LDEBUG(s) SC_LOG (SC_LP_DEBUG, (s))
00382 #define SC_VERBOSE(s) SC_LOG (SC_LP_VERBOSE, (s))
00383 #define SC_INFO(s) SC_LOG (SC_LP_INFO, (s))
00384 #define SC_STATISTICS(s) SC_LOG (SC_LP_STATISTICS, (s))
00385 #define SC_PRODUCTION(s) SC_LOG (SC_LP_PRODUCTION, (s))
00386 #define SC_ESSENTIAL(s) SC_LOG (SC_LP_ESSENTIAL, (s))
00387 #define SC_LERROR(s) SC_LOG (SC_LP_ERROR, (s))
00388 void                SC_TRACEF (const char *fmt, ...)
00389   __attribute__ ((format (printf, 1, 2)));
00390 void                SC_LDEBUGF (const char *fmt, ...)
00391   __attribute__ ((format (printf, 1, 2)));
00392 void                SC_VERBOSEF (const char *fmt, ...)
00393   __attribute__ ((format (printf, 1, 2)));
00394 void                SC_INFOF (const char *fmt, ...)
00395   __attribute__ ((format (printf, 1, 2)));
00396 void                SC_STATISTICSF (const char *fmt, ...)
00397   __attribute__ ((format (printf, 1, 2)));
00398 void                SC_PRODUCTIONF (const char *fmt, ...)
00399   __attribute__ ((format (printf, 1, 2)));
00400 void                SC_ESSENTIALF (const char *fmt, ...)
00401   __attribute__ ((format (printf, 1, 2)));
00402 void                SC_LERRORF (const char *fmt, ...)
00403   __attribute__ ((format (printf, 1, 2)));
00404 #ifndef __cplusplus
00405 #define SC_TRACEF(fmt,...)                      \
00406   SC_LOGF (SC_LP_TRACE, (fmt), __VA_ARGS__)
00407 #define SC_LDEBUGF(fmt,...)                     \
00408   SC_LOGF (SC_LP_DEBUG, (fmt), __VA_ARGS__)
00409 #define SC_VERBOSEF(fmt,...)                    \
00410   SC_LOGF (SC_LP_VERBOSE, (fmt), __VA_ARGS__)
00411 #define SC_INFOF(fmt,...)                       \
00412   SC_LOGF (SC_LP_INFO, (fmt), __VA_ARGS__)
00413 #define SC_STATISTICSF(fmt,...)                         \
00414   SC_LOGF (SC_LP_STATISTICS, (fmt), __VA_ARGS__)
00415 #define SC_PRODUCTIONF(fmt,...)                         \
00416   SC_LOGF (SC_LP_PRODUCTION, (fmt), __VA_ARGS__)
00417 #define SC_ESSENTIALF(fmt,...)                  \
00418   SC_LOGF (SC_LP_ESSENTIAL, (fmt), __VA_ARGS__)
00419 #define SC_LERRORF(fmt,...)                     \
00420   SC_LOGF (SC_LP_ERROR, (fmt), __VA_ARGS__)
00421 #endif
00422 
00423 /* callback typedefs */
00424 
00425 typedef void        (*sc_handler_t) (void *data);
00426 typedef void        (*sc_log_handler_t) (FILE * log_stream,
00427                                          const char *filename, int lineno,
00428                                          int package, int category,
00429                                          int priority, const char *msg);
00430 
00431 /* memory allocation functions, will abort if out of memory */
00432 
00433 void               *sc_malloc (int package, size_t size);
00434 void               *sc_calloc (int package, size_t nmemb, size_t size);
00435 void               *sc_realloc (int package, void *ptr, size_t size);
00436 char               *sc_strdup (int package, const char *s);
00437 void                sc_free (int package, void *ptr);
00438 int                 sc_memory_status (int package);
00439 void                sc_memory_check (int package);
00440 
00441 /* comparison functions for various integer sizes */
00442 
00443 int                 sc_int_compare (const void *v1, const void *v2);
00444 int                 sc_int8_compare (const void *v1, const void *v2);
00445 int                 sc_int16_compare (const void *v1, const void *v2);
00446 int                 sc_int32_compare (const void *v1, const void *v2);
00447 int                 sc_int64_compare (const void *v1, const void *v2);
00448 int                 sc_double_compare (const void *v1, const void *v2);
00449 
00456 void                sc_set_log_defaults (FILE * log_stream,
00457                                          sc_log_handler_t log_handler,
00458                                          int log_thresold);
00459 
00466 void                sc_log (const char *filename, int lineno,
00467                             int package, int category, int priority,
00468                             const char *msg);
00469 void                sc_logf (const char *filename, int lineno,
00470                              int package, int category, int priority,
00471                              const char *fmt, ...)
00472   __attribute__ ((format (printf, 6, 7)));
00473 void                sc_logv (const char *filename, int lineno,
00474                              int package, int category, int priority,
00475                              const char *fmt, va_list ap);
00476 
00478 void                sc_log_indent_push_count (int package, int count);
00479 
00481 void                sc_log_indent_pop_count (int package, int count);
00482 
00484 void                sc_log_indent_push (void);
00485 
00487 void                sc_log_indent_pop (void);
00488 
00490 void                sc_abort (void)
00491   __attribute__ ((noreturn));
00492 
00494 void                sc_abort_verbose (const char *filename, int lineno,
00495                                       const char *msg)
00496   __attribute__ ((noreturn));
00497 
00499 void                sc_abort_verbosef (const char *filename, int lineno,
00500                                        const char *fmt, ...)
00501   __attribute__ ((format (printf, 3, 4)))
00502   __attribute__ ((noreturn));
00503 
00505 void                sc_abort_verbosev (const char *filename, int lineno,
00506                                        const char *fmt, va_list ap)
00507   __attribute__ ((noreturn));
00508 
00510 void                sc_abort_collective (const char *msg)
00511   __attribute__ ((noreturn));
00512 
00518 int                 sc_package_register (sc_log_handler_t log_handler,
00519                                          int log_threshold,
00520                                          const char *name, const char *full);
00521 int                 sc_package_is_registered (int package_id);
00522 
00526 void                sc_package_unregister (int package_id);
00527 
00532 void                sc_package_print_summary (int log_priority);
00533 
00548 void                sc_init (sc_MPI_Comm mpicomm,
00549                              int catch_signals, int print_backtrace,
00550                              sc_log_handler_t log_handler, int log_threshold);
00551 
00557 void                sc_finalize (void);
00558 
00565 int                 sc_is_root (void);
00566 
00567 SC_EXTERN_C_END;
00568 
00569 #endif /* SC_H */
 All Data Structures Files Functions Variables Typedefs Defines