Imported Upstream version 1.72.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 Comment this macro is you are running in an heterogeneous environment.
24  *
25  * When this flag is enabled, we assume some simple, POD-like, type can be 
26  * transmitted without paying the cost of portable serialization. 
27  *
28  * Comment this if your platform is not homogeneous and that portable 
29  * serialization/deserialization must be performed.
30  *
31  * It you do so, check that your MPI implementation supports thats kind of environment.
32  */
33 #define BOOST_MPI_HOMOGENEOUS
34
35 #if defined MPI_VERSION
36 /** @brief Major version of the underlying MPI implementation supproted standard.
37  * 
38  * If, for some reason, MPI_VERSION is not supported, you should probably set that
39  * according to your MPI documentation
40  */
41 # define BOOST_MPI_VERSION MPI_VERSION
42 #else 
43 // assume a safe default
44 # define BOOST_MPI_VERSION 2
45 #endif
46
47 #if defined MPI_SUBVERSION
48 /** @brief Major version of the underlying MPI implementation supported standard.
49  * 
50  * If, for some reason, MPI_SUBVERSION is not supported, you should probably set that
51  * according to your MPI documentation
52  */
53 # define BOOST_MPI_SUBVERSION MPI_SUBVERSION
54 #else 
55 // assume a safe default
56 # define BOOST_MPI_SUBVERSION 2
57 #endif
58
59 // If this is an MPI-2 implementation, define configuration macros for
60 // the features we are interested in.
61 #if BOOST_MPI_VERSION >= 2
62 /** @brief Determine if the MPI implementation has support for memory
63  *  allocation.
64  *
65  *  This macro will be defined when the underlying MPI implementation
66  *  has support for the MPI-2 memory allocation routines @c
67  *  MPI_Alloc_mem and @c MPI_Free_mem. When defined, the @c allocator
68  *  class template will provide Standard Library-compliant access to
69  *  these memory-allocation routines.
70  */
71 #  define BOOST_MPI_HAS_MEMORY_ALLOCATION
72
73 /** @brief Determine if the MPI implementation has supports initialization 
74  *  without command-line arguments.
75  *
76  *  This macro will be defined when the underlying implementation
77  *  supports initialization of MPI without passing along command-line
78  *  arguments, e.g., @c MPI_Init(NULL, NULL). When defined, the @c
79  *  environment class will provide a default constructor. This macro is 
80  *  always defined for MPI-2 implementations. */
81 #  define BOOST_MPI_HAS_NOARG_INITIALIZATION
82 #else
83 // If this is an MPI-1.x implementation, no arg initialization for
84 // mpi environment could still be available, but not mandatory.
85 // Undef this if no arg init is available:
86 //#  define BOOST_MPI_HAS_NOARG_INITIALIZATION
87 #endif
88
89 #if defined(MPIAPI)
90 #  define BOOST_MPI_CALLING_CONVENTION MPIAPI
91 #else
92 /** @brief Specifies the calling convention that will be used for callbacks
93  *  from the underlying C MPI. 
94  *
95  *  This is a Windows-specific macro, which will be used internally to state
96  *  the calling convention of any function that is to be used as a callback
97  *  from MPI. For example, the internally-defined functions that are used in
98  *  a call to @c MPI_Op_create. This macro is likely only to be useful to
99  *  users that wish to bypass Boost.MPI, registering their own callbacks in
100  *  certain cases, e.g., through @c MPI_Op_create.
101  */
102 #  define BOOST_MPI_CALLING_CONVENTION
103 #endif
104
105 /** @brief Indicates that MPI_Bcast supports MPI_BOTTOM.
106  *
107  * Some implementations have a broken MPI_Bcast wrt to MPI_BOTTOM.
108  * BullX MPI and LAM seems to be among them, at least for some versions.
109  * The `broacast_test.cpp` test `test_skeleton_and_content` can be used to 
110  * detect that.
111  */
112 #define BOOST_MPI_BCAST_BOTTOM_WORKS_FINE
113
114 #if defined(LAM_MPI)
115 // Configuration for LAM/MPI
116 #  define BOOST_MPI_HAS_MEMORY_ALLOCATION
117 #  define BOOST_MPI_HAS_NOARG_INITIALIZATION
118 #  undef  BOOST_MPI_BCAST_BOTTOM_WORKS_FINE
119 #endif
120
121 #if defined(MPICH_NAME)
122 // Configuration for MPICH
123 #endif
124
125 #if defined(OPEN_MPI)
126 // We do not want to import C++ binding
127 #define OMPI_BUILD_CXX_BINDINGS 1
128 #endif
129
130 #if BOOST_MPI_VERSION >= 3 
131 // MPI_Probe an friends should work
132 #  if defined(I_MPI_NUMVERSION)
133 // Excepted for some Intel versions.
134 // Note that I_MPI_NUMVERSION is not always defined with Intel.
135 #    if I_MPI_NUMVERSION > 20190004000
136 #      define BOOST_MPI_USE_IMPROBE 1
137 #    endif
138 #  else
139 #    define BOOST_MPI_USE_IMPROBE 1
140 #  endif
141 #endif
142
143 /*****************************************************************************
144  *                                                                           *
145  *  DLL import/export options                                                *  
146  *                                                                           *
147  *****************************************************************************/
148
149 #if (defined(BOOST_MPI_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_MPI_STATIC_LINK)
150 #  if defined(BOOST_MPI_SOURCE)
151 #     define BOOST_MPI_DECL BOOST_SYMBOL_EXPORT
152 #     define BOOST_MPI_BUILD_DLL
153 #  else
154 #     define BOOST_MPI_DECL BOOST_SYMBOL_IMPORT
155 #  endif
156 #endif
157
158 #ifndef BOOST_MPI_DECL
159 #  define BOOST_MPI_DECL
160 #endif
161
162 #if !defined(BOOST_MPI_NO_LIB) && !defined(BOOST_MPI_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
163 #  define BOOST_LIB_NAME boost_mpi
164 #  if defined(BOOST_MPI_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
165 #     define BOOST_DYN_LINK
166 #  endif
167 #  ifdef BOOST_MPI_DIAG
168 #     define BOOST_LIB_DIAGNOSTIC
169 #  endif
170 #  include <boost/config/auto_link.hpp>
171 #endif
172
173 #endif // BOOST_MPI_CONFIG_HPP