Parallelism and PROLOG

There used to be a parallel version of PROLOG called ParLog. What happened to it?

  • Does anyone know of a working implementation? I couldn’t find anything.
  • Is it worthwhile, i.e., are considerable speedups possible for practical applications?

Asking more generally, how is SWI doing in terms of automatic, VM-level parallelization? Sure, I can launch multiple threads, but I am more looking for something like tabling, i.e. a directive

:-concurrent foo/1.
foo(1):- ...
foo(2):- ...
foo(3):- ...

which would automatically distribute the different clauses of foo\1 to different cores. Or maybe just to different threads and then let the OS figure out how to distribute the threads over cores? I’m just wondering. Any ideas?

3 Likes

Not. It only has threads. There are some high level primitives such as concurrent/3, concurrent_maplist/N, etc.

Although quite some effort was put into this in the 90s of the last century, I don’t think
much survived (if anything). I guess it is just too hard. You can do quite interesting
stuff using threads though and this isn’t all that complicated.

Using tabling (SLG resolution), there are more opportunities for concurrency. That is one of the things being explored as we speak.

2 Likes

My recollection of Parlog and similar is that they didn’t gain much by their fine-grained parallelism, due to the cost of setting up the parallel execution of guards; and they lost some of the backtracking capabilities of Prolog by using guards, so the language was less expressive. In effect, they ended up with a language roughly similar to Erlang in capabilities; but Erlang seems to be far superior in exploiting multi-core and multi-CPU systems.

1 Like