config.hpp 5.9 KB

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