2
0
mirror of https://github.com/boostorg/mpi.git synced 2026-01-19 04:22:10 +00:00

Merge pull request #154 from boostorg/150-i-need-to-call-mpi_type_free-mannually-to-avoid-yakasa-warnings

Make sure we free the Boost.MPI type built for C++ bool (sice there i…
This commit is contained in:
Alain Miniussi
2023-09-18 18:21:41 +02:00
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@@ -320,6 +320,7 @@ BOOST_MPI_DATATYPE(signed char, MPI_SIGNED_CHAR, builtin);
namespace detail {
inline MPI_Datatype build_mpi_datatype_for_bool()
{
// this is explicitly freed in mpi_datatype_map::clear
MPI_Datatype type;
MPI_Type_contiguous(sizeof(bool), MPI_BYTE, &type);
MPI_Type_commit(&type);

View File

@@ -8,6 +8,7 @@
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/mpi/detail/mpi_datatype_cache.hpp>
#include <boost/mpi/datatype.hpp>
#include <map>
namespace boost { namespace mpi { namespace detail {
@@ -34,6 +35,9 @@ namespace boost { namespace mpi { namespace detail {
// ignore errors in the destructor
for (stored_map_type::iterator it=impl->map.begin(); it != impl->map.end(); ++it)
MPI_Type_free(&(it->second));
// We explicitly created this one, as there is no equivalent in the MPI standard
MPI_Datatype bool_type = get_mpi_datatype(bool());
MPI_Type_free(&bool_type);
}
}