Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an automatic parallel prolog implementation?

I'm currently doing some research in theoretical computer science, and one of the main tools I'm using is prolog. I've found it particularly handy for writing very quick tests to disprove conjectures.

However, I've gotten to a point where the brute-force search is getting too slow. While I could use a different language, the whole point of my using prolog is that it's extremely fast/simple to write code to test a hypothesis.

I'm wondering, is there an implementation of Prolog that allows for automatic paralellization? It wouldn't have to be razor fast, but ideally I'm looking for something that I could just drop my code into and get at least a small speedup.

I don't know if this is possible. Google search reveals lots of academic articles about automatic parallelism in Prolog, but I didn't come across any implementations. However, I'm really only familiar with SWI-prolog, so I could definitely use advice from someone familiar with many implementations.

My code uses cuts, but I am fairly sure that I can eliminate them. As for IO, the only IO is printing to the console, which could probably be moved outside any parallel code.

like image 811
jmite Avatar asked Feb 26 '13 06:02

jmite


2 Answers

Are you sure you need parallelism to "get at least a small speedup"?

You say that you are only familiar with SWI-Prolog, so try other Prolog systems. According to the results of a benchmark at http://www.probp.com/performance.htm (which may or may not be relevant to your particular problem) you should try B-Prolog, YAP and SICStus-Prolog (this one is not free). If you're lucky, you can get several times speedup just from switching your Prolog system.

Another possible low-cost way to speed up - use a system with tabling support (B-Prolog, XSB or YAP) and just add something like :- auto_table. as a first line of your program. Depending on your problem and your existing program you can get significant speedup (or get no speedup at all).

like image 92
Sergii Dymchenko Avatar answered Oct 08 '22 20:10

Sergii Dymchenko


With Prolog it is not difficult to find parallelism, it is difficult to choose which one to use ;) .

Maybe Parlog - logic based programming language, designed for parallel execution would be of help to you. There is implementation for windows but I am not sure if it uses multiple cores. You could however try to contact the authors there.

like image 26
Davorin Ruševljan Avatar answered Oct 08 '22 20:10

Davorin Ruševljan