Spawn and multiple cores
3 posts
• Page 1 of 1
Spawn and multiple cores
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...)
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
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.
-
Morten|Dyalog - Posts: 460
- Joined: Tue Sep 09, 2008 3:52 pm
Re: Spawn and multiple cores
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
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group