parfor works but parcluster fails using Cellpose in linux
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Venkat Siddarth Reddy
am 7 Mai 2024
Bearbeitet: Venkat Siddarth Reddy
am 7 Mai 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') ;
Antworten (1)
Swastik Sarkar
am 22 Mai 2024
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Parallel Computing Fundamentals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!