Spawn and multiple cores
Posted: 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...)
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...)