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

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Sun Jun 13 12:35:52 CEST 2010


On Sun, Jun 13, 2010 at 11:50:35AM +0200, Jens Vollinga wrote:

> You avoided already a lot of possible problems with that list (also
> stay away from integrate(), archiving, output modifiers).

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.
> But things like tensor objects, which you probably don't use, and
> gcd, which you might use implicitly, use static local variables that
> make these internal ginac functions non-reentrant (it probably works
> most of the time, though, but hey, it's russian roulette).

> This ginac code could actually be made thread-safe, I think.

Only few symbolic algorithms can be parallelized, and performance gain
(if any) is not that big. So why bother?

Best regards,

More information about the GiNaC-list mailing list