pymp | Easy , OpenMP style multiprocessing for Python on Unix

 by   classner Python Version: Current License: MIT

kandi X-RAY | pymp Summary

kandi X-RAY | pymp Summary

pymp is a Python library. pymp has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can install using 'pip install pymp' or download it from GitHub, PyPI.

This package brings OpenMP-like functionality to Python. It takes the good qualities of OpenMP such as minimal code changes and high efficiency and combines them with the Python Zen of code clarity and ease-of-use.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pymp has a low active ecosystem.
              It has 210 star(s) with 26 fork(s). There are 14 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 20 have been closed. On average issues are closed in 49 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of pymp is current.

            kandi-Quality Quality

              pymp has 0 bugs and 0 code smells.

            kandi-Security Security

              pymp has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pymp code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pymp is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pymp releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              pymp saves you 250 person hours of effort in developing the same functionality from scratch.
              It has 651 lines of code, 46 functions and 8 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pymp and discovered the below as its top functions. This is intended to give you an instant insight into pymp implemented functionality, and help decide if they suit your requirements.
            • Returns the lock
            • Assert that the parallel context is active
            • Get a dictionary of configuration parameters
            • Get the multiprocessing manager
            • Gets the configuration value for a given environment variable
            • Returns the number of threads
            • The thread number
            • Create a queue
            Get all kandi verified functions for this library.

            pymp Key Features

            No Key Features are available at this moment for pymp.

            pymp Examples and Code Snippets

            No Code Snippets are available at this moment for pymp.

            Community Discussions

            QUESTION

            Python Multiprocessing returning results with Logging and running frozen on Windows
            Asked 2020-Oct-14 at 13:48

            I need some help with implementing logging while multiprocessing and running the application frozen under Windows. There are dozens of topics on this subject and I have spent a lot of time reviewing and testing those. I have also extensively reviewed the documentation, but I cannot figure out how to implement this in my code.

            I have created a minimum example which runs fine on Linux, but crashes on Windows (even when not frozen). The example I created is just one of many iterations I have put my code through.

            You can find the minimum example on github. Any assistance to get this example working would be greatly appreciated.

            Thank you.

            Marc.

            ...

            ANSWER

            Answered 2020-Oct-14 at 13:48
            The basic

            On Linux, a child process is created by fork method by default. That means, the child process inherits almost everything from the parent process.

            On Windows, the child process is created by spawn method. That means, a child process is started almost from crash, re-imports and re-executes any code that is outside of the guard cloud if __name__ == '__main__'.

            Why it worked or failed

            On Linux, because the logger object is inherited, your program will start logging. But it is far from perfect since you log directly to the file. Sooner or later, log lines will be overlapped or IO error on file happens due to race condition between processes.

            On Windows, since you didn't pass the logger object to the child process, and it re-imports your pymp_global module, logger is a None object. So when you try logging with a None object, it crashes for sure.

            The solution

            Logging with multiprocessing is not an easy task. For it to work on Windows, you must either pass a logger object to child processes and/or log with QueueHandler. Another similar solution for inter-process communication is to use SocketHandler.

            The idea is that only one thread or process does the logging. Other processes just send the log records. This prevents the race condition and ensures the log is written out after the critical process got time to do its job.

            So how to implement it?
            I have encountered this logging problem before and already written the code.
            You can just use it with logger-tt package.

            Source https://stackoverflow.com/questions/64335940

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pymp

            The package is available from pypi. Due to a name clash, it is available as pymp-pypi:.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/classner/pymp.git

          • CLI

            gh repo clone classner/pymp

          • sshUrl

            git@github.com:classner/pymp.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link