Search code examples
pythondictionarymultiprocessingreduce

Python pool map and choosing number of processes


In setting the number of processes, I'd be keen to see how many threads I can actually use on my machine - how do I find this? Is there a way to determine the number of threads available to me?


Solution

  • Do you want to know the CPU count?

    According to the docs, when you start a pool and don't specify the number of processes, the default number is the number of cpu's on the system:

    processes is the number of worker processes to use. If processes is None then the number returned by cpu_count() is used. If initializer is not None then each worker process will call initializer(*initargs) when it starts.