Spawn and multiple cores

Using Dyalog under 'nixes

Spawn and multiple cores

Postby David Lamkins on Wed Jan 09, 2013 3:47 am

I've been experimenting with Spawn (&) on 13.1. I believe that the behavior I'm seeing indicates that the current implementation of multiple threads creates multiple locii of execution, only one of which is active at any given moment. Either that, or I've made some silly mistake in my coding...

I couldn't find anything in the 13.1 manual to support my observation that there's only a single thread of execution at any given instant, but I did find mention of this in the second half of Graeme Donald Robertson's tutorial (which is admittedly Windows-centric, but then I've read that all platform variants are built from the same code base).

Assuming that I'm doing the right thing (essentially: ⎕TSYNC myfun&¨ ⍵), what's my next option to take advantage of a multicore CPU under Linux using only APL code? (IOW, I'm not going to rewrite portions as a shared library and use ⎕NA with Spawn.)

Should I look into hacking parallel.dws to support Linux? Should I use Fork (4000⌶) and some kind of shared channel or file? Or is there something I can look forward to in 13.2...?

(Personally, I'd be happy with being told that I'm doing the wrong thing in 13.1, and that I can run threads on multiple cores simply by writing my code properly...)
David Lamkins
 
Posts: 21
Joined: Sun Aug 26, 2012 7:08 am

Re: Spawn and multiple cores

Postby Morten|Dyalog on Thu Jan 10, 2013 9:39 pm

David Lamkins wrote:the behavior I'm seeing indicates that the current implementation of multiple threads creates multiple locii of execution, only one of which is active at any given moment.

That is correct; current Dyalog APL only runs one APL thread at a time. So unless you are calling asynchronous external libraries, you will only be able to use a single core per Dyalog process.
David Lamkins wrote:Should I look into hacking parallel.dws to support Linux? Or is there something I can look forward to in 13.2...?

Dyalog is already at work on a version of parallel.dws that will support Linux. I am not in a position to promise you a delivery date but I am hopeful that it will be within the next few weeks.
User avatar
Morten|Dyalog
 
Posts: 345
Joined: Tue Sep 09, 2008 3:52 pm

Re: Spawn and multiple cores

Postby David Lamkins on Thu Jan 10, 2013 11:35 pm

Thank you for the information, Morten. I can certainly turn my attention to other parts of my project while awaiting an update. If I get desperate to have parallel execution I can cobble together an application- and Linux-specific solution using Fork and Map.
David Lamkins
 
Posts: 21
Joined: Sun Aug 26, 2012 7:08 am


Return to UNIX and Linux

Who is online

Users browsing this forum: No registered users and 1 guest