1 | #define SOUFFLE_GENERATOR_VERSION "39d42a366"
|
2 | #include "souffle/CompiledSouffle.h"
|
3 | #include "souffle/SignalHandler.h"
|
4 | #include "souffle/SouffleInterface.h"
|
5 | #include "souffle/datastructure/BTree.h"
|
6 | #include "souffle/io/IOSystem.h"
|
7 | #include <any>
|
8 | namespace functors {
|
9 | extern "C" {
|
10 | }
|
11 | } //namespace functors
|
12 | namespace souffle::t_btree_ii__0_1__11 {
|
13 | using namespace souffle;
|
14 | struct Type {
|
15 | static constexpr Relation::arity_type Arity = 2;
|
16 | using t_tuple = Tuple<RamDomain, 2>;
|
17 | struct t_comparator_0{
|
18 | int operator()(const t_tuple& a, const t_tuple& b) const {
|
19 | return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0])) ? -1 : (ramBitCast<RamSigned>(a[0]) > ramBitCast<RamSigned>(b[0])) ? 1 :((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])) ? -1 : (ramBitCast<RamSigned>(a[1]) > ramBitCast<RamSigned>(b[1])) ? 1 :(0));
|
20 | }
|
21 | bool less(const t_tuple& a, const t_tuple& b) const {
|
22 | return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))));
|
23 | }
|
24 | bool equal(const t_tuple& a, const t_tuple& b) const {
|
25 | return (ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0]))&&(ramBitCast<RamSigned>(a[1]) == ramBitCast<RamSigned>(b[1]));
|
26 | }
|
27 | };
|
28 | using t_ind_0 = btree_set<t_tuple,t_comparator_0>;
|
29 | t_ind_0 ind_0;
|
30 | using iterator = t_ind_0::iterator;
|
31 | struct context {
|
32 | t_ind_0::operation_hints hints_0_lower;
|
33 | t_ind_0::operation_hints hints_0_upper;
|
34 | };
|
35 | context createContext() { return context(); }
|
36 | bool insert(const t_tuple& t);
|
37 | bool insert(const t_tuple& t, context& h);
|
38 | bool insert(const RamDomain* ramDomain);
|
39 | bool insert(RamDomain a0,RamDomain a1);
|
40 | bool contains(const t_tuple& t, context& h) const;
|
41 | bool contains(const t_tuple& t) const;
|
42 | std::size_t size() const;
|
43 | iterator find(const t_tuple& t, context& h) const;
|
44 | iterator find(const t_tuple& t) const;
|
45 | range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const;
|
46 | range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const;
|
47 | range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const;
|
48 | range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const;
|
49 | bool empty() const;
|
50 | std::vector<range<iterator>> partition() const;
|
51 | void purge();
|
52 | iterator begin() const;
|
53 | iterator end() const;
|
54 | void printStatistics(std::ostream& o) const;
|
55 | };
|
56 | } // namespace souffle::t_btree_ii__0_1__11
|
57 | namespace souffle::t_btree_ii__0_1__11 {
|
58 | using namespace souffle;
|
59 | using t_ind_0 = Type::t_ind_0;
|
60 | using iterator = Type::iterator;
|
61 | using context = Type::context;
|
62 | bool Type::insert(const t_tuple& t) {
|
63 | context h;
|
64 | return insert(t, h);
|
65 | }
|
66 | bool Type::insert(const t_tuple& t, context& h) {
|
67 | if (ind_0.insert(t, h.hints_0_lower)) {
|
68 | return true;
|
69 | } else return false;
|
70 | }
|
71 | bool Type::insert(const RamDomain* ramDomain) {
|
72 | RamDomain data[2];
|
73 | std::copy(ramDomain, ramDomain + 2, data);
|
74 | const t_tuple& tuple = reinterpret_cast<const t_tuple&>(data);
|
75 | context h;
|
76 | return insert(tuple, h);
|
77 | }
|
78 | bool Type::insert(RamDomain a0,RamDomain a1) {
|
79 | RamDomain data[2] = {a0,a1};
|
80 | return insert(data);
|
81 | }
|
82 | bool Type::contains(const t_tuple& t, context& h) const {
|
83 | return ind_0.contains(t, h.hints_0_lower);
|
84 | }
|
85 | bool Type::contains(const t_tuple& t) const {
|
86 | context h;
|
87 | return contains(t, h);
|
88 | }
|
89 | std::size_t Type::size() const {
|
90 | return ind_0.size();
|
91 | }
|
92 | iterator Type::find(const t_tuple& t, context& h) const {
|
93 | return ind_0.find(t, h.hints_0_lower);
|
94 | }
|
95 | iterator Type::find(const t_tuple& t) const {
|
96 | context h;
|
97 | return find(t, h);
|
98 | }
|
99 | range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const {
|
100 | return range<iterator>(ind_0.begin(),ind_0.end());
|
101 | }
|
102 | range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const {
|
103 | return range<iterator>(ind_0.begin(),ind_0.end());
|
104 | }
|
105 | range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const {
|
106 | t_comparator_0 comparator;
|
107 | int cmp = comparator(lower, upper);
|
108 | if (cmp == 0) {
|
109 | auto pos = ind_0.find(lower, h.hints_0_lower);
|
110 | auto fin = ind_0.end();
|
111 | if (pos != fin) {fin = pos; ++fin;}
|
112 | return make_range(pos, fin);
|
113 | }
|
114 | if (cmp > 0) {
|
115 | return make_range(ind_0.end(), ind_0.end());
|
116 | }
|
117 | return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
|
118 | }
|
119 | range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const {
|
120 | context h;
|
121 | return lowerUpperRange_11(lower,upper,h);
|
122 | }
|
123 | bool Type::empty() const {
|
124 | return ind_0.empty();
|
125 | }
|
126 | std::vector<range<iterator>> Type::partition() const {
|
127 | return ind_0.getChunks(400);
|
128 | }
|
129 | void Type::purge() {
|
130 | ind_0.clear();
|
131 | }
|
132 | iterator Type::begin() const {
|
133 | return ind_0.begin();
|
134 | }
|
135 | iterator Type::end() const {
|
136 | return ind_0.end();
|
137 | }
|
138 | void Type::printStatistics(std::ostream& o) const {
|
139 | o << " arity 2 direct b-tree index 0 lex-order [0,1]\n";
|
140 | ind_0.printStats(o);
|
141 | }
|
142 | } // namespace souffle::t_btree_ii__0_1__11
|
143 | namespace souffle::t_btree_ii__0_1__11__10 {
|
144 | using namespace souffle;
|
145 | struct Type {
|
146 | static constexpr Relation::arity_type Arity = 2;
|
147 | using t_tuple = Tuple<RamDomain, 2>;
|
148 | struct t_comparator_0{
|
149 | int operator()(const t_tuple& a, const t_tuple& b) const {
|
150 | return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0])) ? -1 : (ramBitCast<RamSigned>(a[0]) > ramBitCast<RamSigned>(b[0])) ? 1 :((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])) ? -1 : (ramBitCast<RamSigned>(a[1]) > ramBitCast<RamSigned>(b[1])) ? 1 :(0));
|
151 | }
|
152 | bool less(const t_tuple& a, const t_tuple& b) const {
|
153 | return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))));
|
154 | }
|
155 | bool equal(const t_tuple& a, const t_tuple& b) const {
|
156 | return (ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0]))&&(ramBitCast<RamSigned>(a[1]) == ramBitCast<RamSigned>(b[1]));
|
157 | }
|
158 | };
|
159 | using t_ind_0 = btree_set<t_tuple,t_comparator_0>;
|
160 | t_ind_0 ind_0;
|
161 | using iterator = t_ind_0::iterator;
|
162 | struct context {
|
163 | t_ind_0::operation_hints hints_0_lower;
|
164 | t_ind_0::operation_hints hints_0_upper;
|
165 | };
|
166 | context createContext() { return context(); }
|
167 | bool insert(const t_tuple& t);
|
168 | bool insert(const t_tuple& t, context& h);
|
169 | bool insert(const RamDomain* ramDomain);
|
170 | bool insert(RamDomain a0,RamDomain a1);
|
171 | bool contains(const t_tuple& t, context& h) const;
|
172 | bool contains(const t_tuple& t) const;
|
173 | std::size_t size() const;
|
174 | iterator find(const t_tuple& t, context& h) const;
|
175 | iterator find(const t_tuple& t) const;
|
176 | range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const;
|
177 | range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const;
|
178 | range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const;
|
179 | range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const;
|
180 | range<t_ind_0::iterator> lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper, context& h) const;
|
181 | range<t_ind_0::iterator> lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper) const;
|
182 | bool empty() const;
|
183 | std::vector<range<iterator>> partition() const;
|
184 | void purge();
|
185 | iterator begin() const;
|
186 | iterator end() const;
|
187 | void printStatistics(std::ostream& o) const;
|
188 | };
|
189 | } // namespace souffle::t_btree_ii__0_1__11__10
|
190 | namespace souffle::t_btree_ii__0_1__11__10 {
|
191 | using namespace souffle;
|
192 | using t_ind_0 = Type::t_ind_0;
|
193 | using iterator = Type::iterator;
|
194 | using context = Type::context;
|
195 | bool Type::insert(const t_tuple& t) {
|
196 | context h;
|
197 | return insert(t, h);
|
198 | }
|
199 | bool Type::insert(const t_tuple& t, context& h) {
|
200 | if (ind_0.insert(t, h.hints_0_lower)) {
|
201 | return true;
|
202 | } else return false;
|
203 | }
|
204 | bool Type::insert(const RamDomain* ramDomain) {
|
205 | RamDomain data[2];
|
206 | std::copy(ramDomain, ramDomain + 2, data);
|
207 | const t_tuple& tuple = reinterpret_cast<const t_tuple&>(data);
|
208 | context h;
|
209 | return insert(tuple, h);
|
210 | }
|
211 | bool Type::insert(RamDomain a0,RamDomain a1) {
|
212 | RamDomain data[2] = {a0,a1};
|
213 | return insert(data);
|
214 | }
|
215 | bool Type::contains(const t_tuple& t, context& h) const {
|
216 | return ind_0.contains(t, h.hints_0_lower);
|
217 | }
|
218 | bool Type::contains(const t_tuple& t) const {
|
219 | context h;
|
220 | return contains(t, h);
|
221 | }
|
222 | std::size_t Type::size() const {
|
223 | return ind_0.size();
|
224 | }
|
225 | iterator Type::find(const t_tuple& t, context& h) const {
|
226 | return ind_0.find(t, h.hints_0_lower);
|
227 | }
|
228 | iterator Type::find(const t_tuple& t) const {
|
229 | context h;
|
230 | return find(t, h);
|
231 | }
|
232 | range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const {
|
233 | return range<iterator>(ind_0.begin(),ind_0.end());
|
234 | }
|
235 | range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const {
|
236 | return range<iterator>(ind_0.begin(),ind_0.end());
|
237 | }
|
238 | range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const {
|
239 | t_comparator_0 comparator;
|
240 | int cmp = comparator(lower, upper);
|
241 | if (cmp == 0) {
|
242 | auto pos = ind_0.find(lower, h.hints_0_lower);
|
243 | auto fin = ind_0.end();
|
244 | if (pos != fin) {fin = pos; ++fin;}
|
245 | return make_range(pos, fin);
|
246 | }
|
247 | if (cmp > 0) {
|
248 | return make_range(ind_0.end(), ind_0.end());
|
249 | }
|
250 | return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
|
251 | }
|
252 | range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const {
|
253 | context h;
|
254 | return lowerUpperRange_11(lower,upper,h);
|
255 | }
|
256 | range<t_ind_0::iterator> Type::lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper, context& h) const {
|
257 | t_comparator_0 comparator;
|
258 | int cmp = comparator(lower, upper);
|
259 | if (cmp > 0) {
|
260 | return make_range(ind_0.end(), ind_0.end());
|
261 | }
|
262 | return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
|
263 | }
|
264 | range<t_ind_0::iterator> Type::lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper) const {
|
265 | context h;
|
266 | return lowerUpperRange_10(lower,upper,h);
|
267 | }
|
268 | bool Type::empty() const {
|
269 | return ind_0.empty();
|
270 | }
|
271 | std::vector<range<iterator>> Type::partition() const {
|
272 | return ind_0.getChunks(400);
|
273 | }
|
274 | void Type::purge() {
|
275 | ind_0.clear();
|
276 | }
|
277 | iterator Type::begin() const {
|
278 | return ind_0.begin();
|
279 | }
|
280 | iterator Type::end() const {
|
281 | return ind_0.end();
|
282 | }
|
283 | void Type::printStatistics(std::ostream& o) const {
|
284 | o << " arity 2 direct b-tree index 0 lex-order [0,1]\n";
|
285 | ind_0.printStats(o);
|
286 | }
|
287 | } // namespace souffle::t_btree_ii__0_1__11__10
|
288 | namespace souffle {
|
289 | using namespace souffle;
|
290 | class Stratum_edge_9543a759b165a2cb {
|
291 | public:
|
292 | Stratum_edge_9543a759b165a2cb(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_ii__0_1__11::Type& rel_edge_04d25f5060e9043b);
|
293 | void run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret);
|
294 | private:
|
295 | SymbolTable& symTable;
|
296 | RecordTable& recordTable;
|
297 | ConcurrentCache<std::string,std::regex>& regexCache;
|
298 | bool& pruneImdtRels;
|
299 | bool& performIO;
|
300 | SignalHandler*& signalHandler;
|
301 | std::atomic<std::size_t>& iter;
|
302 | std::atomic<RamDomain>& ctr;
|
303 | std::string& inputDirectory;
|
304 | std::string& outputDirectory;
|
305 | t_btree_ii__0_1__11::Type* rel_edge_04d25f5060e9043b;
|
306 | };
|
307 | } // namespace souffle
|
308 | namespace souffle {
|
309 | using namespace souffle;
|
310 | Stratum_edge_9543a759b165a2cb::Stratum_edge_9543a759b165a2cb(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_ii__0_1__11::Type& rel_edge_04d25f5060e9043b):
|
311 | symTable(symTable),
|
312 | recordTable(recordTable),
|
313 | regexCache(regexCache),
|
314 | pruneImdtRels(pruneImdtRels),
|
315 | performIO(performIO),
|
316 | signalHandler(signalHandler),
|
317 | iter(iter),
|
318 | ctr(ctr),
|
319 | inputDirectory(inputDirectory),
|
320 | outputDirectory(outputDirectory),
|
321 | rel_edge_04d25f5060e9043b(&rel_edge_04d25f5060e9043b){
|
322 | }
|
323 |
|
324 | void Stratum_edge_9543a759b165a2cb::run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret){
|
325 | signalHandler->setMsg(R"_(edge(1,2).
|
326 | in file smoke-test.dl [3:1-3:12])_");
|
327 | [&](){
|
328 | CREATE_OP_CONTEXT(rel_edge_04d25f5060e9043b_op_ctxt,rel_edge_04d25f5060e9043b->createContext());
|
329 | Tuple<RamDomain,2> tuple{{ramBitCast(RamSigned(1)),ramBitCast(RamSigned(2))}};
|
330 | rel_edge_04d25f5060e9043b->insert(tuple,READ_OP_CONTEXT(rel_edge_04d25f5060e9043b_op_ctxt));
|
331 | }
|
332 | ();signalHandler->setMsg(R"_(edge(2,3).
|
333 | in file smoke-test.dl [4:1-4:12])_");
|
334 | [&](){
|
335 | CREATE_OP_CONTEXT(rel_edge_04d25f5060e9043b_op_ctxt,rel_edge_04d25f5060e9043b->createContext());
|
336 | Tuple<RamDomain,2> tuple{{ramBitCast(RamSigned(2)),ramBitCast(RamSigned(3))}};
|
337 | rel_edge_04d25f5060e9043b->insert(tuple,READ_OP_CONTEXT(rel_edge_04d25f5060e9043b_op_ctxt));
|
338 | }
|
339 | ();}
|
340 |
|
341 | } // namespace souffle
|
342 |
|
343 | namespace souffle {
|
344 | using namespace souffle;
|
345 | class Stratum_path_614f1ce382100c3f {
|
346 | public:
|
347 | Stratum_path_614f1ce382100c3f(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_ii__0_1__11__10::Type& rel_delta_path_23da6daa27e8b245,t_btree_ii__0_1__11__10::Type& rel_new_path_a0453b38c2806942,t_btree_ii__0_1__11::Type& rel_edge_04d25f5060e9043b,t_btree_ii__0_1__11::Type& rel_path_76cf4ab0e06a645b);
|
348 | void run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret);
|
349 | private:
|
350 | SymbolTable& symTable;
|
351 | RecordTable& recordTable;
|
352 | ConcurrentCache<std::string,std::regex>& regexCache;
|
353 | bool& pruneImdtRels;
|
354 | bool& performIO;
|
355 | SignalHandler*& signalHandler;
|
356 | std::atomic<std::size_t>& iter;
|
357 | std::atomic<RamDomain>& ctr;
|
358 | std::string& inputDirectory;
|
359 | std::string& outputDirectory;
|
360 | t_btree_ii__0_1__11__10::Type* rel_delta_path_23da6daa27e8b245;
|
361 | t_btree_ii__0_1__11__10::Type* rel_new_path_a0453b38c2806942;
|
362 | t_btree_ii__0_1__11::Type* rel_edge_04d25f5060e9043b;
|
363 | t_btree_ii__0_1__11::Type* rel_path_76cf4ab0e06a645b;
|
364 | };
|
365 | } // namespace souffle
|
366 | namespace souffle {
|
367 | using namespace souffle;
|
368 | Stratum_path_614f1ce382100c3f::Stratum_path_614f1ce382100c3f(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_ii__0_1__11__10::Type& rel_delta_path_23da6daa27e8b245,t_btree_ii__0_1__11__10::Type& rel_new_path_a0453b38c2806942,t_btree_ii__0_1__11::Type& rel_edge_04d25f5060e9043b,t_btree_ii__0_1__11::Type& rel_path_76cf4ab0e06a645b):
|
369 | symTable(symTable),
|
370 | recordTable(recordTable),
|
371 | regexCache(regexCache),
|
372 | pruneImdtRels(pruneImdtRels),
|
373 | performIO(performIO),
|
374 | signalHandler(signalHandler),
|
375 | iter(iter),
|
376 | ctr(ctr),
|
377 | inputDirectory(inputDirectory),
|
378 | outputDirectory(outputDirectory),
|
379 | rel_delta_path_23da6daa27e8b245(&rel_delta_path_23da6daa27e8b245),
|
380 | rel_new_path_a0453b38c2806942(&rel_new_path_a0453b38c2806942),
|
381 | rel_edge_04d25f5060e9043b(&rel_edge_04d25f5060e9043b),
|
382 | rel_path_76cf4ab0e06a645b(&rel_path_76cf4ab0e06a645b){
|
383 | }
|
384 |
|
385 | void Stratum_path_614f1ce382100c3f::run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret){
|
386 | signalHandler->setMsg(R"_(path(u,v) :-
|
387 | edge(u,v).
|
388 | in file smoke-test.dl [9:1-9:26])_");
|
389 | if(!(rel_edge_04d25f5060e9043b->empty())) {
|
390 | [&](){
|
391 | CREATE_OP_CONTEXT(rel_edge_04d25f5060e9043b_op_ctxt,rel_edge_04d25f5060e9043b->createContext());
|
392 | CREATE_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt,rel_path_76cf4ab0e06a645b->createContext());
|
393 | for(const auto& env0 : *rel_edge_04d25f5060e9043b) {
|
394 | Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
|
395 | rel_path_76cf4ab0e06a645b->insert(tuple,READ_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt));
|
396 | }
|
397 | }
|
398 | ();}
|
399 | [&](){
|
400 | CREATE_OP_CONTEXT(rel_delta_path_23da6daa27e8b245_op_ctxt,rel_delta_path_23da6daa27e8b245->createContext());
|
401 | CREATE_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt,rel_path_76cf4ab0e06a645b->createContext());
|
402 | for(const auto& env0 : *rel_path_76cf4ab0e06a645b) {
|
403 | Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
|
404 | rel_delta_path_23da6daa27e8b245->insert(tuple,READ_OP_CONTEXT(rel_delta_path_23da6daa27e8b245_op_ctxt));
|
405 | }
|
406 | }
|
407 | ();auto loop_counter = RamUnsigned(1);
|
408 | iter = 0;
|
409 | for(;;) {
|
410 | signalHandler->setMsg(R"_(path(u,w) :-
|
411 | edge(u,v),
|
412 | path(v,w).
|
413 | in file smoke-test.dl [10:1-10:38])_");
|
414 | if(!(rel_edge_04d25f5060e9043b->empty()) && !(rel_delta_path_23da6daa27e8b245->empty())) {
|
415 | [&](){
|
416 | CREATE_OP_CONTEXT(rel_delta_path_23da6daa27e8b245_op_ctxt,rel_delta_path_23da6daa27e8b245->createContext());
|
417 | CREATE_OP_CONTEXT(rel_new_path_a0453b38c2806942_op_ctxt,rel_new_path_a0453b38c2806942->createContext());
|
418 | CREATE_OP_CONTEXT(rel_edge_04d25f5060e9043b_op_ctxt,rel_edge_04d25f5060e9043b->createContext());
|
419 | CREATE_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt,rel_path_76cf4ab0e06a645b->createContext());
|
420 | for(const auto& env0 : *rel_edge_04d25f5060e9043b) {
|
421 | auto range = rel_delta_path_23da6daa27e8b245->lowerUpperRange_10(Tuple<RamDomain,2>{{ramBitCast(env0[1]), ramBitCast<RamDomain>(MIN_RAM_SIGNED)}},Tuple<RamDomain,2>{{ramBitCast(env0[1]), ramBitCast<RamDomain>(MAX_RAM_SIGNED)}},READ_OP_CONTEXT(rel_delta_path_23da6daa27e8b245_op_ctxt));
|
422 | for(const auto& env1 : range) {
|
423 | if( !(rel_path_76cf4ab0e06a645b->contains(Tuple<RamDomain,2>{{ramBitCast(env0[0]),ramBitCast(env1[1])}},READ_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt)))) {
|
424 | Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env1[1])}};
|
425 | rel_new_path_a0453b38c2806942->insert(tuple,READ_OP_CONTEXT(rel_new_path_a0453b38c2806942_op_ctxt));
|
426 | }
|
427 | }
|
428 | }
|
429 | }
|
430 | ();}
|
431 | if(rel_new_path_a0453b38c2806942->empty()) break;
|
432 | [&](){
|
433 | CREATE_OP_CONTEXT(rel_new_path_a0453b38c2806942_op_ctxt,rel_new_path_a0453b38c2806942->createContext());
|
434 | CREATE_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt,rel_path_76cf4ab0e06a645b->createContext());
|
435 | for(const auto& env0 : *rel_new_path_a0453b38c2806942) {
|
436 | Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
|
437 | rel_path_76cf4ab0e06a645b->insert(tuple,READ_OP_CONTEXT(rel_path_76cf4ab0e06a645b_op_ctxt));
|
438 | }
|
439 | }
|
440 | ();std::swap(rel_delta_path_23da6daa27e8b245, rel_new_path_a0453b38c2806942);
|
441 | rel_new_path_a0453b38c2806942->purge();
|
442 | loop_counter = (ramBitCast<RamUnsigned>(loop_counter) + ramBitCast<RamUnsigned>(RamUnsigned(1)));
|
443 | iter++;
|
444 | }
|
445 | iter = 0;
|
446 | rel_delta_path_23da6daa27e8b245->purge();
|
447 | rel_new_path_a0453b38c2806942->purge();
|
448 | if (performIO) {
|
449 | try {std::map<std::string, std::string> directiveMap({{"IO","file"},{"attributeNames","u\tv"},{"auxArity","0"},{"filename","path.tsv"},{"name","path"},{"operation","output"},{"output-dir","."},{"params","{\"records\": {}, \"relation\": {\"arity\": 2, \"params\": [\"u\", \"v\"]}}"},{"types","{\"ADTs\": {}, \"records\": {}, \"relation\": {\"arity\": 2, \"types\": [\"i:number\", \"i:number\"]}}"}});
|
450 | if (outputDirectory == "-"){directiveMap["IO"] = "stdout"; directiveMap["headers"] = "true";}
|
451 | else if (!outputDirectory.empty()) {directiveMap["output-dir"] = outputDirectory;}
|
452 | IOSystem::getInstance().getWriter(directiveMap, symTable, recordTable)->writeAll(*rel_path_76cf4ab0e06a645b);
|
453 | } catch (std::exception& e) {std::cerr << e.what();exit(1);}
|
454 | }
|
455 | if (pruneImdtRels) rel_edge_04d25f5060e9043b->purge();
|
456 | }
|
457 |
|
458 | } // namespace souffle
|
459 |
|
460 | namespace souffle {
|
461 | using namespace souffle;
|
462 | class Sf__: public SouffleProgram {
|
463 | public:
|
464 | Sf__();
|
465 | ~Sf__();
|
466 | void run();
|
467 | void runAll(std::string inputDirectoryArg = "",std::string outputDirectoryArg = "",bool performIOArg = true,bool pruneImdtRelsArg = true);
|
468 | void printAll([[maybe_unused]] std::string outputDirectoryArg = "");
|
469 | void loadAll([[maybe_unused]] std::string inputDirectoryArg = "");
|
470 | void dumpInputs();
|
471 | void dumpOutputs();
|
472 | SymbolTable& getSymbolTable();
|
473 | RecordTable& getRecordTable();
|
474 | void setNumThreads(std::size_t numThreadsValue);
|
475 | void executeSubroutine(std::string name,const std::vector<RamDomain>& args,std::vector<RamDomain>& ret);
|
476 | private:
|
477 | void runFunction(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg);
|
478 | SymbolTableImpl symTable;
|
479 | SpecializedRecordTable<0> recordTable;
|
480 | ConcurrentCache<std::string,std::regex> regexCache;
|
481 | Own<t_btree_ii__0_1__11::Type> rel_edge_04d25f5060e9043b;
|
482 | souffle::RelationWrapper<t_btree_ii__0_1__11::Type> wrapper_rel_edge_04d25f5060e9043b;
|
483 | Own<t_btree_ii__0_1__11::Type> rel_path_76cf4ab0e06a645b;
|
484 | souffle::RelationWrapper<t_btree_ii__0_1__11::Type> wrapper_rel_path_76cf4ab0e06a645b;
|
485 | Own<t_btree_ii__0_1__11__10::Type> rel_delta_path_23da6daa27e8b245;
|
486 | Own<t_btree_ii__0_1__11__10::Type> rel_new_path_a0453b38c2806942;
|
487 | Stratum_edge_9543a759b165a2cb stratum_edge_31e40d0d94fe9f7c;
|
488 | Stratum_path_614f1ce382100c3f stratum_path_2eecd83fe9440b5c;
|
489 | std::string inputDirectory;
|
490 | std::string outputDirectory;
|
491 | SignalHandler* signalHandler{SignalHandler::instance()};
|
492 | std::atomic<RamDomain> ctr{};
|
493 | std::atomic<std::size_t> iter{};
|
494 | };
|
495 | } // namespace souffle
|
496 | namespace souffle {
|
497 | using namespace souffle;
|
498 | Sf__::Sf__():
|
499 | symTable(),
|
500 | recordTable(),
|
501 | regexCache(),
|
502 | rel_edge_04d25f5060e9043b(mk<t_btree_ii__0_1__11::Type>()),
|
503 | wrapper_rel_edge_04d25f5060e9043b(0, *rel_edge_04d25f5060e9043b, *this, "edge", std::array<const char *,2>{{"i:number","i:number"}}, std::array<const char *,2>{{"u","v"}}, 0),
|
504 | rel_path_76cf4ab0e06a645b(mk<t_btree_ii__0_1__11::Type>()),
|
505 | wrapper_rel_path_76cf4ab0e06a645b(1, *rel_path_76cf4ab0e06a645b, *this, "path", std::array<const char *,2>{{"i:number","i:number"}}, std::array<const char *,2>{{"u","v"}}, 0),
|
506 | rel_delta_path_23da6daa27e8b245(mk<t_btree_ii__0_1__11__10::Type>()),
|
507 | rel_new_path_a0453b38c2806942(mk<t_btree_ii__0_1__11__10::Type>()),
|
508 | stratum_edge_31e40d0d94fe9f7c(symTable,recordTable,regexCache,pruneImdtRels,performIO,signalHandler,iter,ctr,inputDirectory,outputDirectory,*rel_edge_04d25f5060e9043b),
|
509 | stratum_path_2eecd83fe9440b5c(symTable,recordTable,regexCache,pruneImdtRels,performIO,signalHandler,iter,ctr,inputDirectory,outputDirectory,*rel_delta_path_23da6daa27e8b245,*rel_new_path_a0453b38c2806942,*rel_edge_04d25f5060e9043b,*rel_path_76cf4ab0e06a645b){
|
510 | addRelation("edge", wrapper_rel_edge_04d25f5060e9043b, false, false);
|
511 | addRelation("path", wrapper_rel_path_76cf4ab0e06a645b, false, true);
|
512 | }
|
513 |
|
514 | Sf__::~Sf__(){
|
515 | }
|
516 |
|
517 | void Sf__::runFunction(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg){
|
518 |
|
519 | this->inputDirectory = std::move(inputDirectoryArg);
|
520 | this->outputDirectory = std::move(outputDirectoryArg);
|
521 | this->performIO = performIOArg;
|
522 | this->pruneImdtRels = pruneImdtRelsArg;
|
523 |
|
524 | // set default threads (in embedded mode)
|
525 | // if this is not set, and omp is used, the default omp setting of number of cores is used.
|
526 | #if defined(_OPENMP)
|
527 | if (0 < getNumThreads()) { omp_set_num_threads(static_cast<int>(getNumThreads())); }
|
528 | #endif
|
529 |
|
530 | signalHandler->set();
|
531 | // -- query evaluation --
|
532 | {
|
533 | std::vector<RamDomain> args, ret;
|
534 | stratum_edge_31e40d0d94fe9f7c.run(args, ret);
|
535 | }
|
536 | {
|
537 | std::vector<RamDomain> args, ret;
|
538 | stratum_path_2eecd83fe9440b5c.run(args, ret);
|
539 | }
|
540 |
|
541 | // -- relation hint statistics --
|
542 | signalHandler->reset();
|
543 | }
|
544 |
|
545 | void Sf__::run(){
|
546 | runFunction("", "", false, false);
|
547 | }
|
548 |
|
549 | void Sf__::runAll(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg){
|
550 | runFunction(inputDirectoryArg, outputDirectoryArg, performIOArg, pruneImdtRelsArg);
|
551 | }
|
552 |
|
553 | void Sf__::printAll([[maybe_unused]] std::string outputDirectoryArg){
|
554 | try {std::map<std::string, std::string> directiveMap({{"IO","file"},{"attributeNames","u\tv"},{"auxArity","0"},{"filename","path.tsv"},{"name","path"},{"operation","output"},{"output-dir","."},{"params","{\"records\": {}, \"relation\": {\"arity\": 2, \"params\": [\"u\", \"v\"]}}"},{"types","{\"ADTs\": {}, \"records\": {}, \"relation\": {\"arity\": 2, \"types\": [\"i:number\", \"i:number\"]}}"}});
|
555 | if (!outputDirectoryArg.empty()) {directiveMap["output-dir"] = outputDirectoryArg;}
|
556 | IOSystem::getInstance().getWriter(directiveMap, symTable, recordTable)->writeAll(*rel_path_76cf4ab0e06a645b);
|
557 | } catch (std::exception& e) {std::cerr << e.what();exit(1);}
|
558 | }
|
559 |
|
560 | void Sf__::loadAll([[maybe_unused]] std::string inputDirectoryArg){
|
561 | }
|
562 |
|
563 | void Sf__::dumpInputs(){
|
564 | }
|
565 |
|
566 | void Sf__::dumpOutputs(){
|
567 | try {std::map<std::string, std::string> rwOperation;
|
568 | rwOperation["IO"] = "stdout";
|
569 | rwOperation["name"] = "path";
|
570 | rwOperation["types"] = "{\"relation\": {\"arity\": 2, \"auxArity\": 0, \"types\": [\"i:number\", \"i:number\"]}}";
|
571 | IOSystem::getInstance().getWriter(rwOperation, symTable, recordTable)->writeAll(*rel_path_76cf4ab0e06a645b);
|
572 | } catch (std::exception& e) {std::cerr << e.what();exit(1);}
|
573 | }
|
574 |
|
575 | SymbolTable& Sf__::getSymbolTable(){
|
576 | return symTable;
|
577 | }
|
578 |
|
579 | RecordTable& Sf__::getRecordTable(){
|
580 | return recordTable;
|
581 | }
|
582 |
|
583 | void Sf__::setNumThreads(std::size_t numThreadsValue){
|
584 | SouffleProgram::setNumThreads(numThreadsValue);
|
585 | symTable.setNumLanes(getNumThreads());
|
586 | recordTable.setNumLanes(getNumThreads());
|
587 | regexCache.setNumLanes(getNumThreads());
|
588 | }
|
589 |
|
590 | void Sf__::executeSubroutine(std::string name,const std::vector<RamDomain>& args,std::vector<RamDomain>& ret){
|
591 | if (name == "edge") {
|
592 | stratum_edge_31e40d0d94fe9f7c.run(args, ret);
|
593 | return;}
|
594 | if (name == "path") {
|
595 | stratum_path_2eecd83fe9440b5c.run(args, ret);
|
596 | return;}
|
597 | fatal(("unknown subroutine " + name).c_str());
|
598 | }
|
599 |
|
600 | } // namespace souffle
|
601 | namespace souffle {
|
602 | SouffleProgram *newInstance__(){return new souffle::Sf__;}
|
603 | SymbolTable *getST__(SouffleProgram *p){return &reinterpret_cast<souffle::Sf__*>(p)->getSymbolTable();}
|
604 | } // namespace souffle
|
605 |
|
606 | #ifndef __EMBEDDED_SOUFFLE__
|
607 | #include "souffle/CompiledOptions.h"
|
608 | int main(int argc, char** argv)
|
609 | {
|
610 | try{
|
611 | souffle::CmdOptions opt(R"(deps/source.medo/souffle/smoke-test.dl)",
|
612 | R"()",
|
613 | R"()",
|
614 | false,
|
615 | R"()",
|
616 | 1);
|
617 | if (!opt.parse(argc,argv)) return 1;
|
618 | souffle::Sf__ obj;
|
619 | #if defined(_OPENMP)
|
620 | obj.setNumThreads(opt.getNumJobs());
|
621 |
|
622 | #endif
|
623 | obj.runAll(opt.getInputFileDir(), opt.getOutputFileDir());
|
624 | return 0;
|
625 | } catch(std::exception &e) { souffle::SignalHandler::instance()->error(e.what());}
|
626 | }
|
627 | #endif
|
628 |
|
629 | namespace souffle {
|
630 | using namespace souffle;
|
631 | class factory_Sf__: souffle::ProgramFactory {
|
632 | public:
|
633 | souffle::SouffleProgram* newInstance();
|
634 | factory_Sf__();
|
635 | private:
|
636 | };
|
637 | } // namespace souffle
|
638 | namespace souffle {
|
639 | using namespace souffle;
|
640 | souffle::SouffleProgram* factory_Sf__::newInstance(){
|
641 | return new souffle::Sf__();
|
642 | }
|
643 |
|
644 | factory_Sf__::factory_Sf__():
|
645 | souffle::ProgramFactory("_"){
|
646 | }
|
647 |
|
648 | } // namespace souffle
|
649 | namespace souffle {
|
650 |
|
651 | #ifdef __EMBEDDED_SOUFFLE__
|
652 | extern "C" {
|
653 | souffle::factory_Sf__ __factory_Sf___instance;
|
654 | }
|
655 | #endif
|
656 | } // namespace souffle
|
657 |
|