In the master-worker model with pmap
, what is the correct way of checking for parallel vs. serial execution?
if nprocs() > 1
# do task in parallel
else
# fallback to serial execution
end
or
if nprocs() > 2
# do task in parallel
else
# fallback to serial execution
end
Can the master process perform work without overhead or I should add 1 for safety when querying nprocs()
? Assuming this is to be run on a HPC cluster without inter-node SSH communication.