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

Add shareable base class #289

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

Add shareable base class #289

wants to merge 18 commits into from

Conversation

ehpor
Copy link
Collaborator

@ehpor ehpor commented Feb 21, 2025

This PR adds a base class for all objects that are shared between processes. A shareable object has a shared state and a local state. The shared state is assumed to be in shared memory and is accessed by the shareable object using a pointer. The local state is internal to the shareable object. Shareable objects have Create() and Open() methods that take a pointer to that shared state to initialize or open. Note: this base class provides no methods for actually sharing this information between processes. That's the job of a SharedMemory or other similar classes. It just formalizes the size and open methods, and provides an enum for all shareable types.

This PR also adds an Event class that combines all other Event implementations into one single class. An Event allows you to wait using multiple methods, choosable at runtime. This will be useful for testing comparing synchronization methods in practice rather than only during tests (like I've been doing so far).

The data stream is also changed to use two shared memory blocks per stream. The first one is for header information, communicating where each data frame is in the buffer. The second is the buffer where the actual data is stored. This allows us to support GPU shared memory in the future (since the header information should not be stored in GPU shared memory but rather on CPU shared memory. Therefore, two separate shared memory buffers is required.

Risk to existing testbeds: no risk. Everything should be refactor only, all modifications are C++ only with no side-effects leaking into Python code.

@ehpor ehpor added the enhancement New feature or request label Feb 21, 2025
@ehpor ehpor requested a review from raphaelpclt February 21, 2025 05:24
@ehpor ehpor self-assigned this Feb 21, 2025
@ehpor ehpor force-pushed the feature/shareable branch from e3a7280 to f8d3123 Compare February 21, 2025 21:24
@ehpor ehpor marked this pull request as ready for review February 21, 2025 21:56
@ehpor
Copy link
Collaborator Author

ehpor commented Feb 21, 2025

@raphaelpclt @ivalaginja This is ready for your review now. I'll do some more testing of edge cases, but I do not see this changing anything significantly other than 1-2 lines here and there, if any.

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

Successfully merging this pull request may close these issues.

1 participant