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: sage-6.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/18100-parallelization_tensors Commit: b0332975733cdda87b65707273fc42975ba96020
Dependencies: Stopgaps:

Status badges

Description (last modified by Eric Gourgoulhon)

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 Marco Mancini

Branch: public/18100-parallelization_tensors
Commit: 2f9352531d734bad923eb72bb335af843bfed3c8

New commits:

4ca6874merged parallelisation from SageManifold
2f93525added paralellization

comment:2 Changed 7 years ago by git

Commit: 2f9352531d734bad923eb72bb335af843bfed3c8208015433bc7538a62c47fb09b27a58def53704d

Branch pushed to git repo; I updated commit sha1. New commits:

2080154Renamed class for parallelism in the Singleton class TensorParallelism. Added doc/test for TensorParallelism

comment:3 Changed 7 years ago by git

Commit: 208015433bc7538a62c47fb09b27a58def53704d5659f29c3a1d5a7ae9601cece8198a6e277384fa

Branch pushed to git repo; I updated commit sha1. New commits:

5659f29Added parallelization on tensor product

comment:4 Changed 7 years ago by git

Commit: 5659f29c3a1d5a7ae9601cece8198a6e277384fa325e83284ff3b7e0fcb3cf3b6c196814ffb5874e

Branch pushed to git repo; I updated commit sha1. New commits:

325e832Corrected error in parallelisation of __mul__. Added parallism for the symmetric __add__

comment:5 Changed 7 years ago by git

Commit: 325e83284ff3b7e0fcb3cf3b6c196814ffb5874e256d26894f461b15acb2be7fb5815fc06cff5405

Branch pushed to git repo; I updated commit sha1. New commits:

256d268changed name TensorParallelism to TensorParallelCompute

comment:6 Changed 7 years ago by git

Commit: 256d26894f461b15acb2be7fb5815fc06cff5405bea739dea7a019607b770eafc5e436392e7f0bbf

Branch pushed to git repo; I updated commit sha1. New commits:

bea739dAdded Eric corrections to parallelism

comment:7 Changed 7 years ago by git

Commit: bea739dea7a019607b770eafc5e436392e7f0bbf81f662cc7cb2a1add3e14d862654d1658f16bb43

Branch pushed to git repo; I updated commit sha1. New commits:

a6d4bd4Merge branch 'public/18100-parallelization_tensors' into Sage 6.7
81f662cImprove documentation of class TensorParallelCompute.

comment:8 Changed 7 years ago by Marco Mancini

Milestone: sage-6.6sage-6.8

comment:9 Changed 7 years ago by git

Commit: 81f662cc7cb2a1add3e14d862654d1658f16bb43ea38c84d685446a1de5793cd00d79ea6c5448605

Branch pushed to git repo; I updated commit sha1. New commits:

ea38c84In doc, changed processor with process

comment:10 Changed 7 years ago by Marco Mancini

Status: newneeds_review

comment:11 Changed 7 years ago by Eric Gourgoulhon

Cc: Travis Scrimshaw added
Description: modified (diff)

comment:12 Changed 7 years ago by Eric Gourgoulhon

Description: modified (diff)

comment:13 Changed 7 years ago by Vincent Delecroix

Status: needs_reviewneeds_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 in reply to:  13 Changed 7 years ago by Marco Mancini

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 class TensorParallelCompute and functions set_nproc, get_nproc?

Vincent

comment:15 Changed 7 years ago by git

Commit: ea38c84d685446a1de5793cd00d79ea6c5448605819661d309420c1b76e757ba9335061e7a2001f9

Branch pushed to git repo; I updated commit sha1. New commits:

819661dChanged variables name : set_nproc to set_nproc_tensor, get_nproc to get_nproc_tensor

comment:16 Changed 7 years ago by git

Commit: 819661d309420c1b76e757ba9335061e7a2001f953c248cd5f915134eb63e96050b0c5b5f9e47996

Branch pushed to git repo; I updated commit sha1. New commits:

53c248cParallelization: corrected doc

comment:17 Changed 7 years ago by Marco Mancini

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 Marco Mancini

Status: needs_infoneeds_review

comment:19 Changed 7 years ago by Eric Gourgoulhon

Milestone: sage-6.8sage-6.10

This ticket is now the basis for parallelization of demanding computations involving affine connections on differentiable manifolds (#19147), as well as in pseudo-Riemannian manifolds (#19209).

comment:20 Changed 7 years ago by Vincent Delecroix

Reviewers: Vincent Delecroix
Status: needs_reviewneeds_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 and set_nproc_tensor should definitely not be in the global namespace as they are very much specialized.

comment:21 Changed 7 years ago by git

Commit: 53c248cd5f915134eb63e96050b0c5b5f9e47996ade22b1abf6842fac14a3c61da43189d1b0279d4

Branch pushed to git repo; I updated commit sha1. New commits:

ade22b1Created Singleton class Parallelism more generic. Persist problem with doc and tests

comment:22 Changed 7 years ago by git

Commit: ade22b1abf6842fac14a3c61da43189d1b0279d44e64db3784a823a5d9912024c41f0f53e423ad09

Branch pushed to git repo; I updated commit sha1. New commits:

4e64db3Fix doctests and documentation issues in class Parallelism

comment:23 Changed 7 years ago by Vincent Delecroix

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 sage-devel. Other people might be interested (e.g. #18987 for which the parallelization option can use some default).

comment:24 Changed 7 years ago by Eric Gourgoulhon

Status: needs_infoneeds_work

comment:25 in reply to:  23 Changed 7 years ago by Eric Gourgoulhon

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 sage-devel. 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 git

Commit: 4e64db3784a823a5d9912024c41f0f53e423ad09b0332975733cdda87b65707273fc42975ba96020

Branch pushed to git repo; I updated commit sha1. New commits:

b033297Improvements in the documentation of class Parallelism

comment:27 Changed 7 years ago by Eric Gourgoulhon

Description: modified (diff)
Status: needs_workneeds_review
Note: See TracTickets for help on using tickets.