Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 1.95 KB

README.md

File metadata and controls

44 lines (28 loc) · 1.95 KB

clj-webgpu

WIP bindings for webgpu.

Rationale

GPUs are much faster for some workloads. I want to be able to write programs that run on my mac as well as with nvidia gpus on linux. Even running the most basic compute shader with Vulkan is really gnarly.

Webgpu is a new cross platform option that is gaining traction and support. Some of the benefits of webgpu vs similar options are:

  • cross platform
  • multiple implementations (dawn, webgpu-native)
  • some compatibility with the web
  • growing ecosystem of tools, technique, documentation, and shaders
  • flexible, high level API

Deps

com.phronemophobic/clj-webgpu {:git/url "https://github.com/phronmophobic/clj-webgpu" :git/sha "daa0179c51c2689c3fabaef650afa1719416aa7d"}
;; native dependencies
com.phronemophobic.cljonda/webgpu-native-darwin-aarch64 {:mvn/version "v0.19.4.1"}
com.phronemophobic.cljonda/webgpu-native-linux-x86-64 {:mvn/version "v0.19.4.1"}
com.phronemophobic.cljonda/webgpu-native-darwin-x86-64 {:mvn/version "v0.19.4.1"}

Usage

See examples.

Native Dependencies

In theory, these examples could run against any webgpu implemtation, but this example has only been tested with webgpu-native, the implementation by Mozilla. The maven native binaries are just reuploads of the releases provided by the wgpu-native github project. You can build or download the native dependencies yourself as long as the shared library is somewhere that JNA can find it. For example, in a folder specified with :jvm-opts ["-Djna.library.path=/path/to/folder/"].

Inspiration

License

Copyright © 2024 Adrian

Distributed under the under Apache License v2.0.