Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mllam_data_prep/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import math
import os
from pathlib import Path

Expand Down Expand Up @@ -60,8 +61,9 @@ def call(args=None):
)
# get the number of system cores
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)
# compute the number of cores to use, using ceil to ensure at least 1
# worker is used even on single-core machines (e.g. standard GitHub CI)
n_local_cores = math.ceil(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
Expand Down
1 change: 1 addition & 0 deletions tests/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def distributed():
"args",
[
["example.danra.yaml", "--dask-distributed-local-core-fraction", "1.0"],
["example.danra.yaml", "--dask-distributed-local-core-fraction", "0.5"],
["example.danra.yaml", "--dask-distributed-local-core-fraction", "0.0"],
Comment thread
joeloskarsson marked this conversation as resolved.
["example.danra.yaml"],
],
Expand Down
Loading