Skip to content

Commit

Permalink
add disk_allocation_throttle_factor
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 committed Jan 17, 2025
1 parent 18cfaac commit 4e9b577
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions taskvine/src/manager/vine_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -2673,6 +2673,10 @@ struct rmsummary *vine_manager_choose_resources_for_task(struct vine_manager *q,
max_proportion = 1;
}

/* Perform the standard proportional memory and disk allocations */
limits->memory = MAX(1, MAX(limits->memory, floor(memory_total * max_proportion)));
limits->disk = MAX(1, MAX(limits->disk, floor(disk_total * max_proportion / q->resource_submit_multiplier)));

/* When cores are unspecified, they are set to 0 if gpus are specified.
* Otherwise they get a proportion according to specified resources. */
if (limits->cores == -1 && limits->gpus > 0) {
Expand All @@ -2687,13 +2691,6 @@ struct rmsummary *vine_manager_choose_resources_for_task(struct vine_manager *q,
} else {
/* Do not allocate a proportion of gpus */
}

limits->disk = MAX(1, MAX(limits->disk, floor(disk_total * max_proportion / q->resource_submit_multiplier)));
limits->memory = MAX(1, MAX(limits->memory, floor(memory_total * max_proportion)));

/* We divide the estimated disk by 2 because inputs and outputs are moved around between the sandbox and
* the cache, we leave some space for that, and we want to leave some space for the cache to grow. */
limits->disk /= 2;
}

/* If one of the resources is not specified, use the available instead */
Expand All @@ -2710,6 +2707,10 @@ struct rmsummary *vine_manager_choose_resources_for_task(struct vine_manager *q,
limits->disk = disk_available;
}

/* After the guess is done, 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_allocation_throttle_factor;

/* Never go below min resources. */
rmsummary_merge_max(limits, min);

Expand Down Expand Up @@ -5611,6 +5612,9 @@ int vine_tune(struct vine_manager *q, const char *name, double value)
} else if (!strcmp(name, "sandbox-grow-factor")) {
q->sandbox_grow_factor = MAX(1.1, value);

} else if (!strcmp(name, "disk-allocation-throttle-factor")) {
q->disk_allocation_throttle_factor = MAX(0.0, MIN(1.0, value)); /* has to be in [0, 1] */

} 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 @@ -225,6 +225,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_allocation_throttle_factor; /* 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

0 comments on commit 4e9b577

Please sign in to comment.