codes-workload.h 4.94 KB
Newer Older
1
2
3
4
5
6
/*
 * Copyright (C) 2013 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

7
/* I/O workload generator API to be used for reading I/O operations into
Philip Carns's avatar
Philip Carns committed
8
9
10
 * storage system simulations.  This API just describes the operations to be
 * executed; it does not service the operations.
 */
11
12
13
14
15

#ifndef CODES_WORKLOAD_H
#define CODES_WORKLOAD_H

#include "ross.h"
Jonathan Jenkins's avatar
Jonathan Jenkins committed
16
#define MAX_NAME_LENGTH_WKLD 512
17

18
typedef struct bgp_params bgp_params;
19
typedef struct darshan_params darshan_params;
20
typedef struct recorder_params recorder_params;
21
typedef struct codes_workload_info codes_workload_info;
22
23
24

struct bgp_params
{
25
    /* We have the number of ranks passed in from the bg/p model because
26
27
28
     * the I/O lang workloads have no information about the number of ranks.
     * Only the bg/p config file knows the number of ranks. */
    int num_cns;
29
30
    /* flag - use path to find kernel files relative to the metafile */
    int use_relpath;
Jonathan Jenkins's avatar
Jonathan Jenkins committed
31
32
33
34
    char io_kernel_meta_path[MAX_NAME_LENGTH_WKLD];
    char bgp_config_file[MAX_NAME_LENGTH_WKLD];
    char io_kernel_path[MAX_NAME_LENGTH_WKLD];
    char io_kernel_def_path[MAX_NAME_LENGTH_WKLD];
35
36
};

37
38
struct darshan_params
{
39
    FILE* stream;
40
    char log_file_path[MAX_NAME_LENGTH_WKLD];
41
    int64_t aggregator_cnt;
42
43
};

44
45
46
47
48
49
50
struct recorder_params
{
    FILE* stream;
    char trace_dir_path[MAX_NAME_LENGTH_WKLD];
};


51
52
53
54
55
struct codes_workload_info
{
    int group_id; /* group id */
    int min_rank; /* minimum rank in the collective operation */
    int max_rank; /* maximum rank in the collective operation */
56
    int local_rank; /* local rank? never being used in the bg/p model */
57
58
59
    int num_lrank; /* number of ranks participating in the collective operation*/
};

60
61
62
63
/* supported I/O operations */
enum codes_workload_op_type
{
    /* terminator; there are no more operations for this rank */
64
    CODES_WK_END = 1,
65
66
67
68
69
70
    /* sleep/delay to simulate computation or other activity */
    CODES_WK_DELAY,
    /* block until specified ranks have reached the same point */
    CODES_WK_BARRIER,
    /* open */
    CODES_WK_OPEN,
71
    /* close */
72
73
74
75
76
77
78
79
80
81
82
83
84
85
    CODES_WK_CLOSE,
    /* write */
    CODES_WK_WRITE,
    /* read */
    CODES_WK_READ
};

/* I/O operation paramaters */
struct codes_workload_op
{
    /* TODO: do we need different "classes" of operations to differentiate
     * between different APIs?
     */

Philip Carns's avatar
Philip Carns committed
86
    /* what type of operation this is */
87
88
    enum codes_workload_op_type op_type;

Philip Carns's avatar
Philip Carns committed
89
    /* parameters for each operation type */
90
91
92
93
94
95
    union
    {
        struct {
            double seconds;
        } delay;
        struct {
Philip Carns's avatar
Philip Carns committed
96
            int count;  /* num ranks in barrier, -1 means "all" */
97
98
99
            int root;   /* root rank */
        } barrier;
        struct {
100
            uint64_t file_id;      /* integer identifier for the file */
101
102
103
            int create_flag;  /* file must be created, not just opened */
        } open;
        struct {
104
            uint64_t file_id;  /* file to operate on */
105
106
107
108
            off_t offset; /* offset and size */
            size_t size;
        } write;
        struct {
109
            uint64_t file_id;  /* file to operate on */
110
111
112
113
            off_t offset; /* offset and size */
            size_t size;
        } read;
        struct {
114
            uint64_t file_id;  /* file to operate on */
115
        } close;
116
    }u;
117
118
119
120
};

/* load and initialize workload of of type "type" with parameters specified by
 * "params".  The rank is the caller's relative rank within the collection
121
 * of processes that will participate in this workload.
122
123
124
125
 *
 * This function is intended to be called by a compute node LP in a model
 * and may be called multiple times over the course of a
 * simulation in order to execute different application workloads.
126
 *
127
128
129
130
131
132
133
134
135
 * Returns and identifier that can be used to retrieve operations later.
 * Returns -1 on failure.
 */
int codes_workload_load(const char* type, const char* params, int rank);

/* Retrieves the next I/O operation to execute.  the wkld_id is the
 * identifier returned by the init() function.  The op argument is a pointer
 * to a structure to be filled in with I/O operation information.
 */
136
void codes_workload_get_next(int wkld_id, int rank, struct codes_workload_op *op);
137
138

/* Reverse of the above function. */
139
void codes_workload_get_next_rc(int wkld_id, int rank, const struct codes_workload_op *op);
140

141
142
143
/* Retrieve the number of ranks contained in a workload */
int codes_workload_get_rank_cnt(const char* type, const char* params);

144
145
146
/* for debugging/logging: print an individual operation to the specified file */
void codes_workload_print_op(FILE *f, struct codes_workload_op *op, int rank);

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* NOTE: there is deliberately no finalize function; we don't have any
 * reliable way to tell when a workload is truly done and will not
 * participate in further reverse computation.   The underlying generators
 * will shut down automatically once they have issued their last event.
 */

#endif /* CODES_WORKLOAD_H */

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */