Git Product home page Git Product logo

wasm-flint's Introduction

Web Assembly build of FLINT: fast library for number theory

This automates the process of building MPFR, MPIR, and FLINT as WASM libraries using emscripten, so they could be used in a web application or from node.js. This thus creates cross platform wasm binaries that make the functionality of FLINT available to node.js or any modern web browser. Currently you might use this by writing a C/C++ program that relies on FLINT, and links in the libraries built using the recipe here, then building that for deployment on the web using emscripten.

Quickstart

This will download and build the three libraries, assuming you have installed the emscripten toolchain.

$ ./build.sh

This should take less than a half hour. They get installed into build/local .

Test a program using FLINT

There are examples in build/flint-2.7.1/examples . For example, to build primegen, do this:

$ emcc primegen.c -o primegen.js -L$PREFIX/lib -I$PREFIX/include/flint -I$PREFIX/include -lflint -lmpir -lmpfr

To run it from node.js:

$ node primegen.js 20

The same instructions should work with any other program there, except for cpp, use em++:

$ em++ partitions.cpp -o partitions.js -L$PREFIX/lib -I$PREFIX/include/flint -I$PREFIX/include -lflint -lmpir -lmpfr
$ time node partitions.js 100093982083408923
p(1178362907) =969255932718701...362545
real    0m1.429s

Note: use the option -s INITIAL_MEMORY=2146435072 to emcc if you want to use more than a tiny amount of RAM.

wasm-flint's People

Contributors

williamstein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.