Skip to content

Commit

Permalink
Fastqc: FIX memory over-allocation (nf-core#6156)
Browse files Browse the repository at this point in the history
* FIX memory over-allocation

* Comment to explain why dividing by task.cpu
  • Loading branch information
sguizard authored Aug 22, 2024
1 parent a289753 commit b49b899
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion modules/nf-core/fastqc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ process FASTQC {
def rename_to = old_new_pairs*.join(' ').join(' ')
def renamed_files = old_new_pairs.collect{ old_name, new_name -> new_name }.join(' ')

def memory_in_mb = MemoryUnit.of("${task.memory}").toUnit('MB')
// The total amount of allocated RAM by FastQC is equal to the number of threads defined (--threads) time the amount of RAM defined (--memory)
// https://github.com/s-andrews/FastQC/blob/1faeea0412093224d7f6a07f777fad60a5650795/fastqc#L211-L222
// Dividing the task.memory by task.cpu allows to stick to requested amount of RAM in the label
def memory_in_mb = MemoryUnit.of("${task.memory}").toUnit('MB') / task.cpus
// FastQC memory value allowed range (100 - 10000)
def fastqc_memory = memory_in_mb > 10000 ? 10000 : (memory_in_mb < 100 ? 100 : memory_in_mb)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,4 @@
},
"timestamp": "2024-07-22T17:06:09.844235"
}
}
}

0 comments on commit b49b899

Please sign in to comment.