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 {
48 
49 
50 struct category {
51  char *name;
52  category_mode_t allocation_mode;
53 
54  double fast_abort;
55 
56  struct rmsummary *first_allocation;
57  struct rmsummary *max_allocation;
58  struct rmsummary *min_allocation;
59  struct rmsummary *max_resources_seen;
60 
61  /* if 1, use first allocations. 0, use max fixed (if given) */
62  struct rmsummary *autolabel_resource;
63 
64  struct itable *histograms;
65 
66  int64_t total_tasks;
67 
68  /* completions since last time first-allocation was updated. */
69  int64_t completions_since_last_reset;
70 
71  /* category is somewhat confident of the maximum seen value. */
72  int steady_state;
73 
74  /* stats for wq */
75  uint64_t average_task_time;
76  struct work_queue_stats *wq_stats;
77 
78  /* variables for makeflow */
79  /* Mappings between variable names defined in the makeflow file and their values. */
80  struct hash_table *mf_variables;
81 };
82 
83 /* set autoallocation mode cores, memory, and disk. For other resources see category_enable_auto_resource. */
84 void category_specify_allocation_mode(struct category *c, int mode);
85 /* enable/disable autoallocation for the resource */
86 int category_enable_auto_resource(struct category *c, const char *resource_name, int autolabel);
87 
88 void category_specify_max_allocation(struct category *c, const struct rmsummary *s);
89 void category_specify_min_allocation(struct category *c, const struct rmsummary *s);
90 void category_specify_first_allocation_guess(struct category *c, const struct rmsummary *s);
91 
92 struct category *category_create(const char *name);
93 struct category *category_lookup_or_create(struct hash_table *categories, const char *name);
94 void category_delete(struct hash_table *categories, const char *name);
95 void categories_initialize(struct hash_table *categories, struct rmsummary *top, const char *summaries_file);
96 
97 int category_accumulate_summary(struct category *c, const struct rmsummary *rs, const struct rmsummary *max_worker);
98 int category_update_first_allocation(struct category *c, const struct rmsummary *max_worker);
99 
100 int category_in_steady_state(struct category *c);
101 
102 category_allocation_t category_next_label(struct category *c, category_allocation_t current_label, int resource_overflow, struct rmsummary *user, struct rmsummary *measured);
103 
104 const struct rmsummary *category_dynamic_task_max_resources(struct category *c, struct rmsummary *user, category_allocation_t request);
105 
106 const struct rmsummary *category_dynamic_task_min_resources(struct category *c, struct rmsummary *user, category_allocation_t request);
107 
108 #endif
If maximum values are specified for cores, memory, or disk (either a user-label or category-label) an...
Definition: category.h:37
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:46
Statistics describing a work queue.
Definition: work_queue.h:215
Definition: rmsummary.h:26
As above, but tasks are tried with an automatically computed first-allocation to minimize resource wa...
Definition: category.h:44
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 CATEGORY_ALLOCATION_MODE_FIXED.
Definition: category.h:36
Definition: category.h:50
No automatic allocation, or using first step value of the two-step policy.
Definition: category.h:22