Re: [sage-devel] How would you like your parallel linear algebra ?

2019-03-22 Thread Thierry Dumont
Hi,

May be what openblas is doing could be inspiring.

 Openblas (I hope it did not changed, I have tested this sometime ago)
allows to use the number of thread defined for open_mp (by setting an
environment variable or by program), and also to specify the number of
threads for openblas. This is important (at least for me) when you do
nested parallelism: you have say n threads, each one is using openblas
and thus you dont want openblas to be parallel.

Also, it is possible do get the numer of cpu in the program (but
counting them twice in cas of hyperthreading, and more with exotic
processors (4 threads / cpu with XeonPhi)).

Thierry

Le 22/03/2019 à 11:14, Clement Pernet a écrit :
> Hi,
> 
> In https://trac.sagemath.org/ticket/27444 we are exposing the parallel
> versions (using OpenMP) of fflas-ffpack routines used in SageMath. This
> is only about multicore parallelism, based on OpenMP.
> 
> We would like to discuss on the best design to expose them to the end user:
> 
> 1. Should the default behaviour be sequential or parallel ?
> 
> 2. If the default is parallel, how many cores should be used by default?
> I guess the default should be whatever value openmp_get_numthreads()
> returns, which is usually the number of cores, however, in most systems
> where hyperthreading is enabled, this means that we will use twice as
> many cores as the number of real cores, which will slow down the
> computation.
> 
> 3. What interface do we want for the sage user who wants to
> 
>   3a switch between sequential and parallel,
> 
>   3b specify the number of cores to be used ?
> 
> Should there be some kind of environment variable containing such
> informations?
> 
> Note that passing an extra argument is not (always) an option, as we
> would like that the * operator for matrices benefits from this
> parallization.
> 
> In its current status, the branch on #27444 calls parallel fgemm when
> multiplying two modn_dense matrices over the maximal number of available
> OMP threads. It currently possible to use a specified number of threads
> by exporting OMP_NUM_THREADS=XXX before lauching sage.
> 
> Thanks for your feedback.
> 
> Clément
> 

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
<>

[sage-devel] How would you like your parallel linear algebra ?

2019-03-22 Thread Clement Pernet

Hi,

In https://trac.sagemath.org/ticket/27444 we are exposing the parallel versions (using OpenMP) of 
fflas-ffpack routines used in SageMath. This is only about multicore parallelism, based on OpenMP.


We would like to discuss on the best design to expose them to the end user:

1. Should the default behaviour be sequential or parallel ?

2. If the default is parallel, how many cores should be used by default? I guess the default should 
be whatever value openmp_get_numthreads() returns, which is usually the number of cores, however, in 
most systems where hyperthreading is enabled, this means that we will use twice as many cores as the 
number of real cores, which will slow down the computation.


3. What interface do we want for the sage user who wants to

  3a switch between sequential and parallel,

  3b specify the number of cores to be used ?

Should there be some kind of environment variable containing such informations?

Note that passing an extra argument is not (always) an option, as we would like that the * operator 
for matrices benefits from this parallization.


In its current status, the branch on #27444 calls parallel fgemm when multiplying two modn_dense 
matrices over the maximal number of available OMP threads. It currently possible to use a specified 
number of threads by exporting OMP_NUM_THREADS=XXX before lauching sage.


Thanks for your feedback.

Clément

--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.