SageMath 10.1 for macOs ARM randomly fails to compute the Riemann/Ricci tensor or Ricci scalar when using threads

67 views
Skip to first unread message

Alejandro Marino Vaquero Avilés-Casco

unread,
Oct 2, 2023, 7:42:29 AM10/2/23
to sage-devel
When running sagemath release version 10.1 in macOs for the arm architecture (the target tested has a M2 processor) with multiple threads, the calculation of the Riemann tensor, the Ricci tensor or the Ricci scalar normally fails, although sometimes it randomly success. Executing single thread solves the problem. Looks like a race condition of some kind.

The error is the following:

Process SpawnPoolWorker-37: Traceback (most recent call last): File "/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/multiprocessing/pool.py", line 114, in worker task = get() ^^^^^ File "/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/multiprocessing/queues.py", line 367, in get return _ForkingPickler.loads(res) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/manifolds/differentiable/vectorframe.py", line 220, in <module> from sage.tensor.modules.free_module_basis import (FreeModuleBasis, File "/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/tensor/modules/free_module_basis.py", line 35, in <module> from sage.rings.integer_ring import ZZ File "sage/rings/integer_ring.pyx", line 1, in init sage.rings.integer_ring (build/cythonized/sage/rings/integer_ring.c:18143) r""" File "sage/rings/integer.pyx", line 1, in init sage.rings.integer (build/cythonized/sage/rings/integer.c:55476) r""" File "sage/rings/rational.pyx", line 77, in init sage.rings.rational (build/cythonized/sage/rings/rational.cpp:39842) from .integer_ring import ZZ 
ImportError: cannot import name ZZ

I find the error several times repeated. The error appears even if the system is extremely simple: I tried with 2D cartesian coordinates and the Minkowski metric, and the calculation failed.

I attach the commands in my Jupyter Notebook of the simplest case I tried

---------------------
Parallelism().set(nproc=12) # Commenting this line makes the code work
M = Manifold(2, 'M', structure='Lorentzian')
X.<t,x> = M.chart(r't x:(-oo,+oo)')
g = M.metric()
g[0,0] = -1
g[1,1] = 1
g.ricci_scalar().display()
----------------------


Eric Gourgoulhon

unread,
Oct 3, 2023, 4:55:22 AM10/3/23
to sage-devel
Hi,

Le lundi 2 octobre 2023 à 13:42:29 UTC+2, Alejandro Marino Vaquero Avilés-Casco a écrit :
When running sagemath release version 10.1 in macOs for the arm architecture (the target tested has a M2 processor) with multiple threads, the calculation of the Riemann tensor, the Ricci tensor or the Ricci scalar normally fails, although sometimes it randomly success. Executing single thread solves the problem.

This is the issue
regarding Sage parallel computations on macOS.
Many macOS users are facing it and I hope it will be solved someday...

Eric.


Alejandro Marino Vaquero Avilés-Casco

unread,
Oct 3, 2023, 6:56:24 AM10/3/23
to sage-...@googlegroups.com
Thank you, Eric. Indeed, that’s the issue, and I’m happy to see some clever people are working on it.

--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/F_kWM6GBXl4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/a068f844-3b2f-49fb-8aa7-d0107140b731n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages