Skip to content

How to parallelise contraction over slices? #178

Answered by jcmgray
vincentmr asked this question in Q&A
Discussion options

You must be logged in to vote

cotengra has a few examples like this one: https://github.com/jcmgray/cotengra/blob/main/examples/ex_mpi_executor.py, the last lines of that script are most relevant. Just call:

tree = tn.contraction_tree(optimize=existing_path_or_optimizer)
arrays = tn.arrays

to get the 'cotengra' form of the contraction.

What I would note is that multi-threading or multiprocessing (basically shared memory parallelization) over slices is likely not beneficial. As long as the individual contractions are parallelized, then the unsliced contraction will require less memory and probably be at least as fast, (no slicing overhead, and as long as the contractions are big, the low level i.e. BLAS threading shoul…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vincentmr
Comment options

@jcmgray
Comment options

Answer selected by vincentmr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants