Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
global_order.h
Go to the documentation of this file.
1
13#ifndef GLOBAL_ORDER_H
14#define GLOBAL_ORDER_H
15
16#include <cstdint>
17#include <span>
18#include <utility>
19#include <vector>
20
31 public:
32 GlobalOrder() = default;
33
35 GlobalOrder(std::span<const uint64_t> ids, uint64_t n_global, bool distributed);
36
37 uint64_t n_global() const { return n_global_; }
38 uint64_t first() const { return first_; }
39 uint64_t size() const { return n_block; }
40
45 template <typename T>
46 std::vector<T> gather(std::span<const T> values, uint32_t width) const;
47
52 std::pair<std::vector<uint64_t>, std::vector<uint64_t>> gather_csr(std::span<const uint64_t> offsets,
53 std::span<const uint64_t> values) const;
54
55 private:
56 bool distributed = false;
57 uint64_t n_global_ = 0, first_ = 0, n_block = 0;
58 std::vector<std::vector<uint32_t>> send_items; // per rank: the items it gets, in order
59 std::vector<uint64_t> slot; // per received item: its row in the block
60};
61
62#endif // GLOBAL_ORDER_H
Items (cells, nodes) spread over the ranks, each with a global id in [0, n_global),...
Definition global_order.h:30
uint64_t size() const
Definition global_order.h:39
GlobalOrder()=default
uint64_t first() const
Definition global_order.h:38
std::vector< T > gather(std::span< const T > values, uint32_t width) const
This rank's block, width values per id, from the values (width per item) of the plan's items (collect...
Definition global_order.cpp:56
std::pair< std::vector< uint64_t >, std::vector< uint64_t > > gather_csr(std::span< const uint64_t > offsets, std::span< const uint64_t > values) const
Like gather, for items of different lengths (CSR offsets into values); returns the block's offsets (f...
Definition global_order.cpp:73
uint64_t n_global() const
Definition global_order.h:37
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32