Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
rectlist.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18// rectangle lists for Realm partitioning
19
20#ifndef REALM_DEPPART_RECTLIST_H
21#define REALM_DEPPART_RECTLIST_H
22
23#include "realm/indexspace.h"
24
25namespace Realm {
26
27 // although partitioning operations eventually generate SparsityMap's, we work with
28 // various intermediates that try to keep things from turning into one big bitmask
29
30 // the CoverageCounter just counts the number of points that get added to it
31 // it's not even smart enough to eliminate duplicates
32 template <int N, typename T>
34 public:
36
37 void add_point(const Point<N, T> &p);
38
39 void add_rect(const Rect<N, T> &r);
40
41 size_t get_count(void) const;
42
43 protected:
44 size_t count;
45 };
46
47 // NOTE: the DenseRectangleList does NOT guarantee to remove all duplicate
48 // entries - some merging is done opportunistically to keep the list size
49 // down, but we don't pay for perfect de-duplication here
50 template <int N, typename T>
52 public:
53 DenseRectangleList(size_t _max_rects = 0);
54
55 void add_point(const Point<N, T> &p);
56
57 void add_rect(const Rect<N, T> &r);
58
59 void merge_rects(size_t upper_bound);
60
61 std::vector<Rect<N, T>> rects;
62 size_t max_rects;
64 };
65
66 template <int N, typename T>
67 std::ostream &operator<<(std::ostream &os, const DenseRectangleList<N, T> &drl);
68
69 template <int N, typename T>
71 public:
72 static const size_t HIGH_WATER_MARK = 64;
73 static const size_t LOW_WATER_MARK = 16;
74
76
77 void add_point(const Point<N, T> &p);
78
79 void add_rect(const Rect<N, T> &r);
80
81 const std::vector<Rect<N, T>> &convert_to_vector(void);
82
83 // std::vector<Rect<N,T> > as_vector;
85 // std::multimap<T, Rect<N,T> > as_mmap;
86 };
87
88 template <int N, typename T>
89 std::ostream &operator<<(std::ostream &os, const HybridRectangleList<N, T> &hrl);
90
91}; // namespace Realm
92
93#endif // REALM_DEPPART_RECTLIST_H
94
95#include "realm/deppart/rectlist.inl"
Definition rectlist.h:33
size_t count
Definition rectlist.h:44
void add_point(const Point< N, T > &p)
void add_rect(const Rect< N, T > &r)
size_t get_count(void) const
Definition rectlist.h:51
void merge_rects(size_t upper_bound)
DenseRectangleList(size_t _max_rects=0)
size_t max_rects
Definition rectlist.h:62
void add_point(const Point< N, T > &p)
std::vector< Rect< N, T > > rects
Definition rectlist.h:61
void add_rect(const Rect< N, T > &r)
int merge_dim
Definition rectlist.h:63
Definition rectlist.h:70
static const size_t LOW_WATER_MARK
Definition rectlist.h:73
static const size_t HIGH_WATER_MARK
Definition rectlist.h:72
void add_rect(const Rect< N, T > &r)
void add_point(const Point< N, T > &p)
DenseRectangleList< N, T > as_vector
Definition rectlist.h:84
const std::vector< Rect< N, T > > & convert_to_vector(void)
Definition activemsg.h:38
std::ostream & operator<<(std::ostream &os, const DenseRectangleList< N, T > &drl)
Definition point.h:55
Definition point.h:143