[ntl] Thread-safety in NTL

Дмитрий Юрьевич Перов perov at phystech.edu
Wed May 27 06:16:21 CDT 2015


Hello,

I'm trying to use NTL in thread-safe mode, but it doesn't seem to work
right. I build NTL with the following options:

> ./configure CXXFLAGS="-g -O2 -pthread --std=c++11 -fPIC" NTL_THREADS=on
> NTL_GF2X_LIB=on
> make


Then I run "make check" and the ThreadTest hangs. Backtrace gives me the
following:

> #0  0x00007ffff7ad7012 in wait () from /lib64/libc.so.6
> #1  0x00000000004105f8 in reap_children ()
> #2  0x0000000000411344 in new_job ()
> #3  0x000000000041a868 in update_file ()
> #4  0x000000000041ae20 in update_goal_chain ()
> #5  0x0000000000403c9f in main ()


It seems like there's a deadlock somewhere.
Futhermore, if i still try to use NTL's PowerXMod() function with GF2X, I
get a segfault with a strange backtrace:

> trunc: bad args
> trunc: bad args
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffe68d3700 (LWP 12615)]
> NTL::GF2X::normalize (this=this at entry=0x7ffff0190ca0
> <NTL::NewtonInvTrunc(NTL::GF2X&, NTL::GF2X const&, long)::g0>)
>     at GF2X.c:77
> 77   while (n > 0 && (*--p) == 0) {
> (gdb) bt
> #0  NTL::GF2X::normalize (
>     this=this at entry=0x7ffff0190ca0 <NTL::NewtonInvTrunc(NTL::GF2X&,
> NTL::GF2X const&, long)::g0>) at GF2X.c:77
> #1  0x00007fffefefabf7 in NTL::trunc (x=..., a=..., m=<optimized out>) at
> GF2X.c:1557
> #2  0x00007fffeff057c1 in NTL::NewtonInvTrunc (c=..., a=..., e=5, e at entry=19936)
> at GF2X1.c:316
> #3  0x00007fffeff05b6d in NTL::InvTrunc (c=..., a=..., e=e at entry=19936)
> at GF2X1.c:345
> #4  0x00007fffeff06550 in NTL::build (F=..., f=...) at GF2X1.c:542
> #5  0x00007fffeff069d0 in NTL::GF2XModulus::GF2XModulus
> (this=0x7fffe68d2dc0, ff=...) at GF2X1.c:647
> #6  0x00007fffefef5b7c in MyClass::my_method (this=this at entry=0x7ffff0190900
> <mr>, state=0x702f40, index=<optimized out>) at me_class.cpp:437
>

The last line here indicates a call to PowerXMod().
What could be the issue here?
Thank you in advance.

Best regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shoup.net/pipermail/ntl_shoup.net/attachments/20150527/d2acd9e1/attachment.html>


More information about the ntl mailing list