Parfeval with backgorund pool cannot read XML file

4 ビュー (過去 30 日間)
Michaela Konstantinou
Michaela Konstantinou 2024 年 8 月 1 日
編集済み: Madheswaran 2024 年 8 月 6 日
Inside the parfeval I am using xml_read with an XML path. This function works properly with a parpool object but not with a backgorundPool
  2 件のコメント
Animesh
Animesh 2024 年 8 月 1 日
Can you attach a code snippet for better understanding of the problem?

サインインしてコメントする。

回答 (1 件)

Madheswaran
Madheswaran 2024 年 8 月 6 日
編集済み: Madheswaran 2024 年 8 月 6 日
Hi Michaela,
I am assuming you are using MATLAB built-in ‘xmlread’ (https://mathworks.com/help/matlab/ref/xmlread.html).
As it is seen from the documentation, ‘backgroundPool’ is a thread based parallel pool.
As you might have seen in the error message, ‘xmlread’ is unfortunately not supported in thread-based workers because of the use of ‘javaMethod’ function in its implementation.
You can view the errors of scheduled function, using ‘parallel.Future’ object, like mentioned below.
>> f = parfeval(backgroundPool, @xmlread, 1, xmlFilePath);
>> f.Error
ans =
ParallelException with properties:
identifier: 'parallel:threadpool:DisallowedBuiltin'
message: 'Use of function javaMethod is not supported on a thread-based worker. Use alternatives supported on the background pool.'
cause: {}
remotecause: {[1×1 MException]}
stack: [2×1 struct]
Correction: []
Please note that if a function supports the thread based environment, it would be explicitly mentioned in the Extended Capabilities section of the documentation. Since nothing is mentioned in the documentation page of ‘xmlread’, it is implied that the function is not supported in the thread-based environment.
Hope this helps!

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by