[mercury-users] Message queuing for Mercury?

Ondrej Bojar bojar at csse.unimelb.edu.au
Wed Jun 6 10:44:46 AEST 2007


Dear Doug Auclair,

all I have is a very dumb wrapper for Sun Grid Engine. It's not a message 
queuing/passing interface in fact. All it allows is predicates to be executed in 
parallel, each on a node in SGE. There is no attempt at multi-platformness. A 
nice feature is that it does caching, so no SGE jobs are submitted if everything 
is ready.

An example how to use this is:

% This is the predicate we will be evaluating externally.
:- pred append_io(string::in, string::out, io::di, io::uo) is det.
append_io(In, In++"-"++HN, !IO) :-
   hostname(HN, !IO).

main(!IO) :-
   debugstr("Started.\n", !IO),
   slave_mode_io("append_io", append_io, write_term, !IO),
     % if we're executed in slave mode, we should just run the append_io mapping
     % predicate

   CDesc = cache_desc("./cache"),

   % an example of the predicate append_io launched in parallel
   start_io(CDesc,
     "append_io", append_io, "ahoj", AppProcess, !IO),
   % here I can do whatever I wish while append_io is calculated
   % and now I just collect the results:
   finish(AppProcess, write_term, read_term, App, !IO),
     % Custom serializers and deserializers are used to transfer the output
     % value.
   debugstr("App Result: ", App, !IO),

   % Another example, each of the members in the MapInput list is mapped
   % independently, as parallel, as SGE allows.
   MapInput = ["a", "b", "c", "d", "e"],
   parallel_map_io(
     CDesc, "append_io", append_io,
     write_term, read_term,
     MapInput,
     MapOutput, !IO),
   debugstr("Map Input: ", MapInput, !IO),
   debugstr("Map Result: ", MapOutput, !IO),

   io__write_string("Done.\n", !IO).

Cheers, Ondrej.

doug.auclair at logicaltypes.com wrote:
> Dear all,
> 
> Is there a message queuing system out there for Mercury available 
> for public use?  We used IBM's MQ series on a very large transaction
> system (1 million+ transactions per day) on a Prolog expert system
> we built, but its C interface (or our home-grown C interface?) was
> ugly, so I'm not particularly attached to writing a Mercury FFI to
> that system; nor do I fancy using Java Messaging (JMS) with a Mercury
> interface.
> 
> Is there a home-grown messaging system with a Mercury interface?
> 
> Sincerely,
> Doug Auclair
> 
> --------------------------------------------------------------------------
> mercury-users mailing list
> Post messages to:       mercury-users at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
> Subscriptions:          mercury-users-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list