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

7
#include <assert.h>
8
9
10
11
12

#include "ross.h"
#include "codes/codes-workload.h"
#include "codes-workload-method.h"

13
14
15
16
17
18
19
/* list of available methods.  These are statically compiled for now, but we
 * could make generators optional via autoconf tests etc. if needed 
 */ 
extern struct codes_workload_method test_workload_method;
static struct codes_workload_method *method_array[] = 
    {&test_workload_method, NULL};

20
21
int codes_workload_load(const char* type, const char* params, int rank)
{
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    int i;
    int ret;

    for(i=0; method_array[i] != NULL; i++)
    {
        if(strcmp(method_array[i]->method_name, type) == 0)
        {
            ret = method_array[i]->codes_workload_load(params, rank);
            if(ret < 0)
            {
                return(-1);
            }
            return(i);
        }
    }

    fprintf(stderr, "Error: failed to find workload generator %s\n", type);
39
40
41
    return(-1);
}

42
void codes_workload_get_next(int wkld_id, int rank, struct codes_workload_op *op)
43
{
44
45
    method_array[wkld_id]->codes_workload_get_next(rank, op);

46
47
48
    return;
}

49
void codes_workload_get_next_rc(int wkld_id, int rank, const struct codes_workload_op *op)
50
{
51
52
53
    /* TODO: fill this in */

    assert(0);
54
55
56
57
58
59
60
61
62
63
64
    return;
}

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