config.hpp 5.9 KB

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