Bill Allombert on Wed, 26 Sep 2012 12:57:53 +0200


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

Re: A problem about the parallel PARI.


On Wed, Sep 26, 2012 at 02:58:29PM +0800, mathewes@sjtu.edu.cn wrote:
> Dear developer,
> 1.I meet some trouble when I use posix thread in my code. I had tried many
> ways to avoid problem in my code, but I was still confused about the result.
> So I want to know whether I could use posix thread in my code when I had used
> the pari.

Yes, but there are some conditions:
1) you need to build PARI with TLS support, by using the flag --enable-tls to Configure, e.g.
./Configure --enable-tls
2) you need to use the pari_thread_* functions to initialize each threads. 

> 2.As the libpari.pdf stated that we could use pari_thread, but I found some
> problem when I wanted to use it.
> "./thread: error while loading shared libraries: libpari-tls.so.3: cannot
> open shared object file: No such file or directory"
> "/usr/bin/ld: avma: TLS reference in main2.o mismatches non-TLS definition in
> /usr/local/lib/libpari.so section .bss"

This suggests you did not run 'make clean' after './Configure --enable-tls',
and you did no run 'make install' afterward.

I would suggest you reinstall PARI from scratch making sure to use --enable-tls.

To test your installation, you can do
cd examples; make TARGET=thread EXTRALIBS=-lpthread; ./thread-dyn

> The above examples are two errors when I want to use it.
> 3.The last question is whether the MPI and OpenMp could be used when I use the pari libary.

I would not advise in favor of OpenMP, but this is possible, please see the
file examples/openmp.c.

Concerning MPI, it depends on what you need exactly.

However, we provide an experimental git branch 'bill-mt-relinker' which provide
native support in GP and libpari for MPI and POSIX thread. 
I am ready to help you using it.

Cheers,
Bill.