CUDPP  2.3
CUDA Data-Parallel Primitives Library
Classes | Namespaces | Functions | Variables
hash_functions.h File Reference

Hash function code. More...

#include <vector_types.h>
#include "definitions.h"

Classes

struct  CudaHT::CuckooHashing::Functions< N >
 Container for all of the hash functions. More...
 

Namespaces

 CudaHT
 Encapsulates the hash table library.
 

Functions

void CudaHT::CuckooHashing::GenerateFunctions (const unsigned N, const unsigned num_keys, const unsigned *d_keys, const unsigned table_size, uint2 *constants)
 Generates a set of linear hash function constants. More...
 
__device__ __host__ unsigned CudaHT::CuckooHashing::hash_function_inner (const uint2 constants, const unsigned key)
 Computes the value of a hash function for a given key. More...
 
template<unsigned kNumHashFunctions>
__device__ __host__ unsigned CudaHT::CuckooHashing::hash_function (const Functions< kNumHashFunctions > functions, const unsigned which_function, const unsigned key)
 Computes the value of a hash function for a given key. More...
 
__device__ __host__ unsigned CudaHT::CuckooHashing::stash_hash_function (const uint2 stash_constants, const unsigned key)
 Simple hash function used by the stash.
 

Variables

const unsigned CudaHT::CuckooHashing::kPrimeDivisor = 4294967291u
 Prime number larger than the largest practical hash table size.
 

Detailed Description

Hash function code.

Function Documentation

void CudaHT::CuckooHashing::GenerateFunctions ( const unsigned  N,
const unsigned  num_keys,
const unsigned *  d_keys,
const unsigned  table_size,
uint2 *  constants 
)

Generates a set of linear hash function constants.

Parameters
[in]NNumber of hash functions.
[out]constantsCPU pointer to the constants.
[in]num_keysDebug only: How many keys are in the input.
[in]d_keysDebug only: Device memory array containing the input keys.
[in]table_sizeDebug only: Size of the hash table.
__device__ __host__ unsigned CudaHT::CuckooHashing::hash_function_inner ( const uint2  constants,
const unsigned  key 
)
inline

Computes the value of a hash function for a given key.

Parameters
[in]constantsConstants used by the hash function. !
[in]keyKey being hashed. !
Returns
The value of the hash function for the key.
template<unsigned kNumHashFunctions>
__device__ __host__ unsigned CudaHT::CuckooHashing::hash_function ( const Functions< kNumHashFunctions >  functions,
const unsigned  which_function,
const unsigned  key 
)
inline

Computes the value of a hash function for a given key.

Parameters
[in]functionsAll of the constants used by the hash functions. !
[in]which_functionWhich hash function is being used. !
[in]keyKey being hashed. !
Returns
The value of a hash function with a given key.