cctools
category.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2015- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef CCTOOLS_CATEGORY_H
8 #define CCTOOLS_CATEGORY_H
9 
13 #include "hash_table.h"
14 #include "itable.h"
15 #include "histogram.h"
16 #include "timestamp.h"
17 
21 typedef enum {
27 
28 
32 typedef enum {
59 
60 
61 struct category {
62  char *name;
63  category_mode_t allocation_mode;
64 
65  double fast_abort;
66 
67  struct rmsummary *first_allocation;
68  struct rmsummary *max_allocation;
69  struct rmsummary *min_allocation;
70  struct rmsummary *max_resources_seen;
71 
72  /* if 1, use first allocations. 0, use max fixed (if given) */
73  struct rmsummary *autolabel_resource;
74 
75  struct itable *histograms;
76 
77  int64_t total_tasks;
78 
79  /* completions since last time first-allocation was updated. */
80  int64_t completions_since_last_reset;
81 
82  /* category is somewhat confident of the maximum seen value. */
83  int steady_state;
84 
85  /* stats for wq */
86  uint64_t average_task_time;
87  struct work_queue_stats *wq_stats;
88 
89  /* variables for makeflow */
90  /* Mappings between variable names defined in the makeflow file and their values. */
91  struct hash_table *mf_variables;
92 };
93 
94 /* set autoallocation mode cores, memory, and disk. For other resources see category_enable_auto_resource. */
95 void category_specify_allocation_mode(struct category *c, int mode);
96 /* enable/disable autoallocation for the resource */
97 int category_enable_auto_resource(struct category *c, const char *resource_name, int autolabel);
98 
99 void category_specify_max_allocation(struct category *c, const struct rmsummary *s);
100 void category_specify_min_allocation(struct category *c, const struct rmsummary *s);
101 void category_specify_first_allocation_guess(struct category *c, const struct rmsummary *s);
102 
103 struct category *category_create(const char *name);
104 struct category *category_lookup_or_create(struct hash_table *categories, const char *name);
105 void category_delete(struct hash_table *categories, const char *name);
106 void categories_initialize(struct hash_table *categories, struct rmsummary *top, const char *summaries_file);
107 
108 int category_accumulate_summary(struct category *c, const struct rmsummary *rs, const struct rmsummary *max_worker);
109 int category_update_first_allocation(struct category *c, const struct rmsummary *max_worker);
110 
111 int category_in_steady_state(struct category *c);
112 
113 category_allocation_t category_next_label(struct category *c, category_allocation_t current_label, int resource_overflow, struct rmsummary *user, struct rmsummary *measured);
114 
115 const struct rmsummary *category_dynamic_task_max_resources(struct category *c, struct rmsummary *user, category_allocation_t request);
116 
117 const struct rmsummary *category_dynamic_task_min_resources(struct category *c, struct rmsummary *user, category_allocation_t request);
118 
119 #endif
When monitoring is enabled, tasks are tried with maximum specified values of cores, memory, disk or gpus until enough statistics are collected.
Definition: category.h:40
Portable routines for high resolution timing.
category_mode_t
Valid modes for computing automatic resource allocations.
Definition: category.h:32
Same as FIRST, FIRST is deprecated.
Definition: category.h:23
Using max of category.
Definition: category.h:24
No valid resources could be found.
Definition: category.h:25
category_allocation_t
Valid states for the lifetime of automatic resource allocations for a single task.
Definition: category.h:21
As above, but maximizing throughput.
Definition: category.h:56
Statistics describing a work queue.
Definition: work_queue.h:217
Definition: rmsummary.h:26
As above, but tasks are first tried with an automatically computed allocation to minimize resource wa...
Definition: category.h:52
A general purpose hash table.
Keep counts of doubles that fall in some given bucket size.
An integer-indexed hash table.
When monitoring is disabled, all tasks run as WORK_QUEUE_ALLOCATION_MODE_FIXED.
Definition: category.h:33
Definition: category.h:61
No automatic allocation, or using first step value of the two-step policy.
Definition: category.h:22