mosdepth icon indicating copy to clipboard operation
mosdepth copied to clipboard

Out of memory Issue

Open yangyxt opened this issue 2 years ago • 5 comments

Try to calculate the depth on a BAM file around 1Gb, got a prompt: out of memory.

The command I performed is: mosdepth -Q 10 prefix <input_bam>

yangyxt avatar Nov 26 '21 05:11 yangyxt

Here is the error log: image As shown above, no other error message. Just a simple statement: "Out of memory"

yangyxt avatar Nov 26 '21 05:11 yangyxt

Hi, mosdepth will use an amount of memory that is about: 4 bytes * length-of-longest-chromosome. So, on human, where the largest chromosome is about 250 megabases, it will use about 1 GB of memory. If you are using a worfklow manager, I'd recommend to give it double that amount.

brentp avatar Nov 26 '21 13:11 brentp

Hi, mosdepth will use an amount of memory that is about: 4 bytes * length-of-longest-chromosome. So, on human, where the largest chromosome is about 250 megabases, it will use about 1 GB of memory. If you are using a worfklow manager, I'd recommend to give it double that amount.

Hi, thank you for the prompt reply! Appreciated!

The case is, I'm using GNU parallel to run 60 jobs in parallel, each job contains a step of mosdepth processing. The parallel command and the 60 jobs are running under a PBS interactive environment, which has been scheduled with 80 threads and 750 GB RAM. Given that there is no way 60 jobs running mosdepth will take up to near 700 GB, and parallel itself does not set a limit on mem eaten. I'm not sure which command/tool limit the memory usage.

P.S. Just in case, PBS is a job scheduler for HPC. We are using the PBS Pro commercial version as far as I know. Here should be the official website: https://www.altair.com/pbs-works/

yangyxt avatar Nov 26 '21 13:11 yangyxt

Hi, this is likely not a mosdepth issue. The memory used by mosdepth is fixed. So it's something with your scheduler (PBS) or parallelizer (gnu parallel) and the way you're using them together.

brentp avatar Nov 26 '21 13:11 brentp

Hi, this is likely not a mosdepth issue. The memory used by mosdepth is fixed. So it's something with your scheduler (PBS) or parallelizer (gnu parallel) and the way you're using them together.

I thought the same at the beginning. Then I googled about this error message and some posts says it may come from htslib. Is mosdepth using htslib?

yangyxt avatar Nov 27 '21 03:11 yangyxt