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

[Feature] Thread-safe plugin implementation #495

Open
1tnguyen opened this issue Nov 5, 2021 · 1 comment
Open

[Feature] Thread-safe plugin implementation #495

1tnguyen opened this issue Nov 5, 2021 · 1 comment

Comments

@1tnguyen
Copy link
Member

1tnguyen commented Nov 5, 2021

There is a need to use XACC's plugins in a thread-safe manner (multi-threading).

e.g., https://github.com/eclipse/xacc/pull/455/files

Using mutex to guard member functions may not be sufficient since service implementations may have internal states (e.g., set by initialize()).

Hence, to enable safe multi-threading of XACC, we should make all services cloneable, i.e., the service registry returns independent instances of the plugin when requested.

For example, one potential systematic way to do this is to make Identifiable (all services are derived from this) also cloneable.

@ahayashi
Copy link

@tnguyen-ornl thank you for opening this issue!

Just for future references, the pull request above makes NLOptimizer cloneable. Similarly, this pull request for QCOR (https://github.com/ORNL-QCI/qcor/pull/157) makes VQEObjective cloneable.

And I agree with you that we'll need to somehow make all services cloneable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants