Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
growing_buffer.h
Go to the documentation of this file.
1
12#ifndef GROWING_BUFFER_H
13#define GROWING_BUFFER_H
14
15#include <cstddef>
16#include <vector>
17
27 public:
28 static bool supported();
29
31 explicit GrowingBuffer(size_t max_bytes);
33 GrowingBuffer(const GrowingBuffer &) = delete;
35
37 void ensure(size_t bytes);
38
39 void * data() const { return reinterpret_cast<void *>(base); }
40
41 private:
42 unsigned long long base = 0;
43 [[maybe_unused]] size_t reserved = 0;
44 [[maybe_unused]] size_t mapped = 0;
45 [[maybe_unused]] size_t granularity = 0;
46 [[maybe_unused]] int device = 0;
47 std::vector<unsigned long long> handles;
48 std::vector<size_t> sizes; // of each handle's mapping, in address order
49};
50
51#endif // GROWING_BUFFER_H
Device memory at a fixed address whose backing grows as it fills: a reserved virtual address range wi...
Definition growing_buffer.h:26
void * data() const
Definition growing_buffer.h:39
static bool supported()
Definition growing_buffer.cpp:130
~GrowingBuffer()
Definition growing_buffer.cpp:134
GrowingBuffer(const GrowingBuffer &)=delete
GrowingBuffer & operator=(const GrowingBuffer &)=delete
void ensure(size_t bytes)
Map pages so that the first bytes are backed by device memory.
Definition growing_buffer.cpp:136
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
size_t bytes
Definition teno_setup.cpp:1793