Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parallel sessions in Dyalog APL

Tags:

apl

dyalog

At least one of the single-letter languages (certainly q) has a facility for interprocess communication, a kind of parallel execution of longer-running processes on multiple computers. These sessions could be on the same computer or on a server on a different continent.

With q, I would simply start a server to listen to a particular port, something like q -p 8510, then access it from another q session or other software. Impressively easy.

I remember, in the very distant past, using a mainframe APL system with Shared Variables where I could share a variable with another user. This may have been IBM APL.SV. I didn't think much of that at the time, but today, decades later, Shared Variables sounds like the basis for parallel sessions. Share a variable with another computer.

How could or would I do this today with Dyalog APL, or any other APL, where I could

  • invoke an APL session on another physical computer

  • send it a command or an expression

  • receive a result

  • potentially do this in parallel on many other computers

like image 303
Lurgid Bee Avatar asked Sep 06 '25 03:09

Lurgid Bee


1 Answers

In fact, "Old Fashioned" Shared Variables are still supported in Dyalog APL under Microsoft Windows via the DDE protocol, but they are considered deprecated.

Recent versions of Dyalog APL support parallel or asynchronous execution through isolates, which are separate processes that appear as extensions of the active workspace. Any expression executed within an isolate immediately returns a future. Futures can be passed as arguments to functions, and be manipulated by structural primitives without blocking; if they are passed to a primitive function which needs to know the value they will automatically block until the computation of the result is completed.

The documentation for futures and isolates is online, and there are a number of videos online - for example there is the talk where they were introduced at Dyalog'14 here:

Video thumbnail
Parallel Programming with Dyalog 14.0 on YouTube

In version 17.0 we will be including support for the APLSSH class, which will make it straightforward to launch isolates on remote machines.

Finally, if you want to communicate between APL processes which are already running, the TCP library "Conga" (which is also included in a standard Dyalog installation) allows you to pass APL arrays between processes using TCP/IP, even if the processes are running on different machine architectures. Documentation for Conga is also online.

like image 122
Morten Kromberg Avatar answered Sep 07 '25 22:09

Morten Kromberg