config.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 Define this macro to avoid expensice MPI_Pack/Unpack calls on
  19. * homogeneous machines.
  20. */
  21. //#define BOOST_MPI_HOMOGENEOUS
  22. // If this is an MPI-2 implementation, define configuration macros for
  23. // the features we are interested in.
  24. #if defined(MPI_VERSION) && MPI_VERSION >= 2
  25. /** @brief Determine if the MPI implementation has support for memory
  26. * allocation.
  27. *
  28. * This macro will be defined when the underlying MPI implementation
  29. * has support for the MPI-2 memory allocation routines @c
  30. * MPI_Alloc_mem and @c MPI_Free_mem. When defined, the @c allocator
  31. * class template will provide Standard Library-compliant access to
  32. * these memory-allocation routines.
  33. */
  34. # define BOOST_MPI_HAS_MEMORY_ALLOCATION
  35. /** @brief Determine if the MPI implementation has supports initialization
  36. * without command-line arguments.
  37. *
  38. * This macro will be defined when the underlying implementation
  39. * supports initialization of MPI without passing along command-line
  40. * arguments, e.g., @c MPI_Init(NULL, NULL). When defined, the @c
  41. * environment class will provide a default constructor. This macro is
  42. * always defined for MPI-2 implementations. */
  43. # define BOOST_MPI_HAS_NOARG_INITIALIZATION
  44. #else
  45. // If this is an MPI-1.x implementation, no arg initialization for
  46. // mpi environement could still be available, but not mandatory.
  47. // Undef this if no arg init is available:
  48. //# define BOOST_MPI_HAS_NOARG_INITIALIZATION
  49. #endif
  50. #if defined(MPIAPI)
  51. # define BOOST_MPI_CALLING_CONVENTION MPIAPI
  52. #else
  53. /** @brief Specifies the calling convention that will be used for callbacks
  54. * from the underlying C MPI.
  55. *
  56. * This is a Windows-specific macro, which will be used internally to state
  57. * the calling convention of any function that is to be used as a callback
  58. * from MPI. For example, the internally-defined functions that are used in
  59. * a call to @c MPI_Op_create. This macro is likely only to be useful to
  60. * users that wish to bypass Boost.MPI, registering their own callbacks in
  61. * certain cases, e.g., through @c MPI_Op_create.
  62. */
  63. # define BOOST_MPI_CALLING_CONVENTION
  64. #endif
  65. #if defined(LAM_MPI)
  66. // Configuration for LAM/MPI
  67. # define BOOST_MPI_HAS_MEMORY_ALLOCATION
  68. # define BOOST_MPI_HAS_NOARG_INITIALIZATION
  69. #elif defined(MPICH_NAME)
  70. // Configuration for MPICH
  71. #endif
  72. /*****************************************************************************
  73. * *
  74. * DLL import/export options *
  75. * *
  76. *****************************************************************************/
  77. #if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_MPI_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_MPI_STATIC_LINK)
  78. # if defined(BOOST_MPI_SOURCE)
  79. # define BOOST_MPI_DECL __declspec(dllexport)
  80. # define BOOST_MPI_BUILD_DLL
  81. # else
  82. # define BOOST_MPI_DECL __declspec(dllimport)
  83. # endif
  84. #endif
  85. #ifndef BOOST_MPI_DECL
  86. # define BOOST_MPI_DECL
  87. #endif
  88. #if !defined(BOOST_MPI_NO_LIB) && !defined(BOOST_MPI_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
  89. # define BOOST_LIB_NAME boost_mpi
  90. # if defined(BOOST_MPI_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
  91. # define BOOST_DYN_LINK
  92. # endif
  93. # ifdef BOOST_MPI_DIAG
  94. # define BOOST_LIB_DIAGNOSTIC
  95. # endif
  96. # include <boost/config/auto_link.hpp>
  97. #endif
  98. #endif // BOOST_MPI_CONFIG_HPP