python-multiprocessing

Python multiprocessing: find core ID

匆匆过客 提交于 2020-12-12 18:16:30
问题 I am testing Python's multiprocessing module on a cluster with SLURM. I want to make absolutely sure that each of my tasks are actually running on separate cpu cores as I intend. Due to the many possibilities of configuring SLURM, this is not at all obvious. Therefore, I was wondering if there is a way to get core specific information from the running Python task. I need my Python script to get information about the core it's running on which allows to distinguish between the various cores.

Using more worker processes than there are cores

大兔子大兔子 提交于 2020-12-12 02:07:22
问题 This example from PYMOTW gives an example of using multiprocessing.Pool() where the processes argument (number of worker processes) passed is twice the number of cores on the machine. pool_size = multiprocessing.cpu_count() * 2 (The class will otherwise default to just cpu_count() .) Is there any validity to this? What is the effect of creating more workers than there are cores? Is there ever a case to be made for doing this, or will it perhaps impose additional overhead in the wrong

Using more worker processes than there are cores

二次信任 提交于 2020-12-12 02:06:40
问题 This example from PYMOTW gives an example of using multiprocessing.Pool() where the processes argument (number of worker processes) passed is twice the number of cores on the machine. pool_size = multiprocessing.cpu_count() * 2 (The class will otherwise default to just cpu_count() .) Is there any validity to this? What is the effect of creating more workers than there are cores? Is there ever a case to be made for doing this, or will it perhaps impose additional overhead in the wrong