Imported Upstream version 1.49.0
[platform/upstream/boost.git] / boost / mpi / config.hpp
1 // Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>
2
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 /** @file config.hpp
8  *
9  *  This header provides MPI configuration details that expose the
10  *  capabilities of the underlying MPI implementation, and provides
11  *  auto-linking support on Windows.
12  */
13 #ifndef BOOST_MPI_CONFIG_HPP
14 #define BOOST_MPI_CONFIG_HPP
15
16 /* Force MPICH not to define SEEK_SET, SEEK_CUR, and SEEK_END, which
17    conflict with the versions in <stdio.h> and <cstdio>. */
18 #define MPICH_IGNORE_CXX_SEEK 1
19
20 #include <mpi.h>
21 #include <boost/config.hpp>
22
23 /** @brief Define this macro to avoid expensice MPI_Pack/Unpack calls on 
24  *  homogeneous machines.
25 */
26 //#define BOOST_MPI_HOMOGENEOUS
27
28 // If this is an MPI-2 implementation, define configuration macros for
29 // the features we are interested in.
30 #if defined(MPI_VERSION) && MPI_VERSION == 2
31 /** @brief Determine if the MPI implementation has support for memory
32  *  allocation.
33  *
34  *  This macro will be defined when the underlying MPI implementation
35  *  has support for the MPI-2 memory allocation routines @c
36  *  MPI_Alloc_mem and @c MPI_Free_mem. When defined, the @c allocator
37  *  class template will provide Standard Library-compliant access to
38  *  these memory-allocation routines.
39  */
40 #  define BOOST_MPI_HAS_MEMORY_ALLOCATION
41
42 /** @brief Determine if the MPI implementation has supports initialization 
43  *  without command-line arguments.
44  *
45  *  This macro will be defined when the underlying implementation
46  *  supports initialization of MPI without passing along command-line
47  *  arguments, e.g., @c MPI_Init(NULL, NULL). When defined, the @c
48  *  environment class will provide a default constructor. This macro is 
49  *  always defined for MPI-2 implementations. */
50 #  define BOOST_MPI_HAS_NOARG_INITIALIZATION
51 #endif
52
53 #if defined(MPIAPI)
54 #  define BOOST_MPI_CALLING_CONVENTION MPIAPI
55 #else
56 /** @brief Specifies the calling convention that will be used for callbacks
57  *  from the underlying C MPI. 
58  *
59  *  This is a Windows-specific macro, which will be used internally to state
60  *  the calling convention of any function that is to be used as a callback
61  *  from MPI. For example, the internally-defined functions that are used in
62  *  a call to @c MPI_Op_create. This macro is likely only to be useful to
63  *  users that wish to bypass Boost.MPI, registering their own callbacks in
64  *  certain cases, e.g., through @c MPI_Op_create.
65  */
66 #  define BOOST_MPI_CALLING_CONVENTION
67 #endif
68
69 #if defined(LAM_MPI)
70 // Configuration for LAM/MPI
71 #  define BOOST_MPI_HAS_MEMORY_ALLOCATION
72 #  define BOOST_MPI_HAS_NOARG_INITIALIZATION
73 #elif defined(MPICH_NAME)
74 // Configuration for MPICH
75 #endif
76
77 /*****************************************************************************
78  *                                                                           *
79  *  DLL import/export options                                                *  
80  *                                                                           *
81  *****************************************************************************/
82
83 #if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_MPI_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_MPI_STATIC_LINK)
84 #  if defined(BOOST_MPI_SOURCE)
85 #     define BOOST_MPI_DECL __declspec(dllexport)
86 #     define BOOST_MPI_BUILD_DLL
87 #  else
88 #     define BOOST_MPI_DECL __declspec(dllimport)
89 #  endif
90 #endif
91
92 #ifndef BOOST_MPI_DECL
93 #  define BOOST_MPI_DECL
94 #endif
95
96 #if !defined(BOOST_MPI_NO_LIB) && !defined(BOOST_MPI_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
97 #  define BOOST_LIB_NAME boost_mpi
98 #  if defined(BOOST_MPI_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
99 #     define BOOST_DYN_LINK
100 #  endif
101 #  ifdef BOOST_MPI_DIAG
102 #     define BOOST_LIB_DIAGNOSTIC
103 #  endif
104 #  include <boost/config/auto_link.hpp>
105 #endif
106
107 #endif // BOOST_MPI_CONFIG_HPP