Scientist Debugging a Slow Parallel Job
Follow this if your parallel job runs but disappoints: it is slower than expected, uses too much memory, or gives different answers at different worker counts. You will learn to measure where the problem lives, diagnose the root cause, and fix it.
Speedup and Scaling. Before diagnosing a disappointment, quantify it. How much did parallelism actually buy, against which baseline?
Data Movement. A common answer. A closure that looks small can carry its whole enclosing environment to every worker.
Nested Parallelism. Eight workers each starting eight BLAS threads is sixty-four threads on however many cores you have.
Fork, Spawn, and Platform Differences. If the job behaves differently on your laptop and the cluster, this is usually why.
Measuring Memory. Summing RSS across workers double-counts every shared page, which is how a job that fits gets reported as one that does not.
Reproducible RNG. If the answer changes when the worker count changes, the random streams are the first suspect.
Errors and Cleanup. What happens to the other ninety-nine tasks when one of them throws.
For a faster, symptom-first route, try Start from a Symptom. For the deeper story, read Why R Is Difficult to Parallelize.