Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viathefalcon/vk_merkle_roots
A program to demonstrate Merkle root calculation on GPUs through Vulkan
https://github.com/viathefalcon/vk_merkle_roots
gpgpu gpu merkle-root sha-256 vulkan
Last synced: about 2 months ago
JSON representation
A program to demonstrate Merkle root calculation on GPUs through Vulkan
- Host: GitHub
- URL: https://github.com/viathefalcon/vk_merkle_roots
- Owner: viathefalcon
- Created: 2023-02-17T21:59:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T15:03:36.000Z (8 months ago)
- Last Synced: 2024-04-14T05:11:33.261Z (8 months ago)
- Topics: gpgpu, gpu, merkle-root, sha-256, vulkan
- Language: C++
- Homepage:
- Size: 127 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vulkan Merkle Roots
## Summary
A program to demonstrate the calculation/resolution of the roots of [Merkle/hash trees](https://en.wikipedia.org/wiki/Merkle_tree) of arbitrary inputs on GPUs via the [Vulkan API](https://en.wikipedia.org/wiki/Vulkan).## Components
### `vkmr`
This is the primary program; it reads inputs from `stdin` and then calculates their Merkle root, both on the CPU and on each compute-capable GPU reported by Vulkan.### `strm`
This helper program accepts an arbitrary number of command-line arguments and writes them to a line-separated stream in `stdout`.### `rndm`
This helper program generates a specified volume of randomly-filled input strings and writes them to a line-separated stream in `stdout`.## Building, Running
The Visual Studio Code project includes tasks which will build the programs; it assumes that either the Visual C++ compiler (on Windows) or Clang (elsewhere) is on the `PATH`.### On (Steam) Deck
To build the project on Steam Deck, I run [VS Code in Flatpak](https://flathub.org/apps/com.visualstudio.code). For building, and running, on Steam Deck, the project has an implicit dependency on LLVM 18, which I satisfy with the [LLVM 18 extension for the flatpak Freedesktop SDK](https://github.com/flathub/org.freedesktop.Sdk.Extension.llvm18). I installed VS Code via the Discovery package manager, and the LLVM extension via the command-line:
```
flatpak install org.freedesktop.Sdk.Extension.llvm18
```#### Launching VS Code
(and enabling the LLVM 18 extension)
```
FLATPAK_ENABLE_SDK_EXT=llvm18 flatpak run --devel com.visualstudio.code
```#### Launching Vulkan Merkle Roots
The program, once built, also needs to run in a Flatpak container in which the LLVM16 extension is available. So, I open a shell in the VS Code sandbox:
```
FLATPAK_ENABLE_SDK_EXT=llvm18 flatpak run --command=sh --devel com.visualstudio.code
```And, inside this shell:
```
cd bin
./rndm.app 1712489279 1024 127 | ./vkmr.app
```