[GiNaC-list] is ginac thread safe for this case?

Jens Vollinga jensv at nikhef.nl
Sun Jun 13 13:27:26 CEST 2010


Am 13.06.2010 12:35, schrieb Alexei Sheplyakov:
> The reference counting in GiNaC is not thread safe. Therefore one thread
> might delete an expression which is used by another thread. Hence you
> *really* can't use GiNaC from different threads.

I completely agree with your last sentence! This is what I wrote in my 
last mail (but maybe you consider Russian roulette not as dangerous as I 
do ... ;-) ).

I just wanted to explain more than just saying "It doesn't work.". I 
didn't mention refcounting, because I think in his setup it doesn't 
cause a problem, or does it?.

> Only few symbolic algorithms can be parallelized, and performance gain

That might be true for "schoolbook" algorithms like gcd, factorization, 
etc, but not for more complex computational tasks involving cascades of 
manipulation steps performed on large number of expressions.

> (if any) is not that big. So why bother?

Aforementioned tasks can in principle hope for huge performance gains 
depending on the number of cpu cores.

Of course, one could statically link ginac/cln and run multiple 
instances of one's own program with ipc here and then to achieve some 
sort of parallelization. But I don't like that idea.


More information about the GiNaC-list mailing list