From d0a6d14bba35b8b7f503f76ca86edbba02fcf4d9 Mon Sep 17 00:00:00 2001 From: sbessey Date: Wed, 28 Oct 2020 11:00:19 -0400 Subject: [PATCH 1/3] fix: restrict processor to one task per child Processor was drifting off during runs causing issues with reproducibility when using set seeds. This fix prevents the drift. --- run_titan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_titan.py b/run_titan.py index adcfa76d..c73d06fb 100755 --- a/run_titan.py +++ b/run_titan.py @@ -379,7 +379,7 @@ def main( tic = time_mod.time() wct = [] # wall clock times - with Pool(processes=NCORES) as pool: + with Pool(processes=NCORES, maxtasksperchild=1) as pool: results = [ pool.apply_async( single_run, (sweep_def, outfile_dir, params, save_pop, pop_path) From 59abad9f31c27c983c20b8f446a1f2f13a0cfbda Mon Sep 17 00:00:00 2001 From: sbessey Date: Wed, 28 Oct 2020 11:01:34 -0400 Subject: [PATCH 2/3] test: make all agents pwid for ssp test Stochastic ssp test was frequently failing due to low number of pwid in the population. This makes the test more likely to pass. --- tests/integration_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration_test.py b/tests/integration_test.py index 5a5c2f5c..30d71b80 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -231,11 +231,13 @@ def test_prep_coverage(make_model_integration, tmpdir): @pytest.mark.integration_stochastic -def test_syringe_services(make_model_integration, tmpdir): +def test_syringe_services(params_integration, tmpdir): """ If we use syringe services, does the incidence of hiv decrease? """ - model_a = make_model_integration() + params_integration.demographics.black.MSM.drug_type.Inj.init = 1.0 + params_integration.demographics.black.MSM.drug_type["None"].init = 0.0 + model_a = HIVModel(params_integration) path_a = tmpdir.mkdir("a") path_a.mkdir("network") From b4d3ec51cbbeea6ca6a1d777e3c43ee9f381468a Mon Sep 17 00:00:00 2001 From: sbessey Date: Wed, 28 Oct 2020 12:14:04 -0400 Subject: [PATCH 3/3] docs: add comment on why maxtasksperchild is set --- run_titan.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run_titan.py b/run_titan.py index c73d06fb..9cde7b5c 100755 --- a/run_titan.py +++ b/run_titan.py @@ -379,7 +379,9 @@ def main( tic = time_mod.time() wct = [] # wall clock times - with Pool(processes=NCORES, maxtasksperchild=1) as pool: + with Pool( + processes=NCORES, maxtasksperchild=1 + ) as pool: # set max tasks/child to prevent processor drift results = [ pool.apply_async( single_run, (sweep_def, outfile_dir, params, save_pop, pop_path)