Skip to content

Commit 32c658f

Browse files
hossam26644jeromekelleher
authored andcommitted
update asv pipeline
Fix issues class based proposed modification updated commit hashes
1 parent b0f8f48 commit 32c658f

File tree

3 files changed

+148
-147
lines changed

3 files changed

+148
-147
lines changed

benchmarks/benchmarks.py

Lines changed: 134 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
documentation for details on how to run these and how to develop your
2525
own benchmarks.
2626
"""
27+
2728
try:
2829
import stdpopsim
2930

@@ -55,148 +56,140 @@ def setup(self):
5556
self.recomb_map_chr22 = genetic_map.get_chromosome_map("chr22")
5657

5758

58-
class Hudson(LargeSimulationBenchmark):
59-
def _run_large_sample_size(self):
60-
msprime.simulate(
61-
sample_size=10**6,
62-
length=1e7,
63-
Ne=10**4,
64-
recombination_rate=1e-8,
65-
random_seed=42,
66-
)
67-
68-
def time_large_sample_size(self):
69-
self._run_large_sample_size()
70-
71-
def peakmem_large_sample_size(self):
72-
self._run_large_sample_size()
73-
74-
def _run_long_sequence_length(self):
75-
msprime.simulate(
76-
sample_size=100,
77-
length=1e8,
78-
Ne=10**4,
79-
recombination_rate=1e-8,
80-
random_seed=42,
81-
)
82-
83-
def time_long_sequence_length(self):
84-
self._run_long_sequence_length()
85-
86-
def peakmem_long_sequence_length(self):
87-
self._run_long_sequence_length()
88-
89-
def _run_long_sequence_length_gene_conversion(self):
90-
msprime.sim_ancestry(
91-
sample_size=100,
92-
length=1e8,
93-
Ne=10**4,
94-
gene_conversion_rate=1e-8,
95-
# 100Kb tract length.
96-
gene_conversion_tract_length=100 * 1e3,
97-
random_seed=43,
98-
)
99-
100-
def time_long_sequence_length_gene_conversion(self):
101-
self._run_long_sequence_length()
102-
103-
def peakmem_long_sequence_length_gene_conversion(self):
104-
self._run_long_sequence_length()
105-
106-
def _run_human_chr22(self):
107-
msprime.simulate(
108-
sample_size=100,
109-
Ne=10**4,
110-
recombination_map=self.recomb_map_chr22,
111-
random_seed=234,
112-
)
113-
114-
def time_human_chr22(self):
115-
self._run_human_chr22()
116-
117-
def peakmem_human_chr22(self):
118-
self._run_human_chr22()
119-
120-
def _run_many_replicates(self):
121-
for _ in msprime.simulate(10, num_replicates=10**5, random_seed=1234):
122-
pass
59+
class HudsonlargeSampleSize(LargeSimulationBenchmark):
60+
61+
def _get_params(self):
62+
return {
63+
"samples": 0.5 * (10**6),
64+
"sequence_length": 1e7,
65+
"population_size": 10**4,
66+
"recombination_rate": 1e-8,
67+
"random_seed": 42,
68+
}
69+
70+
def run(self):
71+
return msprime.sim_ancestry(**self._get_params())
72+
73+
def time_test(self):
74+
self.run()
75+
76+
def peakmem_test(self):
77+
self.run()
78+
79+
80+
class HudsonlargeSampleSizeOverRoot(HudsonlargeSampleSize):
81+
def _get_params(self):
82+
return {
83+
**super()._get_params(),
84+
"stop_at_local_mrca": False,
85+
}
86+
12387

124-
def time_many_replicates(self):
125-
self._run_many_replicates()
126-
127-
def peakmem_many_replicates(self):
128-
self._run_many_replicates()
129-
130-
# 2 populations, high migration.
131-
# Lots of populations, 1D stepping stone.
132-
133-
134-
class DTWF(LargeSimulationBenchmark):
135-
def _run_large_population_size(self):
136-
msprime.simulate(
137-
sample_size=1000,
138-
Ne=10**6,
139-
length=1e5,
140-
recombination_rate=1e-8,
141-
random_seed=42,
142-
model="dtwf",
143-
end_time=1000,
144-
)
145-
146-
def time_large_population_size(self):
147-
self._run_large_population_size()
148-
149-
def peakmem_large_population_size(self):
150-
self._run_large_population_size()
151-
152-
def _run_long_sequence_length(self):
153-
msprime.simulate(
154-
sample_size=100,
155-
Ne=10**4,
156-
length=1e7,
157-
recombination_rate=1e-8,
158-
random_seed=42,
159-
model="dtwf",
160-
# Tuning this to give ~30s runtime.
161-
end_time=5e4,
162-
)
163-
164-
def time_long_sequence_length(self):
165-
self._run_long_sequence_length()
166-
167-
def peakmem_long_sequence_length(self):
168-
self._run_long_sequence_length()
169-
170-
def _run_human_chr22(self):
171-
msprime.simulate(
172-
sample_size=100,
173-
Ne=10**4,
174-
recombination_map=self.recomb_map_chr22,
175-
random_seed=234,
176-
end_time=10000,
177-
model="dtwf",
178-
)
179-
180-
def time_human_chr22(self):
181-
self._run_human_chr22()
182-
183-
def peakmem_human_chr22(self):
184-
self._run_human_chr22()
185-
186-
def _run_many_replicates(self):
187-
reps = msprime.simulate(
188-
10,
189-
Ne=100,
190-
num_replicates=10**5,
191-
random_seed=1234,
192-
model="dtwf",
193-
end_time=100,
194-
)
195-
for _ in reps:
88+
class HudsonLongSequenceLength(HudsonlargeSampleSize):
89+
def _get_params(self):
90+
return {
91+
**super()._get_params(),
92+
"sequence_length": 1e8,
93+
"samples": 50,
94+
}
95+
96+
97+
class HudsonLongSequenceLengthGeneConversion(HudsonlargeSampleSize):
98+
def _get_params(self):
99+
return {
100+
"sequence_length": 1e8,
101+
"samples": 50,
102+
"gene_conversion_rate": 1e-8,
103+
"gene_conversion_tract_length": 100 * 1e3,
104+
"random_seed": 43,
105+
}
106+
107+
108+
class HudsonHumanChr22(HudsonlargeSampleSize):
109+
110+
def _get_params(self):
111+
return {
112+
**super()._get_params(),
113+
"sequence_length": None,
114+
"samples": 50,
115+
"recombination_rate": self.recomb_map_chr22,
116+
}
117+
118+
119+
class HudsonManyReplicates(HudsonlargeSampleSize):
120+
121+
def run(self):
122+
params = {"samples": 10, "num_replicates": 10**5, "random_seed": 1234}
123+
for _ in msprime.sim_ancestry(**params):
196124
pass
197125

198-
def time_many_replicates(self):
199-
self._run_many_replicates()
200126

201-
def peakmem_many_replicates(self):
202-
self._run_many_replicates()
127+
class HudsonHumanChr22OverRoot(HudsonlargeSampleSize):
128+
def _get_params(self):
129+
return {
130+
**super()._get_params(),
131+
"sequence_length": None,
132+
"samples": 50,
133+
"recombination_rate": self.recomb_map_chr22,
134+
"stop_at_local_mrca": False,
135+
}
136+
137+
138+
class DTWFLargePopulationSize(LargeSimulationBenchmark):
139+
def _get_params(self):
140+
return {
141+
"samples": 500,
142+
"sequence_length": 1e5,
143+
"population_size": 10**6,
144+
"recombination_rate": 1e-8,
145+
"random_seed": 42,
146+
"model": "dtwf",
147+
"end_time": 1000,
148+
}
149+
150+
def run(self):
151+
return msprime.sim_ancestry(**self._get_params())
152+
153+
def time_test(self):
154+
self.run()
155+
156+
def peakmem_test(self):
157+
self.run()
158+
159+
160+
class DTWFLongSequenceLength(DTWFLargePopulationSize):
161+
def _get_params(self):
162+
return {
163+
**super()._get_params(),
164+
"sequence_length": 1e7,
165+
"samples": 50,
166+
"end_time": 5e4,
167+
"population_size": 10**4,
168+
}
169+
170+
171+
class DTWFHumanChr22(DTWFLargePopulationSize):
172+
173+
def _get_params(self):
174+
return {
175+
**super()._get_params(),
176+
"sequence_length": None,
177+
"samples": 50,
178+
"recombination_rate": self.recomb_map_chr22,
179+
"end_time": 10000,
180+
"population_size": 10**4,
181+
}
182+
183+
184+
class DTWFManyReplicates(DTWFLargePopulationSize):
185+
def run(self):
186+
params = {
187+
"samples": 5,
188+
"population_size": 100,
189+
"num_replicates": 10**5,
190+
"random_seed": 1234,
191+
"model": "dtwf",
192+
"end_time": 100,
193+
}
194+
for _ in msprime.sim_ancestry(**params):
195+
pass

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+
d2e99ab2d4ba828bc1f19b0eb23f0334c1b26f1a
2+
cda89ed3f670c428d0452607753dccd8fc79f5ff
3+
2ddc65cc1e83c6d3c2af78e781bd5983a0364ff7
4+
0da0150a2d65053933c2c5f9b598e9197c7ea9ac
5+
ad3f625715821a3133d841a70d2a782d7e8fd171
6+
ff3f7851b647f28640cc2cbca62cfd056508e2d6
7+
804e0361c4f8b5f5051a9fbf411054ee8be3426a
8+
c11a2f12c72dd054a0ade0767474184ceec8281c
9+
f6fc608975bce01070f23e785d89fe171d190a9a
10+
57ef4ee3267cd9b8e711787539007b0cde94c55c

0 commit comments

Comments
 (0)