Giter VIP home page Giter VIP logo

fi-mihej / interprocesspyobjects Goto Github PK

View Code? Open in Web Editor NEW
54.0 2.0 1.0 86 KB

High-performance and seamless sharing and modification of Python objects between processes, without the periodic overhead of serialization and deserialization. Provides fast inter-process communication (IPC) via shared memory. Supports NumPy, Torch arrays, custom classes (including dataclass), classes with methods, and asyncio

Home Page: https://pypi.org/project/InterProcessPyObjects

License: Apache License 2.0

Shell 3.84% Python 96.16%
async asynchronous asyncio fast inter-process-communication ipc linux macos python python3

interprocesspyobjects's People

Contributors

fi-mihej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

interprocesspyobjects's Issues

Discord Invite Invalid

Hey, I am facing an issue using Cengal/this library (SharedMemory seems to mainly come from Cengal) and I want to reach out via Discord (or email), but the link in the README does not work.

if_has_messages not working

Hi,

I am attempting to use this library according to the pattern provided in the very helpful sender.py and receiver.py examples, but am running into an issue.

My application is async and so I want to use the async semantics provided by the library. That said, while I am reasonably experienced with Python, this is my first foray into async, so it's possible that my problem below results from something I am doing wrong.

The issue is that when I try to run my code according to the example in receiver.py, as follows:

        async with ashared_memory_context_manager.if_has_messages() as shared_memory: 

I receive an error indicating:

AttributeError: 'ASharedMemoryManager' object has no attribute 'if_has_messages'. Did you mean: 'has_messages'?

If I try using the has_messages method, like this:

async with self._ashared_memory_manager.has_messages() as shared_memory:

I get this error:

TypeError: 'coroutine' object does not support the asynchronous context manager protocol

I am grateful for any help you can provide.

Many thanks -- I appreciate your work on this project!
--Phil

Use case for sharing memory-cached dataset across processes.

Hi Mihej,

Thank you for your contributions to creating this repo, I'm trying to make use of it in the following scenario, which I think may help others as well so I'm creating an issue here:

I'm writing a PyTorch program that involves training on a large dataset, and I want to cache the whole dataset to memory to speed up training. However, since the dataset is large and I want to run multiple hyperparameter settings at the same time and the same dataset, I want to share the cached dataset across different runs. Could you give a simple example of how I can achieve this?

I think a SharedMemory class and the put_message(dataset), take_message(dataset) methods should work, but I'm not sure if I can call the take_message multiple times across different runs once I've put it.

The dataset I want to cache has the following form:

cached_dataset = [
data_1, # dictionary of several numpy arrays like images, etc
data_2,
...,
]

Do you have any advice on how I can improve the reading performance of the shared dataset? And after I've put the cached dataset into the shared memory, is it safe for me to delete the original cached dataset so that it won't take up twice of the memory?

Thank you for the help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.