Ask Your Question

Can SageMath use GPU, or multiple nodes, or multiple CPUs?

asked 2023-01-12 01:36:38 +0200

anonymous user


I use a cloud computer and can access multiple nodes, GPUs, and CPUs. My goal is to accelerate the running time of my SageMath program. All my questions are regarding this subject. I have tried the parallelism technique:


and the program prints:

Number of processes for parallelization:
 - linbox computations: 32
 - tensor computations: 32

but the running time of the program does not change when I do parallelism. Isn't SageMath capable of using multiple CPU cores to run a program?

Also, I was wondering if SageMath can use multiple nodes to run a program.

Can SageMath use GPU?

Does it support OpenMPI?

edit retag flag offensive close merge delete


There is a section in the Sage reference manual:

John Palmieri gravatar imageJohn Palmieri ( 2023-01-12 04:37:24 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2023-01-13 14:00:24 +0200

eric_g gravatar image

updated 2023-01-13 14:01:23 +0200

Parallel computations on multiples nodes are effective in Sage provided they have been implemented for the objects you are manipulating. It is not sufficient to set Parallelism().set(nproc=32) to have it work for any type of computation. For instance, parallelization is effective for computations on differentiable manifolds. Here is an example regarding the computation of the Riemann curvature tensor of the 4-dimensional sphere:

1/ without parallelization:

sage: S4 = manifolds.Sphere(4)
sage: g = S4.metric()
sage: %time g.riemann()
CPU times: user 4.88 s, sys: 47.8 ms, total: 4.92 s
Wall time: 3.89 s

2/ with parallelization on 8 cores:

sage: Parallelism().set(nproc=8)
sage: S4 = manifolds.Sphere(4)
sage: g = S4.metric()
sage: %time g.riemann()
CPU times: user 491 ms, sys: 158 ms, total: 648 ms
Wall time: 1.59 s
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2023-01-12 01:36:38 +0200

Seen: 360 times

Last updated: Jan 13