config.hpp 6.0 KB

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