On Thu, 11 Apr 2019, Artur Tarassow wrote:
Am 11.04.19 um 18:12 schrieb Sven Schreiber:
> Am 11.04.2019 um 17:55 schrieb Artur Tarassow:
>> Just out of curiosity: Gretl wouldn't compute stuff in parallel
>> out-of-box, right?
>
> Hehe, well if "somebody" implemented the cross-array operation natively
> and used OpenMP or stuff like that then perhaps it would... otherwise:
> not, I guess.
Of course, I rather meant (without saying it explicitly) whether there is
some way to exploit C in a simple way to do this. But I guess this is rather
a non-trivial issue...
Yes, non-trivial. The thing is, with feval() "anything could happen"
(that is, any part of the libgretl code could be visited as a result
of the function call). Getting this right with OpenMP would require
that libgretl as a whole is thread-safe.
That's a worthy ambition but it's not the case at present. When we
employ OpenMP internally we're careful only to call functions that
we know to be thread-safe.
Also there's the thread-contention issue: if multiple threads called
simultaneously (say) a matrix inversion routine that's itself
multi-threaded (hello, openblas!) the results would probably not be
pretty. (Again, in internal use of OpenMP we take pains to avoid a
cascade of multiple threads each calling multiple threads, but it
wouldn't be easy to extend this to the case of simultaneous calls to
arbitrary libgretl functions.)
Nonetheless, non-trivial \neq impossible, so maybe some day!
Allin