Skip to content

Web Assembly build of the FLINT number theory library

Notifications You must be signed in to change notification settings

isabella232/wasm-flint

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Web Assembly build of the FLINT number theory library

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%