Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wt_Topk #226

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed compile error.
simongog committed Nov 17, 2014
commit 7c72f0a22fcd39e9d6b1fe8e86409dcc146d1888
45 changes: 24 additions & 21 deletions benchmark/wavelet_trees/src/wt_time_and_space.cpp
Original file line number Diff line number Diff line change
@@ -46,26 +46,27 @@ uint64_t test_inverse_select(const t_wt& wt, const vector<size_type>& is, uint64
return cnt;
}

// test interval_symbols
// test ys_in_x_range
template<class t_wt>
uint64_t
test_interval_symbols(typename enable_if<!(has_node_type<t_wt>::value),
t_wt>::type&, const vector<size_type>&, const vector<size_type>&, size_type&, uint64_t, uint64_t)
test_ys_in_x_range(typename enable_if<!(has_node_type<t_wt>::value),
t_wt>::type&, const vector<size_type>&, const vector<size_type>&, uint64_t, uint64_t)
{
return 0; // interval_symbols not implemented
return 0; // ys_in_x_range not implemented
}

template<class t_wt>
uint64_t
test_interval_symbols(typename enable_if<has_node_type<t_wt>::value,
t_wt>::type& wt, const vector<size_type>& is, const vector<size_type>& js, size_type& k, uint64_t mask, uint64_t times=100000000)
test_ys_in_x_range(typename enable_if<has_node_type<t_wt>::value,
t_wt>::type& wt, const vector<size_type>& is, const vector<size_type>& js, uint64_t mask, uint64_t times=100000000)
{
vector<value_type> tmp(wt.sigma);
vector<size_type> tmp2(wt.sigma);
uint64_t cnt=0;
for (uint64_t i=0; i<times; ++i) {
interval_symbols(wt, is[i&mask], js[i&mask], k, tmp, tmp2, tmp2);
cnt += k;
auto y_it = ys_in_x_range(wt, is[i&mask], js[i&mask]);
while (y_it) {
cnt += (std::get<2>(*y_it)-std::get<1>(*y_it));
++y_it;
}
}
return cnt;
}
@@ -171,20 +172,24 @@ void prepare_for_select(const t_iv& iv, vector<value_type>& cs, vector<size_type

template<class t_wt>
struct wt_trait {
static uint64_t test_access(const t_wt& wt, const vector<size_type>& is, uint64_t mask, uint64_t times=100000000) {
static uint64_t test_access(const t_wt& wt, const vector<size_type>& is, uint64_t mask, uint64_t times=100000000)
{
return ::test_access(wt, is, mask, times);
}
static uint64_t test_inverse_select(const t_wt& wt, const vector<size_type>& is, uint64_t mask, uint64_t times=100000000) {
static uint64_t test_inverse_select(const t_wt& wt, const vector<size_type>& is, uint64_t mask, uint64_t times=100000000)
{
return ::test_inverse_select(wt, is, mask, times);
}
};

template<class t_rac, class t_bitvector, class t_select, class t_select_zero>
struct wt_trait<wt_gmr_rs<t_rac, t_bitvector, t_select, t_select_zero>> {
static uint64_t test_access(const wt_gmr_rs<t_rac, t_bitvector, t_select, t_select_zero>&, const vector<size_type>&, uint64_t, uint64_t) {
static uint64_t test_access(const wt_gmr_rs<t_rac, t_bitvector, t_select, t_select_zero>&, const vector<size_type>&, uint64_t, uint64_t)
{
return 0;
}
static uint64_t test_inverse_select(const wt_gmr_rs<t_rac, t_bitvector, t_select, t_select_zero>&, const vector<size_type>&, uint64_t, uint64_t) {
static uint64_t test_inverse_select(const wt_gmr_rs<t_rac, t_bitvector, t_select, t_select_zero>&, const vector<size_type>&, uint64_t, uint64_t)
{
return 0;
}
};
@@ -203,8 +208,6 @@ int main(int argc, char* argv[])
uint64_t check = 0;
uint64_t size = 1<<log_s;

// create values
size_type k = 0;
vector<value_type> cs(size);
vector<size_type> is(size);
vector<size_type> is2(size);
@@ -255,13 +258,13 @@ int main(int argc, char* argv[])
cout << "# inverse_select_time = " << duration_cast<microseconds>(stop-start).count()/(double)reps << endl;
cout << "# inverse_select_check = " << check << endl;

// interval_symbols
const uint64_t reps_interval_symbols = wt.sigma < 10000 ? reps : reps/100;
// ys_in_x_range
const uint64_t reps_ys_in_x_range = wt.sigma < 10000 ? reps : reps/100;
start = timer::now();
check = test_interval_symbols<WT_TYPE>(wt, is, js, k, mask, reps_interval_symbols);
check = test_ys_in_x_range<WT_TYPE>(wt, is, js, mask, reps_ys_in_x_range);
stop = timer::now();
cout << "# interval_symbols_time = " << duration_cast<microseconds>(stop-start).count()/(double)reps_interval_symbols << endl;
cout << "# interval_symbols_check = " << check << endl;
cout << "# ys_in_x_range_time = " << duration_cast<microseconds>(stop-start).count()/(double)reps_ys_in_x_range << endl;
cout << "# ys_in_x_range_check = " << check << endl;

// lex_count
start = timer::now();
4 changes: 2 additions & 2 deletions benchmark/wavelet_trees/visualize/wt.R
Original file line number Diff line number Diff line change
@@ -154,9 +154,9 @@ for(tc in unique(maindata$TC_ID)){
widths=c(1.35,1), heights=c(1,1,1))

#interval-symbols-plot
ivs <-data['interval_symbols_time']
ivs <-data['ys_in_x_range_time']
rownames(ivs)<-id
plot_time_figure(t(ivs),"\\tt{interval\\_symbols}",xmax=max(xmax,max(ivs)))
plot_time_figure(t(ivs),"\\tt{ys\\_in\\_x\\_range}",xmax=max(xmax,max(ivs)))

#constructor-plot
con <-data['constructs_time']