CUDPP 2.0
CUDA Data-Parallel Primitives Library
Public Member Functions
CudaHT::CuckooHashing::MultivalueHashTable Class Reference

Hash table that stores multiple values per key. More...

#include <hash_multivalue.h>

Inherits CudaHT::CuckooHashing::HashTable.

List of all members.

Public Member Functions

virtual bool Build (const unsigned input_size, const unsigned *d_keys, const unsigned *d_vals)
 Build the multi-value hash table.
virtual void Release ()
 Free all memory.
virtual void Retrieve (const unsigned, const unsigned *, unsigned *)
 Don't call this.
virtual void Retrieve (const unsigned n_queries, const unsigned *d_keys, uint2 *d_location_counts)
 Retrieve from a multi-value hash table.
const unsigned * get_all_values () const
 Returns the array of values, where each key's values are stored contiguously in memory.
unsigned get_values_size () const
 Gets the total number of values between all of the keys.
const uint2 * get_index_counts () const
 Gets the location and number of values each key has.
virtual bool Initialize (const unsigned max_input_size, const float space_usage=1.2, const unsigned num_functions=4)
 Initializes the multi-value hash table's memory.

Detailed Description

Hash table that stores multiple values per key.

A key with multiple values is represented by multiple key-value pairs in the input with the same key.

Querying the structure returns how many items the key has and its location in the array returned by get_all_values().


Member Function Documentation

bool CudaHT::CuckooHashing::MultivalueHashTable::Build ( const unsigned  input_size,
const unsigned *  d_keys,
const unsigned *  d_vals 
) [virtual]

Build the multi-value hash table.

See HashTable::Build() for an explanation of the parameters. Key-value pairs in the input with the same key are assumed to be values associated with the same key.

Parameters:
[in]input_sizeNumber of key-value pairs being inserted.
[in]d_keysDevice memory array containing all of the input keys.
[in]d_valsDevice memory array containing the keys' values.
Returns:
Whether the hash table was built successfully (true) or not (false).
See also:
HashTable::Build()

Reimplemented from CudaHT::CuckooHashing::HashTable.

virtual void CudaHT::CuckooHashing::MultivalueHashTable::Retrieve ( const unsigned  ,
const unsigned *  ,
unsigned *   
) [inline, virtual]

Don't call this.

Todo:
Remove this function entirely somehow.

Reimplemented from CudaHT::CuckooHashing::HashTable.

void CudaHT::CuckooHashing::MultivalueHashTable::Retrieve ( const unsigned  n_queries,
const unsigned *  d_keys,
uint2 *  d_location_counts 
) [virtual]

Retrieve from a multi-value hash table.

Parameters:
[in]n_queriesNumber of queries in the input.
[in]d_keysDevice mem: All of the query keys.
[out]d_location_countsContains the index of a query key's first value and the number of values associated with the key. If a query fails, the number of values the key has will be marked as zero.
bool CudaHT::CuckooHashing::MultivalueHashTable::Initialize ( const unsigned  max_input_size,
const float  space_usage = 1.2,
const unsigned  num_functions = 4 
) [virtual]

Initializes the multi-value hash table's memory.

See HashTable::Initialize() for an explanation of the parameters.

Parameters:
[in]max_input_sizeLargest expected number of items in the input.
[in]space_usageSize of the hash table relative to the input. Bigger tables are faster to build and retrieve from.
[in]num_functionsNumber of hash functions to use. May be 2-5. More hash functions make it easier to build the table, but increase retrieval times.
Returns:
Whether the hash table was initialized successfully (true) or not (false).
See also:
HashTable::Initialize()

Reimplemented from CudaHT::CuckooHashing::HashTable.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines