All Projects → nosferalatu → Simplegpuhashtable

nosferalatu / Simplegpuhashtable

Licence: unlicense
A simple GPU hash table implemented in CUDA using lock free techniques

Projects that are alternatives of or similar to Simplegpuhashtable

Stdgpu
stdgpu: Efficient STL-like Data Structures on the GPU
Stars: ✭ 531 (+168.18%)
Mutual labels:  data-structures, gpu, cuda
Khiva
An open-source library of algorithms to analyse time series in GPU and CPU.
Stars: ✭ 161 (-18.69%)
Mutual labels:  gpu, cuda
Xmrminer
🐜 A CUDA based miner for Monero
Stars: ✭ 158 (-20.2%)
Mutual labels:  gpu, cuda
Quda
QUDA is a library for performing calculations in lattice QCD on GPUs.
Stars: ✭ 166 (-16.16%)
Mutual labels:  gpu, cuda
Optical Flow Filter
A real time optical flow algorithm implemented on GPU
Stars: ✭ 146 (-26.26%)
Mutual labels:  gpu, cuda
Cumf als
CUDA Matrix Factorization Library with Alternating Least Square (ALS)
Stars: ✭ 154 (-22.22%)
Mutual labels:  gpu, cuda
Jcuda
JCuda - Java bindings for CUDA
Stars: ✭ 165 (-16.67%)
Mutual labels:  gpu, cuda
Libcudacxx
The C++ Standard Library for your entire system.
Stars: ✭ 1,861 (+839.9%)
Mutual labels:  gpu, cuda
Gmonitor
gmonitor is a GPU monitor (Nvidia only at the moment)
Stars: ✭ 169 (-14.65%)
Mutual labels:  gpu, cuda
Ssd Gpu Dma
Build userspace NVMe drivers and storage applications with CUDA support
Stars: ✭ 172 (-13.13%)
Mutual labels:  gpu, cuda
Cuml
cuML - RAPIDS Machine Learning Library
Stars: ✭ 2,504 (+1164.65%)
Mutual labels:  gpu, cuda
Remotery
Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer
Stars: ✭ 1,908 (+863.64%)
Mutual labels:  gpu, cuda
Hoomd Blue
Molecular dynamics and Monte Carlo soft matter simulation on GPUs.
Stars: ✭ 143 (-27.78%)
Mutual labels:  gpu, cuda
3dunderworld Sls Gpu cpu
A structured light scanner
Stars: ✭ 157 (-20.71%)
Mutual labels:  gpu, cuda
Forward
A library for high performance deep learning inference on NVIDIA GPUs.
Stars: ✭ 136 (-31.31%)
Mutual labels:  gpu, cuda
Primitiv
A Neural Network Toolkit.
Stars: ✭ 164 (-17.17%)
Mutual labels:  gpu, cuda
Nvidia Docker
Build and run Docker containers leveraging NVIDIA GPUs
Stars: ✭ 13,961 (+6951.01%)
Mutual labels:  gpu, cuda
Onemkl
oneAPI Math Kernel Library (oneMKL) Interfaces
Stars: ✭ 122 (-38.38%)
Mutual labels:  gpu, cuda
Mixbench
A GPU benchmark tool for evaluating GPUs on mixed operational intensity kernels (CUDA, OpenCL, HIP, SYCL)
Stars: ✭ 130 (-34.34%)
Mutual labels:  gpu, cuda
Creepminer
Burstcoin C++ CPU and GPU Miner
Stars: ✭ 169 (-14.65%)
Mutual labels:  gpu, cuda

About

This project shows how to implement a simple GPU hash table. Thanks to the high bandwidth and massive parallelism of GPU's, the result is a high performance hash table capable of hundreds of millions of operations per second.

The code achieves an average insertion rate of 326 million key/second on my development laptop with an NVIDIA GTX 1060, measured by inserting 64 million elements.

Read my blog post about the code here for more information about the implementation.

The code implements a lock free hash table using linear probing. Concurrent inserts, deletes, and lookups are supported by this hash table. The hash table works on 32 bit keys and 32 bit values (although 0xffffffff is reserved for both keys and values). The load factor of the table is set to 50% in the code, and the table size must be a power of two.

Atomic operations are used to insert key/value pairs into the hash table on multiple GPU threads. It uses CUDA for ease of development, but could easily be ported to HLSL or GLSL. 64 bit keys and/or values could be supported using 64 bit atomics.

Resizing the hash table is not implemented (it's a simple hash table!) although this can be achieved by inserting the contents of a table into another, larger table.

The code was kept simple for readability. There are many optimizations that can be done, but they muddy the waters. I wanted to illustrate the basic design of the lock free hash table and how it can be implemented on a GPU.

How To Use

If you build and run the executable, it enters an infinite loop of inserting and deleting random numbers into the GPU hash table and verifying that the results are correct. The seed used to generate random numbers changes every time you run the executable, but you can set the seed to a specific value in code if you'd like to reproduce results across runs.

This is how you insert a vector of KeyValue pairs into the hash table and then retrieve all the KeyValue pairs back:

    std::vector<KeyValue> things_to_insert = { {0,1}, {1,2}, {2,3}, {3,4} };

    KeyValue* pHashTable = create_hashtable();
    insert_hashtable(pHashTable, things_to_insert.data(), (uint32_t)things_to_insert.size());
    std::vector<KeyValue> result = iterate_hashtable(pHashTable);
    destroy_hashtable(pHashTable);

After that runs, the vectors things_to_insert and result should be the same, but possibly in a different order.

Prerequisites

  • CMake
  • CUDA

This has been tested on Windows with Visual Studio Community 2019 on a machine with an NVIDIA GTX 1060. An easy way to get CMake is to open a Visual Studio command prompt (in Windows, run "x64 Native Tools Command Prompt for VS 2019"; that will put CMake in your path).

This should work on other CUDA-supported platforms, but I have not tested this.

Cloning

git clone https://github.com/nosferalatu/SimpleConcurrentGPUHashTable.git SimpleConcurrentGPUHashTable

Generating Build Files

Run the following commands to generate .sln and .vcxproj's that can be opened in Visual Studio:

cd ConcurrentHashTables
md build
cd build
cmake ..

You can now open SimpleConcurrentGPUHashTable.sln in Visual Studio.

If CMake fails to find CUDA above, then run a CMake generator for 64 bit builds:

cmake -G "Visual Studio 16 2019 Win64" ..

Building

You can build within Visual Studio, or from the command line with:

cmake --build . --config Release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].