Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HigherOrderCO/HVM
A massively parallel, optimal functional runtime in Rust
https://github.com/HigherOrderCO/HVM
Last synced: about 2 months ago
JSON representation
A massively parallel, optimal functional runtime in Rust
- Host: GitHub
- URL: https://github.com/HigherOrderCO/HVM
- Owner: HigherOrderCO
- License: apache-2.0
- Created: 2022-01-03T07:35:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-30T14:49:28.000Z (7 months ago)
- Last Synced: 2024-05-30T16:35:14.248Z (7 months ago)
- Language: Cuda
- Homepage: https://higherorderco.com
- Size: 7.19 MB
- Stars: 10,016
- Watchers: 97
- Forks: 376
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - HigherOrderCO/HVM - A massively parallel, optimal functional runtime in Rust (Cuda)
- AiTreasureBox - HigherOrderCO/HVM - 12-07_10552_0](https://img.shields.io/github/stars/HigherOrderCO/HVM.svg)|A massively parallel, optimal functional runtime in Rust| (Repos)
- awesome-rust-formalized-reasoning - High-order Virtual Machine (HVM) - massively parallel, optimal functional runtime. (Programming Language / Libraries)
- StarryDivineSky - HigherOrderCO/HVM
- awesome-cuda-and-hpc - HVM
- awesome-cuda-and-hpc - HVM
- awesome-rust-list - HVM
- awesome-rust-list - HVM
README
Higher-order Virtual Machine 2 (HVM2)
=====================================**Higher-order Virtual Machine 2 (HVM2)** is a massively parallel [Interaction
Combinator](https://www.semanticscholar.org/paper/Interaction-Combinators-Lafont/6cfe09aa6e5da6ce98077b7a048cb1badd78cc76)
evaluator.By compiling programs from high-level languages (such as Python and Haskell) to
HVM, one can run these languages directly on massively parallel hardware, like
GPUs, with near-ideal speedup.HVM2 is the successor to [HVM1](https://github.com/HigherOrderCO/HVM1), a 2022
prototype of this concept. Compared to its predecessor, HVM2 is simpler, faster
and, most importantly, more correct. [HOC](https://HigherOrderCO.com/) provides
long-term support for all features listed on its [PAPER](./paper/PAPER.pdf).This repository provides a low-level IR language for specifying the HVM2 nets
and a compiler from that language to C and CUDA. It is not meant for direct
human usage. If you're looking for a high-level language to interface with HVM2,
check [Bend](https://github.com/HigherOrderCO/Bend) instead.Usage
-----> DISCLAIMER: Windows is currently not supported, please use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) for now as a workaround.
First install the dependencies:
* If you want to use the C runtime, install a C-11 compatible compiler like GCC or Clang.
* If you want to use the CUDA runtime, install CUDA and nvcc (the CUDA compiler).
- _HVM requires CUDA 12.x and currently only works on Nvidia GPUs._Install HVM2:
```sh
cargo install hvm
```There are multiple ways to run an HVM program:
```sh
hvm run # interpret via Rust
hvm run-c # interpret via C
hvm run-cu # interpret via CUDA
hvm gen-c # compile to standalone C
hvm gen-cu # compile to standalone CUDA
```All modes produce the same output. The compiled modes require you to compile the
generated file (with `gcc file.c -o file`, for example), but are faster to run.
The CUDA versions have much higher peak performance but are less stable. As a
rule of thumb, `gen-c` should be used in production.Language
--------HVM is a low-level compile target for high-level languages. It provides a raw
syntax for wiring interaction nets. For example:```javascript
@main = a
& @sum ~ (28 (0 a))@sum = (?(((a a) @sum__C0) b) b)
@sum__C0 = ({c a} ({$([*2] $([+1] d)) $([*2] $([+0] b))} f))
&! @sum ~ (a (b $([+] $(e f))))
&! @sum ~ (c (d e))
```The file above implements a recursive sum. If that looks unreadable to you -
don't worry, it isn't meant to. [Bend](https://github.com/HigherOrderCO/Bend) is
the human-readable language and should be used both by end users and by languages
aiming to target the HVM. If you're looking to learn more about the core
syntax and tech, though, please check the [PAPER](./paper/PAPER.pdf).