Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 committed Jan 24, 2025
1 parent b85d369 commit 46687a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
9 changes: 8 additions & 1 deletion taskvine/src/manager/vine_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,9 @@ struct rmsummary *vine_manager_choose_resources_for_task(struct vine_manager *q,
* thus the proportion is modified by the current overcommit
* multiplier */
limits->disk = MAX(1, MAX(limits->disk, floor(available_disk * max_proportion / q->resource_submit_multiplier)));
/* For disk, scale the estimated disk allocation by a [0, 1] number (by default 0.75) to intentionally reserve
* some space for data movement between the sandbox and cache (output files) and allow room for cache growth. */
limits->disk *= q->disk_proportion_available_to_task;
}
}

Expand Down Expand Up @@ -4006,6 +4009,7 @@ struct vine_manager *vine_ssl_create(int port, const char *key, const char *cert
q->max_task_resources_requested = rmsummary_create(-1);

q->sandbox_grow_factor = 2.0;
q->disk_proportion_available_to_task = 0.75;

q->stats = calloc(1, sizeof(struct vine_stats));
q->stats_measure = calloc(1, sizeof(struct vine_stats));
Expand Down Expand Up @@ -5772,7 +5776,10 @@ int vine_tune(struct vine_manager *q, const char *name, double value)

} else if (!strcmp(name, "max-library-retries")) {
q->max_library_retries = MIN(1, value);

} else if (!strcmp(name, "disk-proportion-available-to-task")) {
if (value > 1 || value < 0) {
q->disk_proportion_available_to_task = 0.75;
}
} else {
debug(D_NOTICE | D_VINE, "Warning: tuning parameter \"%s\" not recognized\n", name);
return -1;
Expand Down
1 change: 1 addition & 0 deletions taskvine/src/manager/vine_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ struct vine_manager {
int watch_library_logfiles; /* If true, watch the output files produced by each of the library processes running on the remote workers, take them back the current logging directory */

double sandbox_grow_factor; /* When task disk sandboxes are exhausted, increase the allocation using their measured valued times this factor */
double disk_proportion_available_to_task; /* intentionally reduces disk allocation for tasks to reserve some space for cache growth. */

/*todo: confirm datatype. int or int64*/
int max_task_stdout_storage; /* Maximum size of standard output from task. (If larger, send to a separate file.) */
Expand Down
15 changes: 9 additions & 6 deletions taskvine/test/vine_allocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,25 @@ 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 a factor if enabling proportional resource allocation
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})
disk_proportion_available_to_task = 0.75 # the default factor

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 * disk_proportion_available_to_task, "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 * disk_proportion_available_to_task, "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 * disk_proportion_available_to_task, "gpus": 0})

check_task("auto_whole_worker", "min_waste", max={}, min={}, expected={"cores": worker_cores, "memory": worker_memory, "disk": worker_disk * disk_proportion_available_to_task, "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) * disk_proportion_available_to_task, "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 46687a2

Please sign in to comment.