Opened 8 years ago
Last modified 7 years ago
#18100 closed enhancement
Parallelization of computations on tensors on free modules — at Version 27
Reported by:  Eric Gourgoulhon  Owned by:  

Priority:  major  Milestone:  sage6.10 
Component:  linear algebra  Keywords:  parallelization, free module, tensor 
Cc:  Travis Scrimshaw  Merged in:  
Authors:  Marco Mancini  Reviewers:  Vincent Delecroix 
Report Upstream:  N/A  Work issues:  
Branch:  public/18100parallelization_tensors  Commit:  b0332975733cdda87b65707273fc42975ba96020 
Dependencies:  Stopgaps: 
Description (last modified by )
This ticket implements parallelization of basic operations (arithmetics, contractions) on tensors on free modules of finite rank. The parallelization is performed by means of Python's module multiprocessing
, via the decorator @parallel
. It is implemented in computational methods of classes handling tensor components: sage.tensor.modules.comp.Components
and sage.tensor.modules.comp.CompWithSym
. The user can control the number of processes involved in the parallelization via the singleton class Parallelism
. The latter, introduced in this ticket, is actually generic and can be used in other parts of Sage.
This work is an extension of #15916, within the SageManifolds project (actually the code in this ticket is the basis for parallelization in SageManifolds 0.8). See the metaticket #18528 for an overview.
Change History (27)
comment:1 Changed 8 years ago by
Branch:  → public/18100parallelization_tensors 

Commit:  → 2f9352531d734bad923eb72bb335af843bfed3c8 
comment:2 Changed 7 years ago by
Commit:  2f9352531d734bad923eb72bb335af843bfed3c8 → 208015433bc7538a62c47fb09b27a58def53704d 

Branch pushed to git repo; I updated commit sha1. New commits:
2080154  Renamed class for parallelism in the Singleton class TensorParallelism. Added doc/test for TensorParallelism

comment:3 Changed 7 years ago by
Commit:  208015433bc7538a62c47fb09b27a58def53704d → 5659f29c3a1d5a7ae9601cece8198a6e277384fa 

Branch pushed to git repo; I updated commit sha1. New commits:
5659f29  Added parallelization on tensor product

comment:4 Changed 7 years ago by
Commit:  5659f29c3a1d5a7ae9601cece8198a6e277384fa → 325e83284ff3b7e0fcb3cf3b6c196814ffb5874e 

Branch pushed to git repo; I updated commit sha1. New commits:
325e832  Corrected error in parallelisation of __mul__. Added parallism for the symmetric __add__

comment:5 Changed 7 years ago by
Commit:  325e83284ff3b7e0fcb3cf3b6c196814ffb5874e → 256d26894f461b15acb2be7fb5815fc06cff5405 

Branch pushed to git repo; I updated commit sha1. New commits:
256d268  changed name TensorParallelism to TensorParallelCompute

comment:6 Changed 7 years ago by
Commit:  256d26894f461b15acb2be7fb5815fc06cff5405 → bea739dea7a019607b770eafc5e436392e7f0bbf 

Branch pushed to git repo; I updated commit sha1. New commits:
bea739d  Added Eric corrections to parallelism

comment:7 Changed 7 years ago by
Commit:  bea739dea7a019607b770eafc5e436392e7f0bbf → 81f662cc7cb2a1add3e14d862654d1658f16bb43 

comment:8 Changed 7 years ago by
Milestone:  sage6.6 → sage6.8 

comment:9 Changed 7 years ago by
Commit:  81f662cc7cb2a1add3e14d862654d1658f16bb43 → ea38c84d685446a1de5793cd00d79ea6c5448605 

Branch pushed to git repo; I updated commit sha1. New commits:
ea38c84  In doc, changed processor with process

comment:10 Changed 7 years ago by
Status:  new → needs_review 

comment:11 Changed 7 years ago by
Cc:  Travis Scrimshaw added 

Description:  modified (diff) 
comment:12 Changed 7 years ago by
Description:  modified (diff) 

comment:13 followup: 14 Changed 7 years ago by
Status:  needs_review → needs_info 

Hello,
The name set_nproc
is not appropriate for a function that is intended to be used only for tensor products. Secondly, why are you duplicating the interface with a class TensorParallelCompute
and functions set_nproc
, get_nproc
?
Vincent
comment:14 Changed 7 years ago by
Replying to vdelecroix: Hello Vincent,
Thanks to review our work.
We try to reply to the two points:
1) You are right, the names set_nproc
and get_nproc
are generic names and not clearly referred to tensors, so we propose to changes them in set_nproc_tensor
and get_nproc_tensor
.
2) The functions set_nproc
and get_nproc
were introduced in order to avoid
to the users to typing the two more verbose (and less clear) functions TensorParallelCompute().set(nproc)
and TensorParallelCompute._nproc
Note that the singleton TensorParallelCompute
is not in the global namespace but only the functions set_nproc
and get_nproc
.
Best regards,
Marco
Hello,
The name
set_nproc
is not appropriate for a function that is intended to be used only for tensor products. Secondly, why are you duplicating the interface with a classTensorParallelCompute
and functionsset_nproc
,get_nproc
?Vincent
comment:15 Changed 7 years ago by
Commit:  ea38c84d685446a1de5793cd00d79ea6c5448605 → 819661d309420c1b76e757ba9335061e7a2001f9 

Branch pushed to git repo; I updated commit sha1. New commits:
819661d  Changed variables name : set_nproc to set_nproc_tensor, get_nproc to get_nproc_tensor

comment:16 Changed 7 years ago by
Commit:  819661d309420c1b76e757ba9335061e7a2001f9 → 53c248cd5f915134eb63e96050b0c5b5f9e47996 

Branch pushed to git repo; I updated commit sha1. New commits:
53c248c  Parallelization: corrected doc

comment:17 Changed 7 years ago by
In the last 2 commits we modified the variables name set_nproc get_nproc in set_nproc_tensor and get_nproc_tensor as proposed.
comment:18 Changed 7 years ago by
Status:  needs_info → needs_review 

comment:19 Changed 7 years ago by
Milestone:  sage6.8 → sage6.10 

comment:20 Changed 7 years ago by
Reviewers:  → Vincent Delecroix 

Status:  needs_review → needs_info 
Some more questions:
 I still don't understand why there is an object oriented interface and a function interface. Why not only one?
 Wouldn't it be better to gather everything related to parallelism in a single place? You could mimic what is done for proofs (
sage.structure.proof.proof
) or global options (sage.structure.global_options
). These two are not perfect but at least they intend to be general and reusable. The object oriented interface could be something like:sage: Parallelism().get('tensor') 1 sage: Parallelism().set('tensor', 3) sage: Parallelism().set_default(3) sage: Parallelism().get_default() 3 sage: Parallellism().get_all() { 'tensor': 3, 'xyz': 2 }
(though that could be postponed to some other tickets)
 The functions
get_nproc_tensor
andset_nproc_tensor
should definitely not be in the global namespace as they are very much specialized.
comment:21 Changed 7 years ago by
Commit:  53c248cd5f915134eb63e96050b0c5b5f9e47996 → ade22b1abf6842fac14a3c61da43189d1b0279d4 

Branch pushed to git repo; I updated commit sha1. New commits:
ade22b1  Created Singleton class Parallelism more generic. Persist problem with doc and tests

comment:22 Changed 7 years ago by
Commit:  ade22b1abf6842fac14a3c61da43189d1b0279d4 → 4e64db3784a823a5d9912024c41f0f53e423ad09 

Branch pushed to git repo; I updated commit sha1. New commits:
4e64db3  Fix doctests and documentation issues in class Parallelism

comment:23 followup: 25 Changed 7 years ago by
Thanks for the heavy changes! If you are done with your changes and want a review again you need to switch the status of the ticket from "needs info" to "needs review".
You also need to update the ticket description.
It would be good to advertise this ticket on sagedevel. Other people might be interested (e.g. #18987 for which the parallelization option can use some default).
comment:24 Changed 7 years ago by
Status:  needs_info → needs_work 

comment:25 Changed 7 years ago by
Replying to vdelecroix:
Thanks for the heavy changes! If you are done with your changes and want a review again you need to switch the status of the ticket from "needs info" to "needs review".
Actually a few improvements in the documentation are under way and will be committed soon.
You also need to update the ticket description.
Yes indeed.
It would be good to advertise this ticket on sagedevel. Other people might be interested (e.g. #18987 for which the parallelization option can use some default).
OK.
comment:26 Changed 7 years ago by
Commit:  4e64db3784a823a5d9912024c41f0f53e423ad09 → b0332975733cdda87b65707273fc42975ba96020 

Branch pushed to git repo; I updated commit sha1. New commits:
b033297  Improvements in the documentation of class Parallelism

comment:27 Changed 7 years ago by
Description:  modified (diff) 

Status:  needs_work → needs_review 
New commits:
merged parallelisation from SageManifold
added paralellization