1#ifndef BMSPARSEVEC_PARALLEL__H__INCLUDED__
2#define BMSPARSEVEC_PARALLEL__H__INCLUDED__
35template<
typename SVect,
typename Lock>
65 typename sparse_vector_type::statistics* st = 0)
68 auto rsize = sv.get_bmatrix().rows();
73 for (
unsigned k = 0; k < rsize; ++k)
81 bv->optimize(tb, opt_mode, &stbv);
128 tv.reserve(nb_count);
137 [nb, col, &xs_params, &sm_matr, &ref_vect] (
void* ) {
140 xor_scan.sync_nb_vect();
141 xor_scan.compute_sim_model(sm_matr, nb, col, xs_params);
213 unsigned planes = sv.stored_slices();
214 tv.reserve(planes + 1);
218 for (
unsigned i = 0; i < planes; ++i)
220 typename SV::bvector_type_const_ptr bv = sv.get_slice(i);
230 [bv_idx, &sv_layout] (
void* ) {
237 tdescr.
init(task, (
void*)&tdescr);
261 [&sv_layout] (
void* ) {
268 tdescr.
init(task_final, (
void*)&tdescr);
#define BM_DECLARE_TEMP_BLOCK(x)
Serialization for sparse_vector<>
List of reference bit-vectors with their true index associations.
static size_type not_found() BMNOEXCEPT
not-found value for find methods
bool build_nb_digest_and_xor_matrix(matrix_chain_type &matr, bvector_type &bv_blocks) const
Calculate blocks digest and resize XOR distance matrix based on total number of available blocks.
size_type find_bv(const bvector_type *bv) const BMNOEXCEPT
Find vector index by the pointer.
Constant iterator designed to enumerate "ON" bits.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid.
optmode
Optimization mode Every next level means additional checks (better compression vs time)
@ opt_compress
compress blocks when possible (GAP/prefix sum)
bvector_size_type size_type
Parallel plan builder for the XOR filter scanner.
bvector_type::allocator_type allocator_type
bm::bv_ref_vector< BV > bv_ref_vector_type
void build_plan(task_batch &batch, bm::xor_sim_model< BV > &sim_model, const bv_ref_vector_type &ref_vect, const bm::xor_sim_params &xs_params)
Simple scoped lock guard.
Builder class to prepare a batch of tasks for parallel optimization of a sparse vector.
bvector_type::allocator_type allocator_type
sparse_vector_type::statistics sv_statistics_type
sparse_vector_type::bvector_type bvector_type
bvector_type::optmode optmode_type
static void build_plan(task_batch &batch, sparse_vector_type &sv, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename sparse_vector_type::statistics *st=0)
Build paralell optimization batch (of tasks) for sparse vector.
Parallel plan builder for succinct sparse vector serialization.
void set_bookmarks(bool enable, unsigned bm_interval=256) BMNOEXCEPT
sv_serialization_plan_builder()
static void * task_run(void *argp)
Task execution Entry Point.
void set_xor_ref(const bv_ref_vector_type *bv_ref_ptr) BMNOEXCEPT
bm::xor_sim_model< bvector_type > xor_sim_model_type
static void * task_run_final(void *argp)
void build_plan(task_batch &batch, sparse_vector_serial_layout< SV > &sv_layout, const sparse_vector_type &sv)
bm::bv_ref_vector< bvector_type > bv_ref_vector_type
bvector_type::allocator_type allocator_type
void set_sim_model(const xor_sim_model_type *sim_model) BMNOEXCEPT
SV::bvector_type bvector_type
serialization_params s_params_
Basic implementation for collection of tasks for parallel execution.
task_vector_type & get_task_vector() BMNOEXCEPT
Get access to internal task vector.
void add(task_function_t f, void *argptr)
std::vector< bm::task_descr > task_vector_type
XOR scanner to search for complement-similarities in collections of bit-vectors.
void set_ref_vector(const bv_ref_vector_type *ref_vect) BMNOEXCEPT
std::function< int(void *)> task_function_t
Typedef for a call-back functional for lambda capture.
const unsigned set_compression_default
Default compression level.
void reset() BMNOEXCEPT
Reset statisctics.
Statistical information about bitset's memory allocation details.
parent_type::task_vector_type task_vector_type
bm::task_batch< allocator_type > parent_type
bm::task_batch< allocator_type > parent_type
parent_type::task_vector_type task_vector_type
layout class for serialization buffer structure
void set_plane(unsigned i, unsigned char *ptr, size_t buf_size) BMNOEXCEPT
Set plane output pointer and size.
unsigned compression_level_
const xor_sim_model_type * sim_model_ptr_
unsigned sb_range_
Desired bookmarks interval.
const bv_ref_vector_type * bv_ref_ptr_
bool sb_bookmarks_
Bookmarks flag.
bm::task_batch< allocator_type > parent_type
serialization_params s_params
parent_type::task_vector_type task_vector_type
BitMagic task with a captured function.
@ barrier_ok
barrier waits all prev.tasks done without error
void init(task_function_t f, void *argptr) noexcept
bm::dynamic_heap_matrix< block_match_chain_type, bv_allocator_type > matrix_chain_type
matrix_chain_type matr
model matrix
bvector_type bv_blocks
blocks digest
Parameters for XOR similarity search.