By the way, I understand that the current PDL uses the total number of processors as a default for set_autopthread_targ. Is this a good default? The documentation says that the gain after 4 pthreads is not much, and using more could be counterproductive. For example:
No threads: $ perl -MTime::HiRes=time -MPDL -E ' set_autopthread_targ(shift) if @ARGV; $x = zeroes(5000,5000); $y =5; $t=time; $z=$x+$y; say "Time: ", time-$t, "\nThreads: ", get_autopthread_actual(); ' 0 Time: 0.0815010070800781 Threads: 0 Two threads: $ perl -MTime::HiRes=time -MPDL -E ' set_autopthread_targ(shift) if @ARGV; $x = zeroes(5000,5000); $y =5; $t=time; $z=$x+$y; say "Time: ", time-$t, "\nThreads: ", get_autopthread_actual(); ' 2 Time: 0.0741269588470459 Threads: 2 There is a gain, but small. Four threads: mochan@tlahuilli:~$ perl -MTime::HiRes=time -MPDL -E ' set_autopthread_targ(shift) if @ARGV; $x = zeroes(5000,5000); $y =5; $t=time; $z=$x+$y; say "Time: ", time-$t, "\nThreads: ", get_autopthread_actual(); ' 4 Time: 0.0751421451568604 Threads: 4 Slightly worse. Default: mochan@tlahuilli:~$ perl -MTime::HiRes=time -MPDL -E ' set_autopthread_targ(shift) if @ARGV; $x = zeroes(5000,5000); $y =5; $t=time; $z=$x+$y; say "Time: ", time-$t, "\nThreads: ", get_autopthread_actual(); ' Time: 0.0870430469512939 Threads: 48 Even worse with 48 threads. Maybe this is a bad example to show the benefits of pthreads. Is there a simple more convincing case? Regards, Luis -- o W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ Av. Universidad s/n CP 62210 | (*)/\/ \ Cuernavaca, Morelos, México | moc...@fis.unam.mx /\_/\__/ GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general