All Projects → sinclairzx81 → tesseract

sinclairzx81 / tesseract

Licence: other
WebGL 2.0 GPGPU compute library for JavaScript.

Programming Languages

typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to tesseract

gpuowl
GPU Mersenne primality test.
Stars: ✭ 77 (+175%)
Mutual labels:  gpgpu
CLU
The OpenCL Utility library
Stars: ✭ 18 (-35.71%)
Mutual labels:  gpgpu
pathtracer-webgl2
Path tracing render engine for the web. Both ray tracing for conventional 3d models and ray marching for fractals implemented. Built with WebGL 2 and Angular 2.
Stars: ✭ 45 (+60.71%)
Mutual labels:  gpgpu
CUDAfy.NET
CUDAfy .NET allows easy development of high performance GPGPU applications completely from the .NET. It's developed in C#.
Stars: ✭ 56 (+100%)
Mutual labels:  gpgpu
GWebGPUEngine
A WebGPU Engine for real-time rendering and GPGPU
Stars: ✭ 121 (+332.14%)
Mutual labels:  gpgpu
catseye
Neural network library written in C and Javascript
Stars: ✭ 29 (+3.57%)
Mutual labels:  gpgpu
Shadered
Lightweight, cross-platform & full-featured shader IDE
Stars: ✭ 3,247 (+11496.43%)
Mutual labels:  gpgpu
Curl Noise
Implementation of curl noise for particles simulated on GPU with OpenGL
Stars: ✭ 42 (+50%)
Mutual labels:  gpgpu
rectdetect
Realtime rectangle detector with GPGPU
Stars: ✭ 51 (+82.14%)
Mutual labels:  gpgpu
speedy-vision
GPU-accelerated Computer Vision for JavaScript.
Stars: ✭ 96 (+242.86%)
Mutual labels:  gpgpu
hiperc
High Performance Computing Strategies for Boundary Value Problems
Stars: ✭ 36 (+28.57%)
Mutual labels:  gpgpu
Amplifier.NET
Amplifier allows .NET developers to easily run complex applications with intensive mathematical computation on Intel CPU/GPU, NVIDIA, AMD without writing any additional C kernel code. Write your function in .NET and Amplifier will take care of running it on your favorite hardware.
Stars: ✭ 142 (+407.14%)
Mutual labels:  gpgpu
john-packages
Community packages of John the Ripper (a Docker image, a Flatpak, a Windows PortableApp, and Ubuntu SNAP packages)
Stars: ✭ 31 (+10.71%)
Mutual labels:  gpgpu
arrayfire-java
Java wrapper for ArrayFire
Stars: ✭ 34 (+21.43%)
Mutual labels:  gpgpu
RayTracing
Realtime GPU Path tracer based on OpenCL and OpenGL
Stars: ✭ 120 (+328.57%)
Mutual labels:  gpgpu
Voxel Cone Tracing
Converting vertex meshes to voxel data and visualizing using VCT
Stars: ✭ 74 (+164.29%)
Mutual labels:  gpgpu
GPGPU
Small library for running arbitrary computations on the GPU, using JavaScript or WebAssembly.
Stars: ✭ 72 (+157.14%)
Mutual labels:  gpgpu
node
GPU-accelerated data science and visualization in node
Stars: ✭ 85 (+203.57%)
Mutual labels:  gpgpu
kompute
General purpose GPU compute framework built on Vulkan to support 1000s of cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.
Stars: ✭ 872 (+3014.29%)
Mutual labels:  gpgpu
sycl-bench
SYCL Benchmark Suite
Stars: ✭ 30 (+7.14%)
Mutual labels:  gpgpu

Tesseract

A WebGL 2.0 GPGPU Compute Library for JavaScript.

const context = tesseract.createContext()

const program = context.createProgram(`
  [float] thread (int x) {
    thread[0] = float(x);
  }
`)

const output = context.createFloat1D([1024])

program.execute([output], {})

console.log(output.pull().data) 

// -> [0, 1, 2, 3, ...]

Overview

tesseract is a gpgpu compute library built against the webgl 2.0 graphics api. The library hides away the details of webgl, offering instead a simplified programming model that provides simple integer offset addressing into graphics buffers on the GPU. The library was written primarily to help assist with accellerating large vector / matrix multiplication and to assist with image map / reduce for convolution neural networks.

tesseract supports:

  • 1D, 2D and 3D color and float buffer types with mapping to GLSL 300 es shader profiles.
  • A simplified shader entry point thread function with resolved integer indexing to the output target.
  • Integer based addressing into glsl buffers via [] syntax.
  • supports automatic 32-bit float encode/decode into RGBA for float buffer read back.
  • complete support for multiple render targets (MRT) output buffers.

tesseract is a work in progress, and offered as is for anyone who finds it useful or interesting.

Building the Project

tesseract is written with typescript. You can build the standalone with the following.

npm install typescript -g
npm install typescript-bundle -g
npm run build

the test project can be built with.

npm run build-test

The Thread Function

tesseract programs are parsed GLSL 300 es fragment shaders. Each program defines a thread() function that is used to define the input indexing and output of the program. An example of a thread function is as follows.

const program = context.createProgram(`
[float, color] thread (int x, int y) {
  thread[0] = 1.0; 
  thread[1] = vec4(1.0, 1.0, 1.0, 1.0);
}
`)

// outputs
const output0 = context.createFloat2D(1024, 1024)
const output1 = context.createColor2D(1024, 1024)
program.execute([output0, output1], {})
output0.pull()
output1.pull()

tesseract interprets this program in the following way..

  • the program is only applicable for 2D buffer targets as defined by the (int x, int y) arguments.
  • the program outputs to 2 buffer targets as defined by the [float, color] return type.
  • the first output must be a Float2D buffer type, the second output must be a Color2D buffer type.

Thread Uniforms

Like regular shaders, tesseract supports passing uniforms. tesseract provides a convienent indexer syntax which looks up the pixel integer offset of the given uniform. The following adds two buffers.

const program = context.createProgram(`
  uniform Float1D a;
  uniform Float1D b;
  uniform float   c;

  [float] thread (int x) {
    thread[0] = a[x] + b[x] + c;
  }
`)

const a = context.createFloat1D(4096).map(x => 1).push()
const b = context.createFloat1D(4096).map(x => 2).push()
const c = 2

const output = context.createFloat1D(4096)
program.execute([output], {a, b, c})

output.pull() 

console.log(output.data) // [5, 5, 5, 5, 5, ...]

Buffer Encoding Scheme

tesseract encodes all buffers in TEXTURE_2D buffers (even 3D buffers) for generality, and currently supports 1D, 2D and 3D buffer float and color variants. Future updates to this project may allow for arbituary dimensionality of arrays.

buffers are encoded using a row major 2D encoding scheme.

Floating Point Precision

tesseract currently encodes / decodes 32 bit numbers inside RGBA unsigned byte values (the only supported texture read interface for webgl). Because of this encoding, there is a loss of precision during this encode / decode phase.

Users should be aware of this precision if evaluating tesseract for simulations.

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].