ParrallelProcessing cannot work well on M1 Mac

wrc
Mon, 25 Jul 2022 12:41:28 +0000
Support

Hi, I am developing an extension based on ParrallelProcessing. This extension will run a python script in another CPU core. If the process ends, the script will be run again. It works well in most cases but fails sometimes (after several loops) on my M1 Mac. The 3D Slicer window closes automatically during calculation. I tried to run it on Windows PC. It never failed and everything is well. So, I think the problem comes from Rosetta2 on M1 Mac. I first checked the last line in error log:

[Python] (/Applications/Slicer.app/Contents/Extensions-30822/ParallelProcessing/lib/Slicer-5.0/qt-scripted-modules/Processes.py:230) - Name: state: Starting, last error: UnknownError

If it works fine, the next five lines should be:

[] (unknown:0) - Name: state: Starting, last error: UnknownError
[Python] (/Applications/Slicer.app/Contents/Extensions-30822/ParallelProcessing/lib/Slicer-5.0/qt-scripted-modules/Processes.py:230) – Name: state: Running, last error: UnknownError
Python] (/Applications/Slicer.app/Contents/Extensions-30822/ParallelProcessing/lib/Slicer-5.0/qt-scripted-modules/Processes.py:244) - Name: writing input
[] (unknown:0) - Name: state: Running, last error: UnknownError
[] (unknown:0) - Name: writing input

Therefore, there is something wrong on starting, not running. The error does not come from my script, but in line 227 of Processes.py:

self.start("PythonSlicer", [self.scriptPath,])

I added two logs before and after this line and only the first one is logged correctly.

Another interesting thing is, this phenomenon depends on the script. If I change some function in my script but remain the same input and output, it will work well on my M1 Mac. However, it seems to contradict the previous conclusion.

I think the problem comes from qt.QProcess. It may be not compatible with M1 Mac. I will be thankful if an ARM version 3DSlicer is provided.

7 posts - 2 participants