update boost on linux
This commit is contained in:
40
linx64/include/boost/mpi/detail/antiques.hpp
Normal file
40
linx64/include/boost/mpi/detail/antiques.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright Alain Miniussi 2014.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Alain Miniussi
|
||||
|
||||
#ifndef BOOST_MPI_ANTIQUES_HPP
|
||||
#define BOOST_MPI_ANTIQUES_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Support for some obsolette compilers
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
namespace detail {
|
||||
// Some old gnu compiler have no support for vector<>::data
|
||||
// Use this in the mean time, the cumbersome syntax should
|
||||
// serve as an incentive to get rid of this when those compilers
|
||||
// are dropped.
|
||||
template <typename T, typename A>
|
||||
T* c_data(std::vector<T,A>& v) { return &(v[0]); }
|
||||
|
||||
template <typename T, typename A>
|
||||
T const* c_data(std::vector<T,A> const& v) { return &(v[0]); }
|
||||
|
||||
// Some old MPI implementation (OpenMPI 1.6 for example) have non
|
||||
// conforming API w.r.t. constness.
|
||||
// We choose to fix this trhough this converter in order to
|
||||
// explain/remember why we're doing this and remove it easilly
|
||||
// when support for those MPI is dropped.
|
||||
// The fix is as specific (un templatized, for one) as possible
|
||||
// in order to encourage it usage for the probleme at hand.
|
||||
// Problematic API include MPI_Send
|
||||
inline
|
||||
void *unconst(void const* addr) { return const_cast<void*>(addr); }
|
||||
|
||||
} } }
|
||||
|
||||
#endif
|
||||
@@ -47,7 +47,12 @@ public:
|
||||
{
|
||||
return size_ = buffer_.size();
|
||||
}
|
||||
|
||||
|
||||
const std::size_t* size_ptr() const
|
||||
{
|
||||
return &size();
|
||||
}
|
||||
|
||||
void save_binary(void const *address, std::size_t count)
|
||||
{
|
||||
save_impl(address,count);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace std{
|
||||
|
||||
#include <boost/mpi/datatype_fwd.hpp>
|
||||
#include <boost/mpi/exception.hpp>
|
||||
#include <boost/mpi/detail/antiques.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
@@ -28,6 +29,7 @@ namespace std{
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <boost/mpi/detail/antiques.hpp>
|
||||
|
||||
namespace boost { namespace mpi { namespace detail {
|
||||
|
||||
@@ -79,18 +81,18 @@ public:
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_create_struct,
|
||||
(
|
||||
addresses.size(),
|
||||
get_data(lengths),
|
||||
get_data(addresses),
|
||||
get_data(types),
|
||||
c_data(lengths),
|
||||
c_data(addresses),
|
||||
c_data(types),
|
||||
&datatype_
|
||||
));
|
||||
#else
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_struct,
|
||||
(
|
||||
addresses.size(),
|
||||
get_data(lengths),
|
||||
get_data(addresses),
|
||||
get_data(types),
|
||||
c_data(lengths),
|
||||
c_data(addresses),
|
||||
c_data(types),
|
||||
&datatype_
|
||||
));
|
||||
#endif
|
||||
|
||||
47
linx64/include/boost/mpi/detail/offsets.hpp
Normal file
47
linx64/include/boost/mpi/detail/offsets.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright Alain Miniussi 2014.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Alain Miniussi
|
||||
|
||||
#ifndef BOOST_MPI_OFFSETS_HPP
|
||||
#define BOOST_MPI_OFFSETS_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <boost/mpi/communicator.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
namespace detail {
|
||||
|
||||
// Convert a sequence of sizes [S0..Sn] to a sequence displacement
|
||||
// [O0..On] where O[0] = 0 and O[k+1] = O[k]+S[k].
|
||||
void sizes2offsets(int const* sizes, int* offsets, int n);
|
||||
|
||||
// Same as size2offset(sizes.data(), offsets.data(), sizes.size())
|
||||
void sizes2offsets(std::vector<int> const& sizes, std::vector<int>& offsets);
|
||||
|
||||
// Given a sequence of sizes (typically the number of records dispatched
|
||||
// to each process in a scater) and a sequence of displacements (typically the
|
||||
// slot index at with those record starts), convert the later to a number
|
||||
// of skipped slots.
|
||||
void offsets2skipped(int const* sizes, int const* offsets, int* skipped, int n);
|
||||
|
||||
// Reconstruct offsets from sizes assuming no padding.
|
||||
// Only takes place if on the root process and if
|
||||
// displs are not already provided.
|
||||
// If memory was allocated, returns a pointer to it
|
||||
// otherwise null.
|
||||
int* make_offsets(communicator const& comm, int const* sizes, int const* displs, int root = -1);
|
||||
|
||||
// Reconstruct skip slots from sizes and offsets.
|
||||
// Only takes place if on the root process and if
|
||||
// displs are provided.
|
||||
// If memory was allocated, returns a pointer to it
|
||||
// otherwise null.
|
||||
int* make_skipped_slots(communicator const& comm, int const* sizes, int const* displs, int root = -1);
|
||||
|
||||
}
|
||||
}}// end namespace boost::mpi
|
||||
|
||||
#endif // BOOST_MPI_OFFSETS_HPP
|
||||
@@ -14,9 +14,10 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpi/datatype.hpp>
|
||||
#include <boost/mpi/exception.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/mpi/detail/antiques.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <vector>
|
||||
#include <boost/mpi/detail/antiques.hpp>
|
||||
#include <boost/mpi/allocator.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
@@ -103,12 +104,7 @@ private:
|
||||
void load_impl(void * p, MPI_Datatype t, int l)
|
||||
{
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Unpack,
|
||||
(get_data(buffer_), buffer_.size(), &position, p, l, t, comm));
|
||||
}
|
||||
|
||||
static buffer_type::value_type* get_data(buffer_type& b)
|
||||
{
|
||||
return b.empty() ? 0 : &(b[0]);
|
||||
(const_cast<char*>(detail::c_data(buffer_)), buffer_.size(), &position, p, l, t, comm));
|
||||
}
|
||||
|
||||
buffer_type & buffer_;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <boost/mpi/config.hpp>
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/mpi/datatype.hpp>
|
||||
#include <boost/mpi/exception.hpp>
|
||||
#include <boost/mpi/detail/antiques.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <vector>
|
||||
@@ -46,6 +46,11 @@ public:
|
||||
return size_ = buffer_.size();
|
||||
}
|
||||
|
||||
const std::size_t* size_ptr() const
|
||||
{
|
||||
return &size();
|
||||
}
|
||||
|
||||
void save_binary(void const *address, std::size_t count)
|
||||
{
|
||||
save_impl(address,MPI_BYTE,count);
|
||||
@@ -97,7 +102,10 @@ private:
|
||||
|
||||
// pack the data into the buffer
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Pack,
|
||||
(const_cast<void*>(p), l, t, get_data(buffer_), buffer_.size(), &position, comm));
|
||||
(const_cast<void*>(p),l,t,
|
||||
detail::c_data(buffer_),
|
||||
buffer_.size(),
|
||||
&position,comm));
|
||||
// reduce the buffer size if needed
|
||||
BOOST_ASSERT(std::size_t(position) <= buffer_.size());
|
||||
if (std::size_t(position) < buffer_.size())
|
||||
|
||||
Reference in New Issue
Block a user