Skip to content

Commit

Permalink
temp fix for sequential run
Browse files Browse the repository at this point in the history
  • Loading branch information
bobkatla committed Oct 10, 2024
1 parent 0113135 commit 2e37d81
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
46 changes: 23 additions & 23 deletions PopSynthesis/Methods/IPSF/SAA/operations/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions job.script
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 2e37d81

Please sign in to comment.