Skip to content

Commit

Permalink
Client gets threads_per_worker=1
Browse files Browse the repository at this point in the history
This reduces run time of TPI on 64 physical core AMD workstation from
~12 hours to ~3 hours. It looks like the default of Dask is to
oversubscribe threads to cores. This is not a good default for
computationally intensive workloads.
  • Loading branch information
talumbau committed Apr 21, 2024
1 parent 13a3da8 commit 18343c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/run_og_usa.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def main():
# Define parameters to use for multiprocessing
num_workers = min(multiprocessing.cpu_count(), 7)
client = Client(n_workers=num_workers)
client = Client(n_workers=num_workers, threads_per_worker=1)
print("Number of workers = ", num_workers)

# Directories to save data
Expand Down Expand Up @@ -50,7 +50,7 @@ def main():
# close and delete client bc cache is too large
client.close()
del client
client = Client(n_workers=num_workers)
client = Client(n_workers=num_workers, threads_per_worker=1)
d = c.get_dict()
# # additional parameters to change
updated_params = {
Expand Down Expand Up @@ -107,7 +107,7 @@ def main():
# close and delete client bc cache is too large
client.close()
del client
client = Client(n_workers=num_workers)
client = Client(n_workers=num_workers, threads_per_worker=1)
# update tax function parameters in Specifications Object
d = c2.get_dict()
# # additional parameters to change
Expand Down

0 comments on commit 18343c2

Please sign in to comment.