summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--include/framework/DynamicExtension.h2
-rw-r--r--include/framework/interface/Query.h25
-rw-r--r--include/framework/scheduling/Epoch.h2
-rw-r--r--include/framework/scheduling/Task.h4
-rw-r--r--include/framework/structure/ExtensionStructure.h2
-rw-r--r--include/framework/structure/InternalLevel.h4
-rw-r--r--include/query/irs.h4
-rw-r--r--include/query/rangecount.h8
-rw-r--r--include/query/rangequery.h6
-rw-r--r--include/query/wirs.h19
-rw-r--r--include/query/wss.h20
-rw-r--r--tests/include/concurrent_extension.h7
13 files changed, 54 insertions, 56 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c84f62c..e7426b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CMAKE_CXX_FLAGS=-latomic -mcx16)
-add_compile_options(-Iinclude -Iexternal/PLEX/include -Iexternal -mcx16)
+add_compile_options(-Iinclude -Iexternal/PLEX/include -Iexternal -mcx16 -fconcepts-diagnostics-depth=3)
if (debug)
add_compile_options(-g -O0)
@@ -151,6 +151,11 @@ if (bench)
target_include_directories(watermark_testing PRIVATE include external external/m-tree/cpp external/PGM-index/include external/PLEX/include bench/include external/psudb-common/cpp/include)
target_link_options(watermark_testing PUBLIC -mcx16)
+ add_executable(irs_bench ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/irs_bench.cpp)
+ target_link_libraries(irs_bench PUBLIC gsl pthread gomp atomic)
+ target_include_directories(irs_bench PRIVATE include external external/m-tree/cpp external/PGM-index/include external/PLEX/include bench/include external/psudb-common/cpp/include)
+ target_link_options(irs_bench PUBLIC -mcx16)
+
#add_executable(static_dynamic_comp ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/static_dynamic_comp.cpp)
#target_link_libraries(static_dynamic_comp PUBLIC gsl pthread gomp atomic)
#target_include_directories(static_dynamic_comp PRIVATE include external external/m-tree/cpp external/PGM-index/include external/PLEX/include bench/include external/psudb-common/cpp/include)
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h
index 3e9d0fb..5c021f2 100644
--- a/include/framework/DynamicExtension.h
+++ b/include/framework/DynamicExtension.h
@@ -31,7 +31,7 @@
namespace de {
-template <RecordInterface R, ShardInterface S, QueryInterface Q, LayoutPolicy L=LayoutPolicy::TEIRING,
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q, LayoutPolicy L=LayoutPolicy::TEIRING,
DeletePolicy D=DeletePolicy::TAGGING, SchedulerInterface SCHED=SerialScheduler>
class DynamicExtension {
typedef S Shard;
diff --git a/include/framework/interface/Query.h b/include/framework/interface/Query.h
index ca742c3..8cf9660 100644
--- a/include/framework/interface/Query.h
+++ b/include/framework/interface/Query.h
@@ -8,31 +8,26 @@
*/
#pragma once
-#include <vector>
+#include "framework/QueryRequirements.h"
#include <concepts>
-#include "util/types.h"
-
+namespace de{
// FIXME: The interface is not completely specified yet, as it is pending
// determining a good way to handle additional template arguments
// to get the Shard and Record types into play
-template <typename Q>
-concept QueryInterface = requires(Q q, void *p, std::vector<void*> &s) {
-
- /*
- {Q::get_query_state(p, p)} -> std::convertible_to<void*>;
- {Q::get_buffer_query_state(p, p)} -> std::convertible_to<void *>;
- */
+template <typename Q, typename R, typename S>
+concept QueryInterface = requires(void *p, S *sh, std::vector<void*> &s, std::vector<std::vector<Wrapped<R>>> &rv, BufferView<R> *bv) {
+ {Q::get_query_state(sh, p)} -> std::convertible_to<void*>;
+ {Q::get_buffer_query_state(bv, p)} -> std::convertible_to<void *>;
{Q::process_query_states(p, s, p)};
- /*
- {Q::query(s, p, p)} -> std::convertible_to<std::vector<Wrapped<R>>>;
+ {Q::query(sh, p, p)} -> std::convertible_to<std::vector<Wrapped<R>>>;
{Q::buffer_query(p, p)} -> std::convertible_to<std::vector<Wrapped<R>>>;
{Q::merge(rv, p)} -> std::convertible_to<std::vector<R>>;
- */
- {Q::delete_query_state(std::declval<void*>())} -> std::same_as<void>;
- {Q::delete_buffer_query_state(std::declval<void*>())} -> std::same_as<void>;
+ {Q::delete_query_state(p)} -> std::same_as<void>;
+ {Q::delete_buffer_query_state(p)} -> std::same_as<void>;
{Q::EARLY_ABORT} -> std::convertible_to<bool>;
{Q::SKIP_DELETE_FILTER} -> std::convertible_to<bool>;
};
+}
diff --git a/include/framework/scheduling/Epoch.h b/include/framework/scheduling/Epoch.h
index 7b533b6..48b7742 100644
--- a/include/framework/scheduling/Epoch.h
+++ b/include/framework/scheduling/Epoch.h
@@ -18,7 +18,7 @@
namespace de {
-template <RecordInterface R, ShardInterface S, QueryInterface Q, LayoutPolicy L>
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q, LayoutPolicy L>
class Epoch {
private:
typedef MutableBuffer<R> Buffer;
diff --git a/include/framework/scheduling/Task.h b/include/framework/scheduling/Task.h
index 6f6b913..ba0001d 100644
--- a/include/framework/scheduling/Task.h
+++ b/include/framework/scheduling/Task.h
@@ -18,7 +18,7 @@
namespace de {
-template <RecordInterface R, ShardInterface S, QueryInterface Q, LayoutPolicy L>
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q, LayoutPolicy L>
struct ReconstructionArgs {
Epoch<R, S, Q, L> *epoch;
std::vector<ReconstructionTask> merges;
@@ -27,7 +27,7 @@ struct ReconstructionArgs {
void *extension;
};
-template <RecordInterface R, ShardInterface S, QueryInterface Q, LayoutPolicy L>
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q, LayoutPolicy L>
struct QueryArgs {
std::promise<std::vector<R>> result_set;
void *query_parms;
diff --git a/include/framework/structure/ExtensionStructure.h b/include/framework/structure/ExtensionStructure.h
index ae566cb..0b8263e 100644
--- a/include/framework/structure/ExtensionStructure.h
+++ b/include/framework/structure/ExtensionStructure.h
@@ -22,7 +22,7 @@
namespace de {
-template <RecordInterface R, ShardInterface S, QueryInterface Q, LayoutPolicy L=LayoutPolicy::TEIRING>
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q, LayoutPolicy L=LayoutPolicy::TEIRING>
class ExtensionStructure {
typedef S Shard;
typedef BufferView<R> BuffView;
diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h
index e9874e0..0fd5275 100644
--- a/include/framework/structure/InternalLevel.h
+++ b/include/framework/structure/InternalLevel.h
@@ -19,12 +19,12 @@
#include "framework/structure/BufferView.h"
namespace de {
-template <RecordInterface R, ShardInterface S, QueryInterface Q>
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q>
class InternalLevel;
-template <RecordInterface R, ShardInterface S, QueryInterface Q>
+template <RecordInterface R, ShardInterface S, QueryInterface<R, S> Q>
class InternalLevel {
typedef S Shard;
typedef BufferView<R> BuffView;
diff --git a/include/query/irs.h b/include/query/irs.h
index 7eea14b..bef75bf 100644
--- a/include/query/irs.h
+++ b/include/query/irs.h
@@ -90,9 +90,9 @@ public:
return res;
}
- static void process_query_states(void *query_parms, std::vector<void*> &shard_states, void *buff_state) {
+ static void process_query_states(void *query_parms, std::vector<void*> &shard_states, void *buffer_state) {
auto p = (Parms<R> *) query_parms;
- auto bs = (buff_state) ? (BufferState<R> *) buff_state : nullptr;
+ auto bs = (buffer_state) ? (BufferState<R> *) buffer_state : nullptr;
std::vector<size_t> shard_sample_sizes(shard_states.size()+1, 0);
size_t buffer_sz = 0;
diff --git a/include/query/rangecount.h b/include/query/rangecount.h
index 70d57d8..a09ad64 100644
--- a/include/query/rangecount.h
+++ b/include/query/rangecount.h
@@ -11,11 +11,7 @@
*/
#pragma once
-#include "framework/interface/Record.h"
-#include "framework/interface/Shard.h"
-#include "framework/structure/BufferView.h"
-#include "psu-ds/PriorityQueue.h"
-#include "util/Cursor.h"
+#include "framework/QueryRequirements.h"
namespace de { namespace rc {
@@ -61,7 +57,7 @@ public:
return res;
}
- static void process_query_states(void *query_parms, std::vector<void*> &shard_states, void* buffer_states) {
+ static void process_query_states(void *query_parms, std::vector<void*> &shard_states, void* buffer_state) {
return;
}
diff --git a/include/query/rangequery.h b/include/query/rangequery.h
index 1a42265..c3985fa 100644
--- a/include/query/rangequery.h
+++ b/include/query/rangequery.h
@@ -10,9 +10,7 @@
*/
#pragma once
-#include "framework/interface/Record.h"
-#include "framework/interface/Shard.h"
-#include "framework/structure/BufferView.h"
+#include "framework/QueryRequirements.h"
#include "psu-ds/PriorityQueue.h"
#include "util/Cursor.h"
@@ -60,7 +58,7 @@ public:
return res;
}
- static void process_query_states(void *query_parms, std::vector<void*> &shard_states, void* buffer_states) {
+ static void process_query_states(void *query_parms, std::vector<void*> &shard_states, void* buffer_state) {
return;
}
diff --git a/include/query/wirs.h b/include/query/wirs.h
index 9b3d2ad..07c5292 100644
--- a/include/query/wirs.h
+++ b/include/query/wirs.h
@@ -12,9 +12,7 @@
*/
#pragma once
-#include "framework/interface/Record.h"
-#include "framework/interface/Shard.h"
-#include "framework/structure/MutableBuffer.h"
+#include "framework/QueryRequirements.h"
#include "psu-ds/Alias.h"
namespace de { namespace wirs {
@@ -52,6 +50,7 @@ struct BufferState {
decltype(R::weight) max_weight;
size_t sample_size;
decltype(R::weight) total_weight;
+ BufferView<R> *buffer;
~BufferState() {
delete alias;
@@ -83,7 +82,7 @@ public:
return res;
}
- static void* get_buffer_query_state(MutableBuffer<R> *buffer, void *parms) {
+ static void* get_buffer_query_state(BufferView<R> *buffer, void *parms) {
BufferState<R> *state = new BufferState<R>();
auto parameters = (Parms<R>*) parms;
@@ -92,16 +91,17 @@ public:
state->max_weight = buffer->get_max_weight();
state->total_weight = buffer->get_total_weight();
state->sample_size = 0;
+ state->buffer = buffer;
return state;
}
std::vector<decltype(R::weight)> weights;
- state->cutoff = buffer->get_record_count() - 1;
+ state->buffer = buffer;
decltype(R::weight) total_weight = 0;
- for (size_t i = 0; i <= state->cutoff; i++) {
- auto rec = buffer->get_data() + i;
+ for (size_t i = 0; i <= buffer->get_record_count(); i++) {
+ auto rec = buffer->get(i);
if (rec->rec.key >= parameters->lower_bound && rec->rec.key <= parameters->upper_bound && !rec->is_tombstone() && !rec->is_deleted()) {
weights.push_back(rec->rec.weight);
@@ -190,9 +190,10 @@ public:
return result_set;
}
- static std::vector<Wrapped<R>> buffer_query(MutableBuffer<R> *buffer, void *state, void *parms) {
+ static std::vector<Wrapped<R>> buffer_query(void *state, void *parms) {
auto st = (BufferState<R> *) state;
auto p = (Parms<R> *) parms;
+ auto buffer = st->buffer;
std::vector<Wrapped<R>> result;
result.reserve(st->sample_size);
@@ -200,7 +201,7 @@ public:
if constexpr (Rejection) {
for (size_t i=0; i<st->sample_size; i++) {
auto idx = gsl_rng_uniform_int(p->rng, st->cutoff);
- auto rec = buffer->get_data() + idx;
+ auto rec = buffer->get(idx);
auto test = gsl_rng_uniform(p->rng) * st->max_weight;
diff --git a/include/query/wss.h b/include/query/wss.h
index 4c8861e..9f192ee 100644
--- a/include/query/wss.h
+++ b/include/query/wss.h
@@ -11,9 +11,8 @@
*/
#pragma once
-#include "framework/interface/Record.h"
-#include "framework/interface/Shard.h"
-#include "framework/structure/MutableBuffer.h"
+#include "framework/QueryRequirements.h"
+#include "psu-ds/Alias.h"
namespace de { namespace wss {
@@ -40,6 +39,7 @@ struct BufferState {
psudb::Alias *alias;
decltype(R::weight) max_weight;
decltype(R::weight) total_weight;
+ BufferView<R> *buffer;
~BufferState() {
delete alias;
@@ -60,23 +60,24 @@ public:
return res;
}
- static void* get_buffer_query_state(MutableBuffer<R> *buffer, void *parms) {
+ static void* get_buffer_query_state(BufferState<R> *buffer, void *parms) {
BufferState<R> *state = new BufferState<R>();
auto parameters = (Parms<R>*) parms;
if constexpr (Rejection) {
state->cutoff = buffer->get_record_count() - 1;
state->max_weight = buffer->get_max_weight();
state->total_weight = buffer->get_total_weight();
+ state->buffer = buffer;
return state;
}
std::vector<double> weights;
- state->cutoff = buffer->get_record_count() - 1;
double total_weight = 0.0;
+ state->buffer = buffer;
- for (size_t i = 0; i <= state->cutoff; i++) {
- auto rec = buffer->get_data() + i;
+ for (size_t i = 0; i <= buffer->get_record_count(); i++) {
+ auto rec = buffer->get_data(i);
weights.push_back(rec->rec.weight);
total_weight += rec->rec.weight;
}
@@ -152,9 +153,10 @@ public:
return result_set;
}
- static std::vector<Wrapped<R>> buffer_query(MutableBuffer<R> *buffer, void *state, void *parms) {
+ static std::vector<Wrapped<R>> buffer_query(void *state, void *parms) {
auto st = (BufferState<R> *) state;
auto p = (Parms<R> *) parms;
+ auto buffer = st->buffer;
std::vector<Wrapped<R>> result;
result.reserve(st->sample_size);
@@ -162,7 +164,7 @@ public:
if constexpr (Rejection) {
for (size_t i=0; i<st->sample_size; i++) {
auto idx = gsl_rng_uniform_int(p->rng, st->cutoff);
- auto rec = buffer->get_data() + idx;
+ auto rec = buffer->get(idx);
auto test = gsl_rng_uniform(p->rng) * st->max_weight;
diff --git a/tests/include/concurrent_extension.h b/tests/include/concurrent_extension.h
index a0e71c9..24cb2ce 100644
--- a/tests/include/concurrent_extension.h
+++ b/tests/include/concurrent_extension.h
@@ -22,7 +22,7 @@
* should be included in the source file that includes this one, above the
* include statement.
*/
-#include "testing.h"
+/*#include "testing.h"
#include "framework/DynamicExtension.h"
#include "framework/scheduling/FIFOScheduler.h"
#include "shard/ISAMTree.h"
@@ -31,6 +31,7 @@
//using namespace de;
//typedef DynamicExtension<Rec, ISAMTree<Rec>, rq::Query<ISAMTree<Rec>, Rec>, LayoutPolicy::LEVELING, DeletePolicy::TOMBSTONE, FIFOScheduler> DE;
+*/
START_TEST(t_create)
@@ -169,10 +170,10 @@ START_TEST(t_range_query)
p.lower_bound = lower_key;
p.upper_bound = upper_key;
- fprintf(stderr, "query start\n");
+ //fprintf(stderr, "query start\n");
auto result = test_de->query(&p);
auto r = result.get();
- fprintf(stderr, "query stop\n");
+ //fprintf(stderr, "query stop\n");
std::sort(r.begin(), r.end());
ck_assert_int_eq(r.size(), 251);