parfor works but parcluster fails using Cellpose in linux

1 visualización (últimos 30 días)
Yunwei
Yunwei el 6 de Mayo de 2024
Respondida: Swastik Sarkar el 22 de Mayo de 2024
Hello all,
I am trying to run parallel jobs in Matlab in linux system. I used the Matlab Add-on Cellpose, which needs Matlab versoion later than 2023b.
parfor i=1:4
img = imread('calibrated-P01.001.tif');
cp=cellpose;
segmentCells2D(cp,img,ImageCellDiameter=110);
end
The parfor using Cellpose works.
But when I try to use parcluster/createJob/createTask, it falls. Here is the code
clustLocal = parcluster('Processes')
j = createJob(clustLocal,'AutoAddClientPath',true)
createTask(j,@TestCellpose,0,{},'CaptureDiary',true)
submit(j)
function TestCellpose
img = imread('calibrated-P01.001.tif');
cp=cellpose;
segmentCells2D(cp,img,ImageCellDiameter=110);
end
The error message
Error: Unable to resolve the name 'py.MWCellposeWrapper.setModelsFolderPath'
I prefer using parcluster because it can run the code in backgound.
Does anyone know how to solve the problem?
Thanks a lot!
  4 comentarios
Venkat Siddarth Reddy
Venkat Siddarth Reddy el 7 de Mayo de 2024
Editada: Venkat Siddarth Reddy el 7 de Mayo de 2024
It seems the OS is offically supported by MATLAB R2023b( https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/system-requirements-release-2023b-linux.pdf ). I am suspecting there might be an issue in the gateway between python and MATLAB.
Can you run the following code snippet and share the output of it?
pyenv()
string(py.sys.path)'
getenv('PATH')
mwpylib = py.importlib.import_module('MWCellposeWrapper') ;
Yunwei
Yunwei el 7 de Mayo de 2024
Hi,
the output is attached. What pizzles me is in parfor the Cellpose works but not in parcluster.
I wrote path = getenv('PATH').

Iniciar sesión para comentar.

Respuestas (1)

Swastik Sarkar
Swastik Sarkar el 22 de Mayo de 2024
Hello @Yunwei,
It appears you have encountered an issue when utilizing parcluster in conjunction with the Cellpose Library, a problem that was not present when using parfor. Your preference for parcluster stems from its ability to submit tasks that can run in the background.
I recommend exploring the batch function in MATLAB. The batch function is designed to execute commands or scripts in the background, like parcluster, but it specifically spawns parfor loops for its execution. This means you can achieve the same level of background processing that parcluster offers, potentially without the error you encountered.
To learn more about the batch function, please visit the following MATLAB Documentation page:
Hope this will solve your issue.

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by