Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HaplotypeCaller_GATK4_VCF to use MEM_SIZE and MEM_UNIT #1448

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tasks/broad/GermlineVariantDiscovery.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,14 @@ task HaplotypeCaller_GATK4_VCF {
# We need at least 1 GB of available memory outside of the Java heap in order to execute native code, thus, limit
# Java's memory by the total memory minus 1 GB. We need to compute the total memory as it might differ from
# memory_size_gb because of Cromwell's retry with more memory feature.
# Note: In the future this should be done using Cromwell's ${MEM_SIZE} and ${MEM_UNIT} environment variables,
# which do not rely on the output format of the `free` command.
available_memory_mb=$(free -m | awk '/^Mem/ {print $2}')
mem_unit=$(echo "${MEM_UNIT:-}" | cut -c 1)
if [[ $mem_unit == "M" ]]; then
available_memory_mb=$(awk "BEGIN {print int($MEM_SIZE)}")
elif [[ $mem_unit == "G" ]]; then
available_memory_mb=$(awk "BEGIN {print int($MEM_SIZE * 1024)}")
else
available_memory_mb=$(free -m | awk '/^Mem/ {print $2}')
fi
let java_memory_size_mb=available_memory_mb-1024
echo Total available memory: ${available_memory_mb} MB >&2
echo Memory reserved for Java: ${java_memory_size_mb} MB >&2
Expand Down
Loading