debugging.h 2.54 KB
Newer Older
1
2
3
4
5
// -------------------------------------------------------------
// cuDPP -- CUDA Data Parallel Primitives library
// -------------------------------------------------------------
// $Revision:$
// $Date:$
6
// -------------------------------------------------------------
7
8
// This source code is distributed under the terms of license.txt in
// the root directory of this source distribution.
9
// -------------------------------------------------------------
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

/**
 * @file
 * debugging.h
 *
 * @brief Debugging/statistics/performance utilities header for hash tables.
 */

#ifndef CUDAHT__CUCKOO__SRC__LIBRARY__DEBUGGING__H
#define CUDAHT__CUCKOO__SRC__LIBRARY__DEBUGGING__H

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

#include <algorithm>

traveller59's avatar
traveller59 committed
27
namespace cuhash {
28
29
30
31

//! @name Debugging functions
/// @{

32
33
34
35
void TakeHashFunctionStatistics(const unsigned num_keys, const unsigned *d_keys,
                                const unsigned table_size,
                                const uint2 *constants,
                                const unsigned kNumHashFunctions);
36

37
38
//! Output how many probes were required by each thread to perform the
//! retrieval.
39
/*! @param[in]  n_queries           Number of queries being performed.
40
41
 *  @param[in]  d_retrieval_probes  Device array: the number of probes taken for
 * each thread's retrieval.
42
43
 *  @param[in]  n_functions         Number of hash functions used.
 */
44
void OutputRetrievalStatistics(const unsigned n_queries,
45
                               const unsigned *d_retrieval_probes,
46
                               const unsigned n_functions);
47

48
49
//! Outputs information about how many iterations threads required to
//! successfully cuckoo hash.
50
/*! @param[in]  n                       Number of keys in the input.
51
52
53
54
 *  @param[in]  d_iterations_taken      Device mem: Number of iterations each
 * thread took.
 *  @param[in]  d_max_iterations_taken  Device mem: Largest number of iterations
 * taken by any thread.
55
 */
56
void OutputBuildStatistics(const unsigned n,
57
58
59
60
61
62
                           const unsigned *d_iterations_taken);

//! Prints out the contents of the stash.
void PrintStashContents(const Entry *d_stash);

//! Checks if a key is assigned the same slot by different hash functions.
63
64
65
bool CheckAssignedSameSlot(const unsigned N, const unsigned num_keys,
                           const unsigned *d_keys, const unsigned table_size,
                           uint2 *constants);
66
67
68

/// @}

69
}; // namespace cuhash
70
71
72
73
74
75
76
77

#endif

// Leave this at the end of the file
// Local Variables:
// mode:c++
// c-file-style: "NVIDIA"
// End: