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

Anonymous

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:

Parallelism().set(nproc=32)
print(Parallelism())


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 close merge delete

There is a section in the Sage reference manual: https://doc.sagemath.org/html/en/refe...

( 2023-01-12 04:37:24 +0200 )edit

Sort by ยป oldest newest most voted

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

more