Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:57

0001 //          Copyright Alain Miniussi 2014.
0002 // Distributed under the Boost Software License, Version 1.0.
0003 //    (See accompanying file LICENSE_1_0.txt or copy at
0004 //          http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 // Authors: Alain Miniussi
0007 
0008 #ifndef BOOST_MPI_OFFSETS_HPP
0009 #define BOOST_MPI_OFFSETS_HPP
0010 
0011 #include <vector>
0012 #include <boost/mpi/config.hpp>
0013 #include <boost/mpi/communicator.hpp>
0014 
0015 namespace boost { namespace mpi {
0016 namespace detail {
0017 
0018 // Convert a sequence of sizes [S0..Sn] to a sequence displacement 
0019 // [O0..On] where O[0] = 0 and O[k+1] = O[k]+S[k].
0020 BOOST_MPI_DECL void sizes2offsets(int const* sizes, int* offsets, int n);
0021 
0022 // Same as size2offset(sizes.data(), offsets.data(), sizes.size())
0023 BOOST_MPI_DECL void sizes2offsets(std::vector<int> const& sizes, std::vector<int>& offsets);
0024 
0025 // Given a sequence of sizes (typically the number of records dispatched
0026 // to each process in a scater) and a sequence of displacements (typically the
0027 // slot index at with those record starts), convert the later to a number 
0028 // of skipped slots.
0029 void offsets2skipped(int const* sizes, int const* offsets, int* skipped, int n);
0030 
0031 // Reconstruct offsets from sizes assuming no padding.
0032 // Only takes place if on the root process and if 
0033 // displs are not already provided.
0034 // If memory was allocated, returns a pointer to it
0035 // otherwise null.
0036 BOOST_MPI_DECL int* make_offsets(communicator const& comm, int const* sizes, int const* displs, int root = -1);
0037 
0038 // Reconstruct skip slots from sizes and offsets.
0039 // Only takes place if on the root process and if 
0040 // displs are provided.
0041 // If memory was allocated, returns a pointer to it
0042 // otherwise null.
0043 int* make_skipped_slots(communicator const& comm, int const* sizes, int const* displs, int root = -1);
0044 
0045 }
0046 }}// end namespace boost::mpi
0047 
0048 #endif // BOOST_MPI_OFFSETS_HPP