
Flowlog (v4.6.4) is an ISO-style Prolog system
implemented as a single, portable C file (flowlog.c), with a focus on
running unmodified Prolog search faster on multicore
CPUs.
It provides:
wamvm, wam,
interp/tree)Prolog is a great fit for search problems, constraint-style programming, and symbolic manipulation, but classic implementations tend to exploit only limited parallelism automatically. Flowlog’s goal is to keep Prolog’s familiar ISO semantics while also making it easy to:
download all files:
Build:
cd flowlog
makeOr compile directly:
cd flowlog
cc -O2 -Wall -Wextra -pthread flowlog.c -lm -o flowlogRun the REPL:
./flowlogLoad a file and run a goal:
./flowlog program.pl -g 'main.'Control the number of worker threads:
./flowlog --threads 12 program.pl -g 'goal(X).'Flowlog ships three execution engines:
wamvm — bytecode WAM VM (default).
Designed to be fast and parallel-friendly; may fall back to
wam/interp if a feature is not supported in
VM-only mode.wam — a “WAM-lite” direct solver (still a Prolog
engine, but not a classic WAM bytecode VM).interp / tree — a full tree-walking
interpreter (useful as the most conservative reference behavior).Select an engine:
./flowlog --engine wamvm program.pl -g 'goal.'
./flowlog --engine wam program.pl -g 'goal.'
./flowlog --engine interp program.pl -g 'goal.'Flowlog’s parallel features are opt-in/controllable so you can choose between classic behavior and maximum throughput:
The main user-facing switch is the parallel profile:
fast — prefer throughput; may return solutions in a
different order than classic Prologiso — prioritize classic ordering/behavior where
possibleoff — disable Flowlog parallelism features./flowlog --parallel-profile fast program.pl -g 'goal.'
./flowlog --parallel-profile iso program.pl -g 'goal.'
./flowlog --parallel-profile off program.pl -g 'goal.'Flowlog also supports the same controls as Prolog flags (so an ISO Prolog program can enable them explicitly when running under Flowlog):
:- set_prolog_flag(flowlog_parallel_profile, fast).Flowlog targets ISO/IEC 13211-1 behavior for the core language and built-in predicates. The recommended way to check conformance in this repo:
cd flowlog
make test
make test-inriaTo lock in that the INRIA suite runs entirely in the
wamvm VM (no fallback):
make test-inria-wamvm-vmonlyStart here:
README.md — high-level
overviewQUICKSTART.md —
build + first runUSER_GUIDE.md —
using Flowlog as a Prolog system (REPL, loading, running)CLI.md — CLI flags and
environment variablesCore references:
PREDICATES.md —
built-in predicates and evaluable functorsISO_CHECKLIST.md
— checklist of ISO predicate coverageCONFORMANCE.md —
conformance strategy + test suitesParallel/runtime internals:
PARALLELISM.md —
OR/AND parallelism model, profiles, tradeoffsIMPLEMENTATION.md —
overall architecture (parser → program → engine → runtime)TECHNICAL_DETAILS.md
— data structures, memory model, low-level notesWAM_ROADMAP.md —
notes/roadmap for engine coverage and performance workContributing:
DEVELOPMENT.md —
development workflow and conventionsTROUBLESHOOTING.md —
common build/runtime issuesBenchmarks and tests:
BENCHMARKS.md —
benchmark harnesses and reference programs (includes full source)TESTS.md — regression
tests and ISO suite runners (includes full source)These tables are derived from the raw timing logs in this repo: magic_square_timings.txt
and nqueens_timings.txt.
Times are wall-clock real seconds (lower is better), sorted
fastest → slowest.
Magic square timings (magic_square(4, _)):
| program | engine | profile | time |
|---|---|---|---|
magic_square(4) |
flowlog-wamvm |
fast |
34.76s |
magic_square(4) |
flowlog-wam |
fast |
37.28s |
magic_square(4) |
flowlog-wamvm |
iso |
115.27s |
magic_square(4) |
flowlog-wam |
iso |
125.12s |
magic_square(4) |
flowlog-tree |
fast |
271.67s |
magic_square(4) |
flowlog-tree |
iso |
637.05s |
magic_square(4) |
scryer-prolog |
- |
1815.01s |
magic_square(4) |
tpl |
- |
2636.00s |
N-queens timings (nqueens(13, _)):
| program | engine | profile | time |
|---|---|---|---|
nqueens(13) |
flowlog-wamvm |
fast |
1.82s |
nqueens(13) |
flowlog-wam |
fast |
6.95s |
nqueens(13) |
flowlog-wamvm |
iso |
7.57s |
nqueens(13) |
flowlog-wam |
iso |
7.71s |
nqueens(13) |
flowlog-tree |
fast |
14.19s |
nqueens(13) |
flowlog-tree |
iso |
25.00s |
nqueens(13) |
scryer-prolog |
- |
30.39s |
nqueens(13) |
tpl |
- |
41.42s |
Parallel execution in Prolog has a long research lineage:
Flowlog’s approach is:
If you’re new: start with QUICKSTART.md, then skim USER_GUIDE.md and PARALLELISM.md.
Flowlog has gone through a few distinct implementation phases. This is a high-level timeline of the ideas that shaped the current system:
wamvm) as the default engine, aiming for higher
instruction-cache locality and tighter inner loops while still
supporting Flowlog’s OR/AND parallel policies. VM-only conformance runs
(no fallback) make it easier to track and close remaining feature
gaps.