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()
----------------------