Skip to content

Commit

Permalink
divide disk by 2 on proportional
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 committed Dec 19, 2024
1 parent 2ff15d4 commit b423522
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions taskvine/test/vine_allocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,24 @@ def check_task(category, category_mode, max, min, expected):

check_task("all_zero", "fixed", max={"cores": 0, "memory": 0, "disk": 0, "gpus": 0}, min={}, expected={"cores": worker_cores, "memory": worker_memory, "disk": worker_disk, "gpus": 0})

# note that the disk is divided by 2 if using proportional resource allocations
q.tune("force-proportional-resources", 1)
check_task("only_memory", "fixed", max={"memory": worker_memory / 2}, min={}, expected={"cores": worker_cores / 2, "memory": worker_memory / 2, "disk": worker_disk / 2, "gpus": 0})

check_task("only_memory_w_minimum", "fixed", max={"memory": worker_memory / 2}, min={"cores": 3, "gpus": 2}, expected={"cores": 4, "memory": worker_memory, "disk": worker_disk, "gpus": 2})
check_task("only_memory", "fixed", max={"memory": worker_memory / 2}, min={}, expected={"cores": worker_cores / 2, "memory": worker_memory / 2, "disk": worker_disk / 2 / 2, "gpus": 0})

check_task("only_cores", "fixed", max={"cores": worker_cores}, min={}, expected={"cores": worker_cores, "memory": worker_memory, "disk": worker_disk, "gpus": 0})
check_task("only_memory_w_minimum", "fixed", max={"memory": worker_memory / 2}, min={"cores": 3, "gpus": 2}, expected={"cores": 4, "memory": worker_memory, "disk": worker_disk / 2, "gpus": 2})

check_task("auto_whole_worker", "min_waste", max={}, min={}, expected={"cores": worker_cores, "memory": worker_memory, "disk": worker_disk, "gpus": 0})
check_task("only_cores", "fixed", max={"cores": worker_cores}, min={}, expected={"cores": worker_cores, "memory": worker_memory, "disk": worker_disk / 2, "gpus": 0})

check_task("auto_whole_worker", "min_waste", max={}, min={}, expected={"cores": worker_cores, "memory": worker_memory, "disk": worker_disk / 2, "gpus": 0})

p = 1 / worker_cores
r = {"cores": 1}
e = {"cores": 1, "memory": math.floor(worker_memory * p), "disk": math.floor(worker_disk * p), "gpus": 0}
e = {"cores": 1, "memory": math.floor(worker_memory * p), "disk": math.floor(worker_disk * p) / 2, "gpus": 0}
check_task("only_cores_proportional", "fixed", max=r, min={}, expected=e)

p = 2 / worker_cores
e = {"cores": 2, "memory": math.floor(worker_memory * p), "disk": math.floor(worker_disk * p), "gpus": 0}
e = {"cores": 2, "memory": math.floor(worker_memory * p), "disk": math.floor(worker_disk * p) , "gpus": 0}
check_task("exhaustive_bucketing", "exhaustive_bucketing", max={}, min={}, expected=e)

check_task("greedy_bucketing", "greedy_bucketing", max={}, min={}, expected=e)
Expand Down

0 comments on commit b423522

Please sign in to comment.