2004-01-07 22:33:37 +03:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-07 22:33:37 +03:00
|
|
|
* $HEADER$
|
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* This file is included at the bottom of ompi_config.h, and is
|
2004-01-07 22:33:37 +03:00
|
|
|
* therefore a) after all the #define's that were output from
|
2004-08-06 18:30:18 +04:00
|
|
|
* configure, and b) included in most/all files in Open MPI.
|
2004-01-07 22:33:37 +03:00
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* Since this file is *only* ever included by ompi_config.h, and
|
|
|
|
* ompi_config.h already has #ifndef/#endif protection, there is no
|
2004-01-07 22:33:37 +03:00
|
|
|
* need to #ifndef/#endif protection here.
|
|
|
|
*/
|
|
|
|
|
2004-10-22 20:06:05 +04:00
|
|
|
#ifndef OMPI_CONFIG_BOTTOM_H
|
|
|
|
#define OMPI_CONFIG_BOTTOM_H
|
|
|
|
|
2004-11-03 00:48:31 +03:00
|
|
|
#if defined(WIN32) && defined(OMPI_BUILDING)
|
2004-10-22 20:06:05 +04:00
|
|
|
#include "win32/win_compat.h"
|
2004-11-02 16:22:08 +03:00
|
|
|
#define OMPI_COMP_EXPORT __declspec(dllexport)
|
|
|
|
#endif
|
|
|
|
|
2004-11-02 18:14:04 +03:00
|
|
|
#if defined(WIN32)
|
|
|
|
#if defined(OMPI_BUILDING) && OMPI_BUILDING
|
2004-11-02 16:22:08 +03:00
|
|
|
#define OMPI_DECLSPEC __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define OMPI_DECLSPEC __declspec(dllimport)
|
2004-10-22 20:06:05 +04:00
|
|
|
#endif
|
2004-11-02 18:14:04 +03:00
|
|
|
#endif
|
2004-10-22 20:06:05 +04:00
|
|
|
|
|
|
|
#ifndef OMPI_DECLSPEC
|
|
|
|
#define OMPI_DECLSPEC
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef OMPI_COMP_EXPORT
|
|
|
|
#define OMPI_COMP_EXPORT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
2004-10-23 00:30:59 +04:00
|
|
|
* If we're in C, we may need to bring in the bool type and true/false
|
|
|
|
* constants. OMPI_NEED_C_BOOL will be true if the compiler either
|
|
|
|
* needs <stdbool.h> or doesn't define the bool type at all.
|
2004-01-14 10:06:57 +03:00
|
|
|
*/
|
2004-11-02 18:14:04 +03:00
|
|
|
#if !defined(__cplusplus) && defined(OMPI_BUILDING)
|
2004-10-23 00:30:59 +04:00
|
|
|
# if OMPI_NEED_C_BOOL
|
|
|
|
# if OMPI_USE_STDBOOL_H
|
|
|
|
/* If we're using <stdbool.h>, there is an implicit
|
|
|
|
assumption that the C++ bool is the same size and has
|
|
|
|
the same alignment. */
|
|
|
|
# include <stdbool.h>
|
|
|
|
# elif defined(WIN32)
|
|
|
|
# define bool BOOL
|
|
|
|
# define false FALSE
|
|
|
|
# define true TRUE
|
|
|
|
# else
|
|
|
|
/* We need to create a bool type and ensure that it's the
|
|
|
|
same size / alignment as the C++ bool size /
|
|
|
|
alignment */
|
|
|
|
# define false 0
|
|
|
|
# define true 1
|
|
|
|
# if SIZEOF_BOOL == SIZEOF_CHAR && OMPI_ALIGNMENT_CXX_BOOL == OMPI_ALIGNMENT_CHAR
|
2004-11-24 13:48:31 +03:00
|
|
|
typedef char bool;
|
2004-10-23 00:30:59 +04:00
|
|
|
# elif SIZEOF_BOOL == SIZEOF_SHORT && OMPI_ALIGNMENT_CXX_BOOL == OMPI_ALIGNMENT_SHORT
|
2004-11-24 13:48:31 +03:00
|
|
|
typedef short bool;
|
2004-10-23 00:30:59 +04:00
|
|
|
# elif SIZEOF_BOOL == SIZEOF_INT && OMPI_ALIGNMENT_CXX_BOOL == OMPI_ALIGNMENT_INT
|
2004-11-24 13:48:31 +03:00
|
|
|
typedef int bool;
|
2004-10-23 00:30:59 +04:00
|
|
|
# elif SIZEOF_BOOL == SIZEOF_LONG && OMPI_ALIGNMENT_CXX_BOOL == OMPI_ALIGNMENT_LONG
|
2004-11-24 13:48:31 +03:00
|
|
|
typedef long bool;
|
2004-10-23 00:30:59 +04:00
|
|
|
# elif defined(SIZEOF_LONG_LONG) && defined(OMPI_ALIGNMENT_LONG) && SIZEOF_BOOL == SIZEOF_LONG && OMPI_ALIGNMENT_CXX_BOOL == OMPI_ALIGNMENT_LONG
|
2004-11-24 13:48:31 +03:00
|
|
|
typedef long long bool;
|
2004-10-23 00:30:59 +04:00
|
|
|
# else
|
|
|
|
# error Cannot find a C type that corresponds to the size and alignment of C++ bool!
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# endif
|
2004-01-07 22:33:37 +03:00
|
|
|
#endif
|
2004-01-09 21:40:26 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Maximum size of a filename path.
|
|
|
|
*/
|
2004-01-14 10:06:57 +03:00
|
|
|
#include <limits.h>
|
2004-01-09 21:40:26 +03:00
|
|
|
#if defined(PATH_MAX)
|
2004-06-07 19:33:53 +04:00
|
|
|
#define OMPI_PATH_MAX (PATH_MAX + 1)
|
2004-01-09 21:40:26 +03:00
|
|
|
#elif defined(_POSIX_PATH_MAX)
|
2004-06-07 19:33:53 +04:00
|
|
|
#define OMPI_PATH_MAX (_POSIX_PATH_MAX + 1)
|
2004-01-09 21:40:26 +03:00
|
|
|
#else
|
2004-06-07 19:33:53 +04:00
|
|
|
#define OMPI_PATH_MAX 256
|
2004-01-09 21:40:26 +03:00
|
|
|
#endif
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do we have thread support?
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
#define OMPI_HAVE_THREADS (OMPI_HAVE_SOLARIS_THREADS || OMPI_HAVE_POSIX_THREADS)
|
2004-01-17 07:10:01 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do we have <stdint.h>?
|
|
|
|
*/
|
2004-08-16 03:54:30 +04:00
|
|
|
#ifdef HAVE_STDINT_H
|
2004-10-18 20:08:35 +04:00
|
|
|
#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
|
|
|
|
/* When using a C++ compiler, the max / min value #defines for std
|
|
|
|
types are only included if __STDC_LIMIT_MACROS is set before
|
|
|
|
including stdint.h */
|
|
|
|
#define __STDC_LIMIT_MACROS
|
|
|
|
#endif
|
2004-01-17 07:10:01 +03:00
|
|
|
#include <stdint.h>
|
2004-03-17 22:21:56 +03:00
|
|
|
#else
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_stdint.h"
|
2004-01-17 07:10:01 +03:00
|
|
|
#endif
|
2004-02-10 03:07:09 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do we want memory debugging?
|
2004-07-14 19:13:32 +04:00
|
|
|
*
|
|
|
|
* A few scenarios:
|
|
|
|
*
|
|
|
|
* 1. In the OMPI C library: we want these defines in all cases
|
|
|
|
* 2. In the OMPI C++ bindings: we do not want them
|
|
|
|
* 3. In the OMPI C++ executables: we do want them
|
|
|
|
*
|
|
|
|
* So for 1, everyone must include <ompi_config.h> first. For 2, the
|
|
|
|
* C++ bindings will never include <ompi_config.h> -- they will only
|
|
|
|
* include <mpi.h>, which includes <ompi_config.h>, but after
|
|
|
|
* OMPI_MPI_H is defined. For 3, it's the same as 1 -- just include
|
|
|
|
* <ompi_config.h> first.
|
2004-02-10 03:07:09 +03:00
|
|
|
*/
|
2004-07-14 19:13:32 +04:00
|
|
|
#if OMPI_ENABLE_MEM_DEBUG && defined(OMPI_BUILDING) && OMPI_BUILDING && !defined(OMPI_MPI_H)
|
2004-02-10 03:07:09 +03:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/* It is safe to include util/malloc.h here because a) it will only
|
2004-06-07 19:33:53 +04:00
|
|
|
happen when we are building OMPI and therefore have a full OMPI
|
2004-02-10 03:07:09 +03:00
|
|
|
source tree [including headers] available, and b) we guaranteed to
|
2004-11-27 01:13:52 +03:00
|
|
|
*not* to include anything else via util/malloc.h, so we won't
|
2004-02-10 03:07:09 +03:00
|
|
|
have Cascading Includes Of Death. */
|
2004-11-27 15:43:19 +03:00
|
|
|
# include "util/malloc.h"
|
|
|
|
# if defined(malloc)
|
|
|
|
# undef malloc
|
|
|
|
# endif
|
|
|
|
# define malloc(size) ompi_malloc((size), __FILE__, __LINE__)
|
|
|
|
# if defined(calloc)
|
|
|
|
# undef calloc
|
|
|
|
# endif
|
|
|
|
# define calloc(nmembers, size) ompi_calloc((nmembers), (size), __FILE__, __LINE__)
|
|
|
|
# if defined(realloc)
|
|
|
|
# undef realloc
|
|
|
|
# endif
|
|
|
|
# define realloc(ptr, size) ompi_realloc((ptr), (size), __FILE__, __LINE__)
|
|
|
|
# if defined(free)
|
|
|
|
# undef free
|
|
|
|
# endif
|
|
|
|
# define free(ptr) ompi_free((ptr), __FILE__, __LINE__)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we're mem debugging, make the OMPI_DEBUG_ZERO resolve to memset
|
|
|
|
*/
|
|
|
|
# include <string.h>
|
|
|
|
# define OMPI_DEBUG_ZERO(obj) memset(&obj, 0, sizeof(obj))
|
|
|
|
#else
|
|
|
|
# define OMPI_DEBUG_ZERO(obj)
|
2004-02-10 03:07:09 +03:00
|
|
|
#endif
|
2004-02-13 08:39:46 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do we want to override debugging controls?
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
#if defined(OMPI_ENABLE_DEBUG_OVERRIDE) && OMPI_ENABLE_DEBUG_OVERRIDE
|
|
|
|
#undef OMPI_ENABLE_DEBUG
|
|
|
|
#define OMPI_ENABLE_DEBUG 1
|
2004-02-13 08:39:46 +03:00
|
|
|
#endif
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* C type for Fortran COMPLEX
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
ompi_fortran_real_t real;
|
|
|
|
ompi_fortran_real_t imag;
|
|
|
|
} ompi_fortran_complex_t;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* C type for Fortran DOUBLE COMPLEX
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
ompi_fortran_dblprec_t real;
|
|
|
|
ompi_fortran_dblprec_t imag;
|
|
|
|
} ompi_fortran_dblcomplex_t;
|
2004-08-11 02:41:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* printf functions for portability
|
|
|
|
*/
|
2004-08-19 23:27:15 +04:00
|
|
|
|
|
|
|
#if !defined(HAVE_VASPRINTF) || !defined(HAVE_VSNPRINTF)
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
2004-08-19 23:27:15 +04:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-08-11 02:41:17 +04:00
|
|
|
#ifndef HAVE_ASPRINTF
|
|
|
|
# define asprintf ompi_asprintf
|
|
|
|
#endif
|
2004-08-19 23:27:15 +04:00
|
|
|
|
2004-08-11 02:41:17 +04:00
|
|
|
#ifndef HAVE_SNPRINTF
|
|
|
|
# define snprintf ompi_snprintf
|
|
|
|
#endif
|
2004-08-19 23:27:15 +04:00
|
|
|
|
2004-08-11 02:41:17 +04:00
|
|
|
#ifndef HAVE_VASPRINTF
|
|
|
|
# define vasprintf ompi_vasprintf
|
|
|
|
#endif
|
2004-08-19 23:27:15 +04:00
|
|
|
|
2004-08-11 02:41:17 +04:00
|
|
|
#ifndef HAVE_VSNPRINTF
|
|
|
|
# define vsnprintf ompi_vsnprintf
|
|
|
|
#endif
|
2004-08-19 23:27:15 +04:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
2004-08-19 23:27:15 +04:00
|
|
|
}
|
|
|
|
#endif
|
2004-10-22 20:06:05 +04:00
|
|
|
|
2004-10-29 23:14:11 +04:00
|
|
|
/*
|
|
|
|
* Define __func__-preprocessor directive if the compiler does not
|
|
|
|
* already define it. Define it to __FILE__ so that we at least have
|
|
|
|
* a clue where the developer is trying to indicate where the error is
|
|
|
|
* coming from (assuming that __func__ is typically used for
|
|
|
|
* printf-style debugging).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !HAVE_DECL___FUNC__
|
|
|
|
#define __func__ __FILE__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* One windows machines, ompi_errno will already be defined
|
|
|
|
*/
|
|
|
|
|
2004-10-28 23:12:45 +04:00
|
|
|
#ifndef ompi_errno
|
|
|
|
#define ompi_errno errno
|
|
|
|
#endif
|
2004-10-22 20:06:05 +04:00
|
|
|
|
|
|
|
#endif /* OMPI_CONFIG_BOTTOM_H */
|