bug-libmatheval
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-libmatheval] libmatheval not thread safe?


From: Aleksandar Samardzic
Subject: Re: [bug-libmatheval] libmatheval not thread safe?
Date: Sat, 2 Jul 2011 19:16:21 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jun 30, 2011 at 12:32:42PM -0400, nate lust wrote:
> Sorry it has taken so long to get back to you, Im working on my phd so my
> time comes and goes. Im specifically trying to write a python c extension,
> which takes some numbers (or arrays) and a string representing a formula,
> and uses openmp and libmatheval to compute the output. I will attach a copy
> of the code as it stands now. Thank you for the help.

Hi Nate,

Thanks for providing your code.  You're right - libmatheval is not
thread-safe for this type of usage: this is because libmatheval is
replacing, before evaluation, value of each variable into the expression
tree (this is by design, to speed up the evaluation somewhat).  As a
workaround, I'd suggest creating one evalutor object (passing the same
string to evaluator_create() each time) for each thread, which means
moving evaluator_create()/evalutor_destroy() calls into the "omp
parallel" block.

Regards,
Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]