70 if (
sizeof(
value_type) * n > std::numeric_limits<MPI_Aint>::max()) {
71 throw std::runtime_error(
"Requested allocation exceeds MPI address size.");
73 MPI_Aint alloc_size =
static_cast<MPI_Aint
>(
sizeof(
value_type) * n);
74 int err = MPI_Alloc_mem(alloc_size, MPI_INFO_NULL, &ptr);
92template <
typename T,
typename U>
93bool operator==(MPIAllocator<T>
const&, MPIAllocator<U>
const&)
noexcept {
97template <
typename T,
typename U>
98bool operator!=(MPIAllocator<T>
const&, MPIAllocator<U>
const&)
noexcept {
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
std::true_type propagate_on_container_move_assignment
the memory "ownership" can be moved when the container is move-assigned. If this would not be the cas...
Definition allocator.hpp:59
T * allocate(size_t n)
Allocates n * sizeof(T) bytes using MPI allocation functions.
Definition allocator.hpp:68
std::true_type is_always_equal
memory allocated by one allocator instance can always be dellocated by another and vice-versa
Definition allocator.hpp:63
MPIAllocator(MPIAllocator< U > const &) noexcept
Copy constructor for allocators with different value type.
Definition allocator.hpp:50
void deallocate(T *p, size_t)
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier c...
Definition allocator.hpp:82
T value_type
The value type.
Definition allocator.hpp:53
#define THROW_IF_MPI_ERROR(error_code, function)
Wrapper around THROWING_KASSERT for MPI errors.
Definition error_handling.hpp:33