from my understanding, the issue is with the memory system of ginac [anyone feel free to correct me on this]. It seems that ginac uses reference counting is some form for ex types. In addition it seems that they store the lookup in STL containers [map]. So when you try to manipulate expressions from multiple threads, they are all trying to access that lookup table. I imagine that it would be a rather formidable task to alter the underlying memory system in ginac. On Mon, Aug 23, 2010 at 12:23 PM, Cristobal Navarro <axischire@gmail.com> wrote:
i understand the frustation :( i once opened a topic too, asking if a particular case would be thread safe, ginac is one of the best symbolic math libraries around, and it has proveed that it works great on large cluster problems, its just that the middle multithreading escenario is missing support, lets hope that in the future there could be plans for doing some work on the thread safety.
On Mon, Aug 23, 2010 at 12:13 PM, Kraus Philipp <philipp.kraus@flashpixx.de> wrote:
Am 23.08.2010 um 16:39 schrieb Cristobal Navarro:
in some cases, parallel symbolic algorithms obtain great performance increase, it all depends how you model the problem. im using ginac with openMPI to paralelize huge tree generators, i had to go the processes paralelism since multithread is not safe, but would be nice to be able to do that on the future
I' working with MPI (on boost) and in this case it works on my test system. But I would like to portage my algorithm without MPI support (on a simple desktop system MPI support is not installed, but on these systems I can use multithreading). I have tried to compile ginac with -pthread on CXXFLAGS and the CLN library. I analyse the compiled code with valgrind, you can show the excerpt:
==51729== Possible data race during write of size 4 at 0x1ea4564 by thread #3 ==51729== at 0x3AB9: GiNaC::refcounted::add_reference() (in main) ==51729== by 0xF7C49F: GiNaC::ptr<GiNaC::basic>::ptr(GiNaC::ptr<GiNaC::basic> const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C4B9: GiNaC::ptr<GiNaC::basic>::ptr(GiNaC::ptr<GiNaC::basic> const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C4D3: GiNaC::ex::ex(GiNaC::ex const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C4ED: GiNaC::ex::ex(GiNaC::ex const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C51F: GiNaC::expair::expair(GiNaC::expair const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C539: GiNaC::expair::expair(GiNaC::expair const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7E4F3: void std::_Construct<GiNaC::expair, GiNaC::expair>(GiNaC::expair*, GiNaC::expair const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib)
==51729== by 0xF7F3E9: GiNaC::expair* std::__uninitialized_copy_aux<__gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, GiNaC::expair*>(__gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, __gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, GiNaC::expair*, __false_type) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib)
==51729== by 0xF7F43C: GiNaC::expair* std::uninitialized_copy<__gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, GiNaC::expair*>(__gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, __gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, GiNaC::expair*) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib)
==51729== by 0xF7F45E: GiNaC::expair* std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, GiNaC::expair*, GiNaC::expair>(__gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, __gnu_cxx::__normal_iterator<GiNaC::expair const*, std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > >, GiNaC::expair*, std::allocator<GiNaC::expair>) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib)
==51729== by 0xF7F518: std::vector<GiNaC::expair, std::allocator<GiNaC::expair> >::vector(std::vector<GiNaC::expair, std::allocator<GiNaC::expair> > const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib)
in the same run:
==51729== Possible data race during read of size 4 at 0x1ea42f4 by thread #3 ==51729== at 0x3AB6: GiNaC::refcounted::add_reference() (in main) ==51729== by 0xF7C5AB: GiNaC::ptr<GiNaC::basic>::ptr(GiNaC::basic&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C5C5: GiNaC::ptr<GiNaC::basic>::ptr(GiNaC::basic&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C5ED: GiNaC::ex::ex() (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF7C604: GiNaC::ex::ex() (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xFCBC50: GiNaC::expairseq::expairseq() (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0x10BD804: GiNaC::mul::mul(GiNaC::ex const&, GiNaC::ex const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0x10BD88C: GiNaC::mul::mul(GiNaC::ex const&, GiNaC::ex const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0x10FF9D0: GiNaC::exminus(GiNaC::ex const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0x10FFDD0: GiNaC::operator-(GiNaC::ex const&, GiNaC::ex const&) (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0x10BDB0C: GiNaC::mul::derivative(GiNaC::symbol const&) const (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib) ==51729== by 0xF965E3: GiNaC::basic::diff(GiNaC::symbol const&, unsigned int) const (in /Developer/opt/Ginac/1.5.8/lib/libginac-1.5.0.dylib)
HTH the developers
Phil
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list