From 2e37d81b1f6a0ce4be272f94bca4aa117d8940dc Mon Sep 17 00:00:00 2001 From: Duc Minh La Date: Thu, 10 Oct 2024 15:49:53 +1100 Subject: [PATCH] temp fix for sequential run --- .../Methods/IPSF/SAA/operations/general.py | 46 +++++++++---------- job.script | 8 ++-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/PopSynthesis/Methods/IPSF/SAA/operations/general.py b/PopSynthesis/Methods/IPSF/SAA/operations/general.py index fc39560..74f0810 100644 --- a/PopSynthesis/Methods/IPSF/SAA/operations/general.py +++ b/PopSynthesis/Methods/IPSF/SAA/operations/general.py @@ -102,32 +102,32 @@ def adjust_atts_state_match_census( att, curr_syn_pop, census_data_by_att ) assert (states_diff_census.sum(axis=1) == 0).all() - # Prepare arguments for each row - args = [ - ( - att, - updated_syn_pop[updated_syn_pop[zone_field] == zid], - zone_states_diff.copy(deep=True), - pool, - adjusted_atts, - ) - for zid, zone_states_diff in states_diff_census.iterrows() - ] + # # Prepare arguments for each row + # args = [ + # ( + # att, + # updated_syn_pop[updated_syn_pop[zone_field] == zid], + # zone_states_diff.copy(deep=True), + # pool, + # adjusted_atts, + # ) + # for zid, zone_states_diff in states_diff_census.iterrows() + # ] - # Use multiprocessing Pool - with mp.Pool(mp.cpu_count()) as pool: - pop_syn_across_zones = pool.map(wrapper_multiprocessing_zones, args) + # # Use multiprocessing Pool + # with mp.Pool(mp.cpu_count()) as pool: + # pop_syn_across_zones = pool.map(wrapper_multiprocessing_zones, args) # With state diff we can now do adjustment for each zone, can parallel it? - # pop_syn_across_zones = [] - # for zid, zone_states_diff in states_diff_census.iterrows(): - # print(f"DOING {zid}") - # sub_syn_pop = updated_syn_pop[updated_syn_pop[zone_field] == zid] - # zone_adjusted_syn_pop = zone_adjustment( - # att, sub_syn_pop, zone_states_diff, pool, adjusted_atts - # ) - # if zone_adjusted_syn_pop is not None: - # pop_syn_across_zones.append(zone_adjusted_syn_pop) + pop_syn_across_zones = [] + for zid, zone_states_diff in states_diff_census.iterrows(): + print(f"DOING {zid}") + sub_syn_pop = updated_syn_pop[updated_syn_pop[zone_field] == zid] + zone_adjusted_syn_pop = zone_adjustment( + att, sub_syn_pop, zone_states_diff, pool, adjusted_atts + ) + if zone_adjusted_syn_pop is not None: + pop_syn_across_zones.append(zone_adjusted_syn_pop) updated_syn_pop = pd.concat(pop_syn_across_zones) diff --git a/job.script b/job.script index ee5bea8..46c09ad 100644 --- a/job.script +++ b/job.script @@ -1,11 +1,11 @@ #!/bin/bash -#SBATCH --job-name=run_hh +#SBATCH --job-name=run_hh_sequential #SBATCH --partition=comp #SBATCH --nodes=1 -#SBATCH --cpus-per-task=80 +#SBATCH --cpus-per-task=2 #SBATCH --ntasks=1 -#SBATCH --time=99:00:00 -#SBATCH --output=run_hh.out +#SBATCH --time=150:00:00 +#SBATCH --output=run_hh_sequential.out source .venv/bin/activate