Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects do not propagate across parfor, need save/load methods #98

Open
duncanpo opened this issue Mar 13, 2024 · 0 comments
Open

Objects do not propagate across parfor, need save/load methods #98

duncanpo opened this issue Mar 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@duncanpo
Copy link
Member

The following code would fail:

tr = opentelemetry.trace.getTracer("parfor_example");
sp = startSpan(tr, "main function");
...
parfor i = 1:8
% start a span for this iteration, using the tracer “tr” from main function
sp_i = startSpan(tr, "Iteration" + i);
...
end

Since tr is used both in and outside of the parfor block, parfor would copy and send it to the workers. Running this code would result in this error:

Error using . (line 63)
Unknown proxy ID 3

Error in opentelemetry.trace.Tracer/startSpan (line 125)
id = obj.Proxy.startSpan(spname, contextid, spankind, starttime, ...

This is because the global singleton proxymanager is not copied. In the workers, the proxies only exist in MATLAB but not in C++.

To make objects correctly propagate through to parfor blocks, they need to implement custom save/load methods which should also save/load their C++ counterparts.

@duncanpo duncanpo added the enhancement New feature or request label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant