Error with multithreaded dada2 [Plugin error from dada2. An error was encountered while running DADA2 in R (return code 1)]

The issue is not that you are requesting more threads than are available. It is that each thread you request will increase the cumulative memory load until it goes over the top. This is described on the dada2 issue tracker.

dada2 often takes a good chunk of memory to run on a single thread — it is very difficult to predict how much memory a single run would use but memory issues with a single thread are common enough (just look around this forum for examples). If you set threads=0 (to use all available threads), then you multiply this by a factor of N. To the extent that yes you even exceed 1 TB RAM.

So unfortunately I do not think there is an option in dada2 to "run on N threads where N + 1 = the amount that will cause my system to explode", and looking at the dada2 issue tracker it sounds like the recommended workaround is to run on a single thread.

So if the issue for you is that you want to run this routinely without needing to "titrate" the number of threads, I think you should just choose a conservatively small number of threads (say 10) that would be unlikely to eat up too much cumulative memory.

Titrating the reads on any single run is not worth it... you will end up spending more time waiting for successively smaller runs to crash than it would take a single low-threaded run to finish.

:turtle: :rabbit2:

2 Likes