Skip to content

Commit

Permalink
fix memory estimate for chunkgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
maickrau committed Dec 4, 2024
1 parent cb5e93d commit cbb0c4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Snakefiles/1-buildGraph.sm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ rule buildGraph:
resources:
job_id = 1,
n_cpus = int(config['chg_n_cpus']),
mem_gb = lambda wildcards, input, attempt: getChunkgraphMemoryRequest(attempt),
mem_gb = lambda wildcards, input, attempt: getChunkgraphMemoryRequest(attempt, input.reads),
time_h = lambda wildcards, input, attempt: getTimeRequest(attempt, 'chg')
shell:
'''
Expand Down
5 changes: 3 additions & 2 deletions src/Snakefiles/functions.sm
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,16 @@ def getMBGMemoryRequest(attempt): # Sum the input size, divide by

return int(math.ceil(math.ceil(mem)*scl))

def getChunkgraphMemoryRequest(attempt): # Sum the input size, divide by three.
def getChunkgraphMemoryRequest(attempt, filenames): # Sum the input size, divide by three.
scl = 0.75 + attempt / 4.0 # https://github.com/marbl/verkko/issues/34
mem = float(config[f"chg_mem_gb"]) #
gib = 1024.0 * 1024.0 * 1024.0

if mem < 2.0:
mem = 0

mem += getFileBP(rules.correctHiFi.output.fasta)
for file in filenames:
mem += getFileBP(file)
mem = mem * 1.10 # Expand by 10%
mem = mem / 2 # chunkgraph uses ~50Gb memory for ~120Gbp sequence, guess ~half
mem = mem / gib # Convert to GB
Expand Down

0 comments on commit cbb0c4a

Please sign in to comment.