Is it possible to use the 'save' function on thread-based workers in MATLAB Parallel Computing Toolbox?

When executing a function containing the 'save' command on parallel workers launched with 'parpool('threads')', the following error occurs:
Use of function save is not supported on a thread-based worker.
I am using Parallel Computing Toolbox R2023a on Windows 11. I launch parallel workers using 'parpool('threads')' and execute a function with 'parfeval'. This function includes the 'save' command to save a .mat file, but the above error is thrown. I understand this is expected behavior, so I have already considered using 'parpool('processes')' instead. Are there any other possible workarounds?  
In my application, workers are launched from App Designer. One possible approach is to return the data from the worker to App Designer and then save it, but since the data size is large, this does not seem appropriate.  
I believe 'parpool('processes')' is the best solution, but I would like to confirm if there are any other options.

 Respuesta aceptada

Cause:
The 'save' function is not supported on thread-based workers in MATLAB releases prior to R2024a. This is a product limitation.
Workaround:
- Use 'parpool('processes')' instead of 'parpool('threads')'.  
- Alternatively, return the data from the worker to the main MATLAB client (such as App Designer) and perform the save operation there. However, this may not be practical if the data is very large.
Permanent Solution:
- Upgrade MATLAB to R2024a or later, where the 'save' function is supported on thread-based workers (see [MATLAB documentation](https://uk.mathworks.com/help/matlab/ref/save.html#refsect-extended-capabilities)).
- If upgrading is not possible and neither workaround is suitable, consider filing an enhancement request to MathWorks, as feature priorities are influenced by customer requests.

1 comentario

I have never heard of Mathworks providing enhancements to older Mathworks versions -- as would be required here if upgrading is not possible.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2023a

Preguntada:

hace alrededor de 23 horas

Comentada:

hace alrededor de 17 horas

Community Treasure Hunt

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

Start Hunting!

Translated by