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