Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int > Struct Template Reference

Specialization for ResultType = int. More...

#include <Tpetra_Details_Hash.hpp>

Inheritance diagram for Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >:

Public Types

typedef KeyType argument_type
 Type of the hash function's input.
 
typedef int result_type
 Type of the return value of the hash function.
 
typedef OffsetType offset_type
 Type of offsets into the hash table's array of (key,value) pairs.
 
typedef KeyType argument_type
 Type of the hash function's input.
 
typedef int result_type
 Type of the return value of the hash function.
 
typedef OffsetType offset_type
 Type of offsets into the hash table's array of (key,value) pairs.
 

Static Public Member Functions

static KOKKOS_INLINE_FUNCTION result_type hashFunc (const argument_type &key, const offset_type &size)
 The hash function.
 
static result_type getRecommendedSize (const offset_type size)
 Number of "buckets" that the constructor of FixedHashTable should allocate.
 
static KOKKOS_INLINE_FUNCTION result_type hashFunc (const argument_type &key, const offset_type &size)
 The hash function.
 
static result_type getRecommendedSize (const offset_type size)
 Number of "buckets" that the constructor of FixedHashTable should allocate.
 

Detailed Description

template<class KeyType, class DeviceType, class OffsetType>
struct Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >

Specialization for ResultType = int.

Template Parameters
KeyTypeThe type of hash function inputs. Corresponds to Tpetra's GlobalOrdinal type.
DeviceTypeKokkos::Device specialization.
OffsetTypeType of each entry of the "buckets" (offsets) array ptr_ in FixedHashTable.

This hash function currently always returns int, no matter the value type. This is unfortunate, because it limits Tpetra to have LocalOrdinal = int (or smaller). I would like to fix this at some point. Tpetra provides this partial specialization as a hook for fixing this later.

Definition at line 132 of file Tpetra_Details_Hash.hpp.

Member Typedef Documentation

◆ argument_type [1/2]

template<class KeyType, class DeviceType, class OffsetType>
typedef KeyType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::argument_type

Type of the hash function's input.

This is the same typedef as found in std::hash.

Definition at line 136 of file Tpetra_Details_Hash.hpp.

◆ result_type [1/2]

template<class KeyType, class DeviceType, class OffsetType>
typedef int Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::result_type

Type of the return value of the hash function.

This is the same typedef as found in std::hash.

Definition at line 141 of file Tpetra_Details_Hash.hpp.

◆ offset_type [1/2]

template<class KeyType, class DeviceType, class OffsetType>
typedef OffsetType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::offset_type

Type of offsets into the hash table's array of (key,value) pairs.

Definition at line 144 of file Tpetra_Details_Hash.hpp.

◆ argument_type [2/2]

typedef KeyType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::argument_type

Type of the hash function's input.

This is the same typedef as found in std::hash.

Definition at line 79 of file Tpetra_Details_Hash.hpp.

◆ result_type [2/2]

typedef int Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::result_type

Type of the return value of the hash function.

This is the same typedef as found in std::hash.

Definition at line 84 of file Tpetra_Details_Hash.hpp.

◆ offset_type [2/2]

typedef OffsetType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::offset_type

Type of offsets into the hash table's array of (key,value) pairs.

Definition at line 87 of file Tpetra_Details_Hash.hpp.

Member Function Documentation

◆ hashFunc() [1/2]

template<class KeyType, class DeviceType, class OffsetType>
static KOKKOS_INLINE_FUNCTION result_type Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::hashFunc ( const argument_type & key,
const offset_type & size )
inlinestatic

The hash function.

Parameters
key[in] The key to hash.
size[in] Number of "buckets" in the hash table.

It is legal to call this function in a Kokkos parallel kernel.

Definition at line 153 of file Tpetra_Details_Hash.hpp.

◆ getRecommendedSize() [1/2]

template<class KeyType, class DeviceType, class OffsetType>
static result_type Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::getRecommendedSize ( const offset_type size)
inlinestatic

Number of "buckets" that the constructor of FixedHashTable should allocate.

Parameters
size[in] Number of entries in the table. (FixedHashTable fixes the number of entries in its constructor.)

Definition at line 178 of file Tpetra_Details_Hash.hpp.

◆ hashFunc() [2/2]

static KOKKOS_INLINE_FUNCTION result_type Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::hashFunc ( const argument_type & key,
const offset_type & size )
inlinestatic

The hash function.

Parameters
key[in] The key to hash.
size[in] Number of "buckets" in the hash table.

It is legal to call this function in a Kokkos parallel kernel.

Definition at line 96 of file Tpetra_Details_Hash.hpp.

◆ getRecommendedSize() [2/2]

static result_type Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, int >::getRecommendedSize ( const offset_type size)
inlinestatic

Number of "buckets" that the constructor of FixedHashTable should allocate.

Parameters
size[in] Number of entries in the table. (FixedHashTable fixes the number of entries in its constructor.)

This is included in Hash, because a correct and efficient implementation is a function of result_type. The point is to factor out all of the non-generic stuff into this Hash struct, which can be specialized for the types of interest.

Definition at line 112 of file Tpetra_Details_Hash.hpp.


The documentation for this struct was generated from the following file: