Skip to content

About

Deterministic typed computation graphs for parallel CPU and CUDA execution in .NET.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

89 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MathBlocks

MathBlocks is a .NET 10 library for immutable, typed computation graphs with deterministic CPU and CUDA execution. Its standard catalog contains 337 versioned mathematical operations, and every operation can be exchanged through both OpenMath 2.0 and Strict Content MathML 3.0.

Install

Install the Supprocom.MathBlocks package from NuGet.org; CUDA execution also requires the platform dependencies described in the development guide.

dotnet add package Supprocom.MathBlocks --version 0.5.2

Build a program

Use MathBlockProgramBuilder to create a type-checked directed acyclic graph, then evaluate it with named inputs; the programming model explains contracts, versions, values, execution, and ownership boundaries.

using Supprocom.MathBlocks;

var builder = new MathBlockProgramBuilder(MathBlockCatalog.Standard);
var width = builder.Input("width", MathBlockType.Scalar());
var height = builder.Input("height", MathBlockType.Scalar());
var area = builder.Apply("scalar.multiply", inputs: [width, height]);
var program = builder.Output("area", area).Build();

var result = program.Evaluate(new Dictionary<string, MathBlockValue>
{
    ["width"] = MathBlockValue.Scalar(6d),
    ["height"] = MathBlockValue.Scalar(4d)
});

Console.WriteLine(result["area"].AsScalar());

Exchange formulas

MathBlockOpenMath preserves a complete typed program, while MathBlockFormulaInterchange projects one selected output as conventional OpenMath or Content MathML with an exact semantic annotation; all 337 standard operations have direct mappings.

var mathMl = MathBlockFormulaInterchange.Export(
    program,
    "area",
    MathBlockFormulaFormat.ContentMathMl);

var imported = MathBlockFormulaInterchange.Import(
    mathMl,
    MathBlockFormulaFormat.ContentMathMl);

Choose an API

Each public entry point has one focused responsibility, so consumers can use notation, managed execution, or low-level CUDA composition independently.

Goal Entry point Guide
Build and evaluate a typed graph MathBlockProgramBuilder, MathBlockProgram Programming model
Preserve a complete typed program MathBlockOpenMath OpenMath API
Exchange one standard formula MathBlockFormulaInterchange Formula interchange API
Compose or run CUDA work MathBlockCudaDeviceModule, MathBlocksCUDAWorker CUDA integration

Documentation

The README is intentionally brief; detailed contracts, limits, dependencies, security rules, performance targets, and contributor commands live in the guides below.

Topic Document
Operations, values, programs, and CPU execution Programming model
Canonical full-program OpenMath OpenMath API
OpenMath and Content MathML formula exchange Formula interchange API
Device dispatch, managed CUDA, ABI, and performance CUDA integration
Prerequisites, dependencies, build, test, and packaging Development guide

Build from source

Install the .NET 10 SDK before restoring the repository; CUDA tests additionally require a compatible NVIDIA driver and CUDA toolkit, as detailed in the development guide.

dotnet restore Supprocom.MathBlocks.Tests/Supprocom.MathBlocks.Tests.csproj
dotnet build Supprocom.MathBlocks.Tests/Supprocom.MathBlocks.Tests.csproj --configuration Release
dotnet test Supprocom.MathBlocks.Tests/Supprocom.MathBlocks.Tests.csproj --configuration Release

License

MathBlocks is licensed under AGPL-3.0-only. The NOTICE file contains the project notice and source offer. Dependency notices and separate license terms are in THIRD-PARTY-NOTICES.md.

About

Deterministic typed computation graphs for parallel CPU and CUDA execution in .NET.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages