Skip to content

Commit c5e03c1

Browse files
committed
update asv pipeline
1 parent e6c1136 commit c5e03c1

File tree

3 files changed

+61
-38
lines changed

3 files changed

+61
-38
lines changed

benchmarks/benchmarks.py

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ def setup(self):
5151
# Stuff that depends on the recomb_map_chr22 will fail
5252
if stdpopsim_available:
5353
species = stdpopsim.get_species("HomSap")
54-
genetic_map = species.get_genetic_map("HapMapII_GRCh37")
55-
self.recomb_map_chr22 = genetic_map.get_chromosome_map("chr22")
54+
contig = species.get_contig("chr22")
55+
self.recomb_map_chr22 = contig.recombination_map
5656

5757

5858
class Hudson(LargeSimulationBenchmark):
5959
def _run_large_sample_size(self):
60-
msprime.simulate(
61-
sample_size=10**6,
62-
length=1e7,
63-
Ne=10**4,
60+
msprime.sim_ancestry(
61+
samples=10**6,
62+
sequence_length=1e7,
63+
population_size=10**4,
6464
recombination_rate=1e-8,
6565
random_seed=42,
6666
)
@@ -72,10 +72,10 @@ def peakmem_large_sample_size(self):
7272
self._run_large_sample_size()
7373

7474
def _run_long_sequence_length(self):
75-
msprime.simulate(
76-
sample_size=100,
77-
length=1e8,
78-
Ne=10**4,
75+
msprime.sim_ancestry(
76+
samples=100,
77+
sequence_length=1e8,
78+
population_size=10**4,
7979
recombination_rate=1e-8,
8080
random_seed=42,
8181
)
@@ -88,9 +88,9 @@ def peakmem_long_sequence_length(self):
8888

8989
def _run_long_sequence_length_gene_conversion(self):
9090
msprime.sim_ancestry(
91-
sample_size=100,
92-
length=1e8,
93-
Ne=10**4,
91+
samples=100,
92+
sequence_length=1e8,
93+
population_size=10**4,
9494
gene_conversion_rate=1e-8,
9595
# 100Kb tract length.
9696
gene_conversion_tract_length=100 * 1e3,
@@ -104,10 +104,10 @@ def peakmem_long_sequence_length_gene_conversion(self):
104104
self._run_long_sequence_length()
105105

106106
def _run_human_chr22(self):
107-
msprime.simulate(
108-
sample_size=100,
109-
Ne=10**4,
110-
recombination_map=self.recomb_map_chr22,
107+
msprime.sim_ancestry(
108+
samples=100,
109+
population_size=10**4,
110+
recombination_rate=self.recomb_map_chr22,
111111
random_seed=234,
112112
)
113113

@@ -118,7 +118,7 @@ def peakmem_human_chr22(self):
118118
self._run_human_chr22()
119119

120120
def _run_many_replicates(self):
121-
for _ in msprime.simulate(10, num_replicates=10**5, random_seed=1234):
121+
for _ in msprime.sim_ancestry(10, num_replicates=10**5, random_seed=1234):
122122
pass
123123

124124
def time_many_replicates(self):
@@ -127,16 +127,31 @@ def time_many_replicates(self):
127127
def peakmem_many_replicates(self):
128128
self._run_many_replicates()
129129

130+
def _run_human_chr22_simulate_above_root(self):
131+
msprime.sim_ancestry(
132+
samples=100,
133+
population_size=10**4,
134+
recombination_rate=self.recomb_map_chr22,
135+
random_seed=234,
136+
stop_at_local_mrca=True,
137+
)
138+
139+
def time_human_chr22_simulate_above_root(self):
140+
self._run_human_chr22_simulate_above_root()
141+
142+
def peakmem_human_chr22_simulate_above_root(self):
143+
self._run_human_chr22_simulate_above_root()
144+
130145
# 2 populations, high migration.
131146
# Lots of populations, 1D stepping stone.
132147

133148

134149
class DTWF(LargeSimulationBenchmark):
135150
def _run_large_population_size(self):
136-
msprime.simulate(
137-
sample_size=1000,
138-
Ne=10**6,
139-
length=1e5,
151+
msprime.sim_ancestry(
152+
samples=1000,
153+
population_size=10**6,
154+
sequence_length=1e5,
140155
recombination_rate=1e-8,
141156
random_seed=42,
142157
model="dtwf",
@@ -150,10 +165,10 @@ def peakmem_large_population_size(self):
150165
self._run_large_population_size()
151166

152167
def _run_long_sequence_length(self):
153-
msprime.simulate(
154-
sample_size=100,
155-
Ne=10**4,
156-
length=1e7,
168+
msprime.sim_ancestry(
169+
samples=100,
170+
population_size=10**4,
171+
sequence_length=1e7,
157172
recombination_rate=1e-8,
158173
random_seed=42,
159174
model="dtwf",
@@ -168,10 +183,10 @@ def peakmem_long_sequence_length(self):
168183
self._run_long_sequence_length()
169184

170185
def _run_human_chr22(self):
171-
msprime.simulate(
172-
sample_size=100,
173-
Ne=10**4,
174-
recombination_map=self.recomb_map_chr22,
186+
msprime.sim_ancestry(
187+
samples=100,
188+
population_size=10**4,
189+
recombination_rate=self.recomb_map_chr22,
175190
random_seed=234,
176191
end_time=10000,
177192
model="dtwf",
@@ -184,9 +199,9 @@ def peakmem_human_chr22(self):
184199
self._run_human_chr22()
185200

186201
def _run_many_replicates(self):
187-
reps = msprime.simulate(
202+
reps = msprime.sim_ancestry(
188203
10,
189-
Ne=100,
204+
population_size=100,
190205
num_replicates=10**5,
191206
random_seed=1234,
192207
model="dtwf",

benchmarks/check_asv.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ sudo cpufreq-set -c 3 -g performance
44
#asv does recent commits first, so by letting it run for 55min, and the cron to 1hr
55
#it will always keep up with new commits, but also process the backlog
66
timeout 3300s asv run -j 4 --show-stderr --cpu-affinity 3 --skip-existing ALL
7+
8+
#instead you can test for a set of versions: uncomment the next line and comment line 6 to do so
9+
#you can add more version to benshmark to the file version_hashes.txt
10+
#asv run -j 4 --show-stderr --cpu-affinity 3 --skip-existing HASHFILE:benchmarks/version_hashes.txt
711
sudo cpufreq-set -c 3 -g powersave
812
asv publish
913
asv preview

benchmarks/version_hashes.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
661200e8fc310d374eb266cad39d4d3d96f0b8e9
2-
8ce627f754ee52d7961fd9016fcbed202234734e
3-
8a39c401d1c817f4950b7fc486da8238b9fa76ec
4-
3e28f9dea511e6745f99cbf2c009cdcea4a73f20
5-
b8f5fb60b0ca0885b7f1c2d7ac7a9ae3b95fc543
6-
18d3c417db2cdd87ad6539a5e2cef60250460b3a
1+
2ef10bece9420e60bdeb93aeb28b553368606dcd
2+
1c3e1434a48046bcda0244b297c5436372494b78
3+
4bcf8cb1d8cf4dec67cb09c5253c1b988cd52f48
4+
d5047215de63bea5658e7609f8d8877e0116d0e0
5+
fcef2a644a7d22c1a7fde10f7e32f2bcc9e0e647
6+
0da0150a2d65053933c2c5f9b598e9197c7ea9ac
7+
ad3f625715821a3133d841a70d2a782d7e8fd171
8+
ff3f7851b647f28640cc2cbca62cfd056508e2d6
9+
804e0361c4f8b5f5051a9fbf411054ee8be3426a
10+
c11a2f12c72dd054a0ade0767474184ceec8281c

0 commit comments

Comments
 (0)