category.h
Go to the documentation of this file.
/*
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef CCTOOLS_CATEGORY_H
#define CCTOOLS_CATEGORY_H
#include "hash_table.h"
#include "itable.h"
#include "histogram.h"
#include "timestamp.h"
#include "bucketing_manager.h"
typedef enum {
CATEGORY_ALLOCATION_FIRST = 0,
CATEGORY_ALLOCATION_AUTO = 0,
CATEGORY_ALLOCATION_MAX,
CATEGORY_ALLOCATION_ERROR,
CATEGORY_ALLOCATION_GREEDY_BUCKETING,
CATEGORY_ALLOCATION_EXHAUSTIVE_BUCKETING,
} category_allocation_t;
typedef enum {
CATEGORY_ALLOCATION_MODE_FIXED = 0,
CATEGORY_ALLOCATION_MODE_MAX,
CATEGORY_ALLOCATION_MODE_MIN_WASTE,
CATEGORY_ALLOCATION_MODE_MAX_THROUGHPUT,
CATEGORY_ALLOCATION_MODE_GREEDY_BUCKETING,
CATEGORY_ALLOCATION_MODE_EXHAUSTIVE_BUCKETING
} category_mode_t;
struct category {
char *name;
category_mode_t allocation_mode;
double fast_abort;
struct rmsummary *first_allocation;
struct rmsummary *max_allocation;
struct rmsummary *min_allocation;
struct rmsummary *max_resources_seen;
/* if 1, use first allocations. 0, use max fixed (if given) */
struct rmsummary *autolabel_resource;
struct itable *histograms;
/* manager for bucketing mode, if applicable */
bucketing_manager_t* bucketing_manager;
/* number of tasks completed */
int64_t total_tasks;
/* completions since last time first-allocation was updated. */
int64_t completions_since_last_reset;
/* maximum number of tasks of this category allowed to be running concurrently. If less than 0, unlimited. */
int64_t max_concurrent;
/* category is somewhat confident of the maximum seen value. */
int steady_state;
/* stats for work queue */
uint64_t average_task_time;
struct work_queue_stats *wq_stats;
/* stats for taskvine */
struct vine_stats *vine_stats;
/* Max sandbox disk space observed, in MB. This is the minimum sandbox size needed if nothing else is known about the task.*/
int64_t min_vine_sandbox;
/* variables for makeflow */
/* Mappings between variable names defined in the makeflow file and their values. */
struct hash_table *mf_variables;
};
/* set autoallocation mode cores, memory, and disk. For other resources see category_enable_auto_resource. */
void category_specify_allocation_mode(struct category *c, int mode);
/* enable/disable autoallocation for the resource */
int category_enable_auto_resource(struct category *c, const char *resource_name, int autolabel);
void category_specify_max_allocation(struct category *c, const struct rmsummary *s);
void category_specify_min_allocation(struct category *c, const struct rmsummary *s);
void category_specify_first_allocation_guess(struct category *c, const struct rmsummary *s);
struct category *category_create(const char *name);
struct category *category_lookup_or_create(struct hash_table *categories, const char *name);
void category_free(struct category *c);
void category_delete(struct hash_table *categories, const char *name);
void categories_initialize(struct hash_table *categories, struct rmsummary *top, const char *summaries_file);
int category_accumulate_summary(struct category *c, const struct rmsummary *rs, const struct rmsummary *max_worker);
int category_bucketing_accumulate_summary(struct category *c, const struct rmsummary *rs, const struct rmsummary *max_worker, int taskid, int success);
int category_in_bucketing_mode(struct category* c);
int category_update_first_allocation(struct category *c, const struct rmsummary *max_worker);
int category_in_steady_state(struct category *c);
category_allocation_t category_next_label(struct category *c, category_allocation_t current_label, int resource_overflow, struct rmsummary *user, struct rmsummary *measured);
const struct rmsummary *category_task_max_resources(struct category *c, struct rmsummary *user, category_allocation_t request, int taskid);
const struct rmsummary *category_task_min_resources(struct category *c, struct rmsummary *user, category_allocation_t request, int taskid);
#endif
category_allocation_t
category_allocation_t
Valid states for the lifetime of automatic resource allocations for a single task.
Definition category.h:22
CATEGORY_ALLOCATION_FIRST
@ CATEGORY_ALLOCATION_FIRST
No automatic allocation, or using first step value of the two-step policy.
Definition category.h:23
CATEGORY_ALLOCATION_GREEDY_BUCKETING
@ CATEGORY_ALLOCATION_GREEDY_BUCKETING
Use the greedy bucketing algorithm to label resources.
Definition category.h:27
CATEGORY_ALLOCATION_AUTO
@ CATEGORY_ALLOCATION_AUTO
Same as FIRST, FIRST is deprecated.
Definition category.h:24
CATEGORY_ALLOCATION_EXHAUSTIVE_BUCKETING
@ CATEGORY_ALLOCATION_EXHAUSTIVE_BUCKETING
Use the exhaustive bucketing algorithm to label resources.
Definition category.h:28
CATEGORY_ALLOCATION_MAX
@ CATEGORY_ALLOCATION_MAX
Using max of category.
Definition category.h:25
CATEGORY_ALLOCATION_ERROR
@ CATEGORY_ALLOCATION_ERROR
No valid resources could be found.
Definition category.h:26
category_mode_t
category_mode_t
Valid modes for computing automatic resource allocations.
Definition category.h:35
CATEGORY_ALLOCATION_MODE_MIN_WASTE
@ CATEGORY_ALLOCATION_MODE_MIN_WASTE
As above, but tasks are first tried with an automatically computed allocation to minimize resource wa...
Definition category.h:55
CATEGORY_ALLOCATION_MODE_FIXED
@ CATEGORY_ALLOCATION_MODE_FIXED
When monitoring is disabled, all tasks run as WORK_QUEUE_ALLOCATION_MODE_FIXED.
Definition category.h:36
CATEGORY_ALLOCATION_MODE_GREEDY_BUCKETING
@ CATEGORY_ALLOCATION_MODE_GREEDY_BUCKETING
Use the greedy bucketing algorithm to label resources.
Definition category.h:61
CATEGORY_ALLOCATION_MODE_EXHAUSTIVE_BUCKETING
@ CATEGORY_ALLOCATION_MODE_EXHAUSTIVE_BUCKETING
Use the exhaustive bucketing algorithm to label resources.
Definition category.h:64
CATEGORY_ALLOCATION_MODE_MAX_THROUGHPUT
@ CATEGORY_ALLOCATION_MODE_MAX_THROUGHPUT
As above, but maximizing throughput.
Definition category.h:59
CATEGORY_ALLOCATION_MODE_MAX
@ CATEGORY_ALLOCATION_MODE_MAX
When monitoring is enabled, tasks are tried with maximum specified values of cores,...
Definition category.h:43
hash_table.h
A general purpose hash table.
histogram.h
Keep counts of doubles that fall in some given bucket size.
itable.h
An integer-indexed hash table.
bucketing_manager_t
Definition bucketing_manager.h:13
category
Definition category.h:69
rmsummary
Definition rmsummary.h:27
work_queue_stats
Statistics describing a work queue.
Definition work_queue.h:226
timestamp.h
Portable routines for high resolution timing.