python-multiprocessing

Python pyqt6 window blocks main loop

Python pyqt6 window blocks main loop Question: I have a small program that does something, but i want to "switch modes", for now i press a key and an input prompts on the console, but to make it easier i want to make a window with pyqt6, the problem is that the window blocks or …

Total answers: 1

Return variable from python multi-process

Return variable from python multi-process Question: My original code looks similar to this toy example. It creates two random matrices, multiplies them and saves the output in a list. import numpy as np n = 100 N = 10 out = [1] * N for i in range(0, N): A = np.random.rand(n, n) B = …

Total answers: 1

It is not possible to implement multithreaded programming in python with the multiprocessing library. The class is initialized several times

It is not possible to implement multithreaded programming in python with the multiprocessing library. The class is initialized several times Question: At first, the error Can’t pickle local object was given. I found a solution to use multiprocess instead of the multiprocessing library, but now the class in which the method is located is initialized …

Total answers: 2

How to show periodic report from queue in multiprocesssing process in Python

How to show periodic report from queue in multiprocesssing process in Python Question: I am using multiprocessing package in Python to start a run in a subprocess to dedicate a thread for the run so that the rest of the threads on the machine can be used for heavy computation. While the process is running, …

Total answers: 1

Python Multiprocessing Queue and Pool slower than normal loop

Python Multiprocessing Queue and Pool slower than normal loop Question: I am trying to implement multiprocessing in a Python program where I need to run some CPU intensive code. In my test code the multiprocessing Queue and the multiprocessing Pool are both slower than a normal loop with no multiprocessing. During the Pool section of …

Total answers: 1

ProcessPoolExecutor using map hang on large load

ProcessPoolExecutor using map hang on large load Question: Experiencing hangs running ProcessPoolExecutor on map, only on a relatively large load. The behaviour we see is that after about 1 minutes of hard working, job seems to hang: the CPU utilization drops sharply then becomes idle; the stack trace also seems to show the same portion …

Total answers: 1

Error while using multiprocessing in Pygame

Error while using multiprocessing in Pygame Question: i’m making a text-based RPG and am trying to use multiproccessing to run both the pygame check function and the game function at the same time. This is my first time using multiprocessing so i’m not entirely sure what is going on. Here is the (important) code: from …

Total answers: 1

How do I nest multiprocessing in multiprocessing, with common variables (python)?

How do I nest multiprocessing in multiprocessing, with common variables (python)? Question: I have a function which is running twice in two parallel processes. Lets call it – parentFunction(). Each process ends with a dictionary which is added to a common list which gives a list of two dictionaries. This I solved by using preset …

Total answers: 1

How to update keys in a dictionary using multiprocessing in Python?

How to update keys in a dictionary using multiprocessing in Python? Question: This is a simplified version of the problem I am trying to solve. I have a dictionary whose keys I am trying to update using multiprocessing with two functions as follows: from multiprocessing import Process, Manager d = {‘a’: [], ‘b’: []} def …

Total answers: 1

Python Multiprocessing custom manager with associated objects

Python Multiprocessing custom manager with associated objects Question: I’m trying to make a class object usable for multiple processes. Unfortunarely this seems to be more of an issue than I anticipated. I have the following class object: class BusObject: inputs: IOObject outputs: IOObject def __init__(self): self.inputs = IOObject() self.outputs = IOObject() with the associated object …

Total answers: 2