I checked how to determine the number of parallels in parallel, so make a note of it. The number of parallels is determined by evaluating in order from 1 below.
ʻThe number of processor cores returned by Etc.nprocessors`. In a 1 CPU system, even if parallel is used, the number of parallels will be 1 if none of the specifications described below is performed. On the other hand, if the server machine uses multi-core Xoen etc., the number of parallels may become too large and the CPU and memory may be overwhelmed.
PARALLEL_PROCESSOR_COUNT
If the environment variable PARALLEL_PROCESSOR_COUNT
is set, that value is adopted. Is it useful if you always want the same number of parallels because you don't have to specify it each time you call parallel?
You can specify the number of parallels each time with the in_processes / in_threads option of the map method. Is it the most common case to specify here?
Even with Parallel.map ([1, 2, 3], in_process: 10) ...
, the number of parallels is only 3.