[sage-devel] Thread boosting in NTL

2015-10-22 Thread Jean-Pierre Flori
Hi Victor,

I plan to work on the sage ntl interface (which was written before cython 
supported c++) during sage days 70 in November. Hopefully I ll also look into 
enabling threading and exceptions.

Best,
JP

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Thread boosting in NTL

2015-10-22 Thread Thierry Dumont
Le 21/10/2015 23:38, Victor Shoup a écrit :
> Just in case anyone is interested...
> 
I am interested.

> I released a new version of NTL that offers a new "thread boosting" feature,
> which utilizes multiple cores to speed up certain computations.
> This is a work in progress...as of now, only basic operations in ZZ_pX
> are thread boosted. 
> 
> You can see a report on the effect of thread boosting on polynomial
> factorization
> here: http://www.shoup.net/ntl/boost.pdf
> 
> Short synopsis: using 16 cores, NTL's (already pretty fast) algorithm
> for factoring polynomials over ZZ_p now runs 10-12 times faster. This is
> a result of boosting the low-level ZZ_pX arithmetic...the higher-level
> factoring routines are completely unchanged.
> 

Just some questions:

1) what about hyper threading ? I thing your machine has, say 16 cores,
but with hyper threading you can launch 32 threads. On very regular
structures (say: operations on arrays), hyper threading is not (very)
interesting. But when the code becomes more irregular,  when it is not
embarrassingly parallel, it is often interesting to have threads waiting
when other compute.
The Intel Xeon-Phi has 64 cores and 256 "virtual" core for example, and
you get interesting performances only if you are able to use 256 threads
(ok, the Xeon-Phi is a bit strange, but future machines will certainly
have a lot in common with it)

2) You seem to use a direct management of threads; how long do threads
live? launching a thread takes micro-seconds, which is not neglectable.
Open-MP launches all the threads at the first parallel instruction, and
never stops them.

3) Performances are improved if you force the threads to stay on the
same slot (as the machine is certainly numa).

4) Did you have a look at TBB library ? The task stealing paradigm is
very interesting and not difficult to understand (even sometime simpler
than OpenMP).

It should be interesting to look at your code using a tool like VTune. I
can do it if your code is available.

t.d.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
<>

Re: [sage-devel] Thread boosting in NTL

2015-10-22 Thread Jeroen Demeyer

On 2015-10-22 09:59, Jean-Pierre Flori wrote:

Hi Victor,

I plan to work on the sage ntl interface (which was written before cython 
supported c++) during sage days 70 in November.


Cool. Let's do this! I already had a look at it earlier and it's really 
a huge mess, it's probably more work than you think.


One annoying property about this "cleanup NTL" project is that it 
naturally leads to a patchbomb, there is no way to split it up in small 
patches.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Thread boosting in NTL

2015-10-22 Thread Victor Shoup
I implemented a simple thread pool, so threads are long lived and wake up when 
there is work to do. The thread pool class is pretty easy to use. 

Have not tried hyperthreading. The sys admins who are in charge of the machine 
are not keen to turn it on. 

All the code is available on my Web site. 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Thread boosting in NTL

2015-10-21 Thread Victor Shoup
Just in case anyone is interested...

I released a new version of NTL that offers a new "thread boosting" feature,
which utilizes multiple cores to speed up certain computations.
This is a work in progress...as of now, only basic operations in ZZ_pX
are thread boosted. 

You can see a report on the effect of thread boosting on polynomial 
factorization
here: http://www.shoup.net/ntl/boost.pdf

Short synopsis: using 16 cores, NTL's (already pretty fast) algorithm for 
factoring polynomials over ZZ_p now runs 10-12 times faster. This is a 
result of boosting the low-level ZZ_pX arithmetic...the higher-level 
factoring routines are completely unchanged.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.