Re: Matlab parfor equivalent
- Posted by mattlewis (admin) Oct 22, 2012
- 1226 views
As an example, I'm running the SieveBenchmark multiple times in parallel. This does the trick nicely when translated to C; I get full usage of two cores. It fails miserably when iterpreted though with machine-level exceptions. Is something along these lines easily possible with interpreted euphoria?
The translation process puts a lot of your data into normal C routines, where your variables end up in a stack associated with your thread. In the interpreter, this is all managed by the interpreter itself, which is far from thread safe.
Additionally, there are some operations that will not be safe even with translated code. Obviously, any access of file level data will be unsafe. But there are some runtime functions (e.g., sequence slicing) that are not re-entrant and will probably cause weird errors.
Matt