Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDevisionError when using 0<dask_distributed_local_core_fraction<1 on machine with one CPU #32

Open
observingClouds opened this issue Oct 31, 2024 · 1 comment

Comments

@observingClouds
Copy link
Contributor

While writing a CI test, I realize that the following fails when using a dask_distributed_local_core_fraction other than 0 or 1 if the machine has only one core (like the standard GitHub CI compute).

n_system_cores = os.cpu_count()
# compute the number of cores to use
n_local_cores = int(args.dask_distributed_local_core_fraction * n_system_cores)
# get the total system memory
total_memory = psutil.virtual_memory().total
# compute the memory per worker
memory_per_worker = (
total_memory / n_local_cores * args.dask_distributed_local_memory_fraction
)

Even though this case will hardly ever be an issue for our computations, I suggest to replace int() with numpy.ceil() or raise a specific warning. Currently one just gets a ZeroDevisionError.

@leifdenby
Copy link
Member

replace int() with numpy.ceil() or raise a specific warning

Good catch. ceil makes sense to me, good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants