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