Skip to main content

⏱️ Running at scale

How much time, memory (RAM) and disk space a krsim run needs, so you can decide what to ask for on a laptop or a computing cluster. Every command uses one core.

Times are estimates for a typical laptop or computing-cluster core: they were measured on a fast laptop and doubled. Memory and disk are the same on any computer.

vcf-host-depth (with --depth_model sWGA) was timed on a computing-cluster core rather than the laptop. Its times here are scaled to the laptop by how much faster the laptop ran vcf-strain at the same size (about 2.3 times), then doubled like the rest, so treat them as rough. To time your own machine, run python benchmarks/scaling.py pipeline --Nh 100.

The real-scale baseline

At the baseline used in Real-scale dynamics (--Nh 100 --T 1000 --K 10 --chi 0.2 --C 3):

Command Time Peak RAM Disk
simulate 58 s 2.9 GB 4 MB
mutate 2 s 0.1 GB 8 MB
vcf-strain 8 s 0.3 GB 227 MB
vcf-host-depth 36 s 0.1 GB 123 MB
All four about 1.7 min 2.9 GB 0.35 GB

simulate is the slowest step at this size and uses the most memory at every size below. From about 400 hosts, vcf-host-depth becomes the slowest step.

What to request: 1 core, 8 GB of memory and 15 minutes per simulation.

How each command scales

Each command was run for increasing numbers of hosts (T = 1000, K = 10). Both axes are logarithmic:

Time, peak RAM and output size of simulate, mutate, vcf-strain and vcf-host-depth against the number of hosts, from 50 to 1000

For all four commands together, with a suggested request (1 core each time):

Hosts (--Nh) Total time Peak RAM Disk Request: memory Request: time
50 1 min 1.5 GB 0.1 GB 4 GB 15 min
100 1.7 min 2.9 GB 0.35 GB 8 GB 15 min
200 3.9 min 5.8 GB 1.3 GB 16 GB 15 min
400 10 min 10.6 GB 4.9 GB 16 GB 30 min
1000 51 min 20.4 GB 31 GB 32 GB 2 hours
  • simulate grows in proportion to Nh × T × K: doubling the hosts, generations or parasites per bite roughly doubles its time and memory.
  • vcf-strain and vcf-host-depth grow faster, roughly with Nh², and together they take most of the disk. vcf-host-depth is the slowest step from about Nh = 400: at Nh = 1000 it takes about 33 minutes, against about 10 minutes for simulate. It uses little memory (under 0.5 GB).
  • mutate stays small throughout.

Time for each command

Typical laptop or computing-cluster core (the same estimate as the tables above):

Hosts (--Nh) simulate mutate vcf-strain vcf-host-depth All four
50 31 s 2 s 5 s 23 s 1 min
100 58 s 2 s 8 s 36 s 1.7 min
200 1.9 min 2 s 25 s 1.5 min 3.9 min
400 3.8 min 3 s 1.3 min 5 min 10 min
1000 10 min 5 s 8.5 min 33 min 51 min

Measured on one core of a computing cluster (Queen Mary’s Apocrita), with no estimates. This core was 2 to 4 times slower than the laptop, so expect times somewhere between these and the table above:

Hosts (--Nh) simulate mutate vcf-strain vcf-host-depth All four
50 55 s 1 s 4 s 21 s 1.4 min
100 1.8 min 4 s 10 s 41 s 2.7 min
200 3.5 min 1 s 31 s 1.8 min 5.9 min
400 7.3 min 2 s 1.6 min 6.1 min 15 min
1000 18 min 5 s 9.9 min 38 min 67 min

The suggested time requests above leave room for a slow core: at Nh = 1000, 2 hours covers the 67 minutes measured here.

If you don’t need the VCFs, a run needs only the simulate time and memory, and a few MB of disk.

Other parameters

The number of hosts matters most, but the other parameters change the cost too. Varying one at a time from the real-scale baseline (Nh = 100), for simulate alone. To decide what to request, use the table above, which includes every command:

Parameter Range simulate time Peak RAM Effect on the VCFs
Generations (--T) 250 → 2000 14 s → 1.9 min 1.0 → 5.7 GB barely change
Parasites per bite (--K) 5 → 20 38 s → 1.5 min 1.4 → 5.7 GB grow, as there are more strains
Superinfection (--chi) 0.05 → 0.5 50 s → 70 s 2.5 → 3.4 GB grow a little
Oocysts per mosquito (--C) 1 → 5 44 s → 67 s no change little effect
  • Hosts (--Nh) and parasites per bite (--K) matter most. Both increase the number of strains, which drives the size and cost of the VCFs.
  • Generations (--T) only affect simulate: doubling T roughly doubles its time and memory.
  • Superinfection (--chi) and oocysts (--C) make little difference.

coal-mut is for small runs

krsim coal-mut writes one row for every pair of strains in every tree along the genome. For a small run like the quick start this table is intuitive to read, which makes it a good way to learn what coalescence times are.

For larger populations it becomes very computationally expensive: the number of rows grows roughly with the cube of the number of hosts. At the real-scale baseline (Nh = 100) it would take around 10 hours and several terabytes of memory, so it is not practical. For larger runs, compute coalescence time summaries directly from the tree sequence instead, as in Real-scale dynamics.