| … | … | @@ -3,19 +3,24 @@ |
| 3 | 3 | # About |
| 4 | 4 | |
| 5 | 5 | This project shows how to implement a simple GPU hash table. Thanks to the high bandwidth and massive parallelism of |
| 6 | | GPU's, the result is a high performance hash table capable of insertion rates in the hundreds of millions of key/value |
| 7 | | pairs a second. |
| 6 | GPU's, the result is a high performance hash table capable of hundreds of millions of operations per second. |
| 8 | 7 | |
| 9 | 8 | The code achieves an average insertion rate of 309 million key/second on my development laptop with an NVIDIA GTX 1060. |
| 10 | 9 | |
| 11 | | This code uses atomic operations to insert key/value pairs into a lock free hash table on multiple GPU threads using linear |
| 12 | | probing. It uses CUDA for ease of development, but this can easily be ported to HLSL or GLSL. |
| 10 | The code implements a lock free hash table using linear probing. Concurrent inserts, deletes, and lookups are supported by |
| 11 | this hash table. The hash table works on 32 bit keys and 32 bit values (although 0xffffffff is reserved for both keys |
| 12 | 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. |
| 13 | 13 | |
| 14 | | The hash table inserts 32 bit keys and 32 bit values. Deleting from the hash table is not implemented in this simple |
| 15 | | example, but it would be simple to implement deletion with tombstones. Similarly, lookups from the hash table are not |
| 16 | | implemented in this simple example, but would be a linear search through the table starting at the key's hash. |
| 14 | Atomic operations are used to insert key/value pairs into the hash table on multiple GPU threads. It uses CUDA for ease |
| 15 | of development, but could easily be ported to HLSL or GLSL. 64 bit keys and/or values could be supported using 64 bit |
| 16 | atomics. |
| 17 | 17 | |
| 18 | | For more information on lock free hash table design, read Preshing on Programming's [The World's Simplest Lock Free Hash Table](https://preshing.com/20130605/the-worlds-simplest-lock-free-hash-table/). |
| 18 | Resizing the hash table is not implemented (it's a *simple* hash table!) |
| 19 | |
| 20 | For more information on lock free hash table design, read: |
| 21 | * Preshing on Programming's [The World's Simplest Lock Free Hash |
| 22 | Table](https://preshing.com/20130605/the-worlds-simplest-lock-free-hash-table/) |
| 23 | * Cliff Click's slides on (A Lock-Free Wait-Free Hash Table)[https://web.stanford.edu/class/ee380/Abstracts/070221_LockFreeHash.pdf] |
| 19 | 24 | |
| 20 | 25 | # Prerequisites |
| 21 | 26 | |