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