CodesKernelHelpers.h 1.48 KB
Newer Older
Philip Carns's avatar
Philip Carns committed
1 2 3 4 5 6
/*
 * Copyright (C) 2013 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef CODE_KERNEL_HELPERS_H
#define CODE_KERNEL_HELPERS_H

#include <stdint.h>
#include <stdlib.h>
#include <sys/stat.h>

#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 500
#endif
#include <unistd.h>


20 21 22
#include "codes/CodesIOKernelTypes.h"
#include "codes/CodesIOKernelParser.h"
#include "codes/codeslexer.h"
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

#define CL_INST_MAX_ARGS 10

enum cl_event_t
{
    CL_GETSIZE=1,
    CL_GETRANK,
    CL_WRITEAT,
    CL_OPEN,
    CL_CLOSE,
    CL_SYNC,
    CL_EXIT,
    CL_NOOP,
    CL_DELETE,
    CL_SLEEP,

    /* last item should be an unknown inst */
    CL_UNKNOWN
};

typedef struct app_cf_info
{
    int gid;
    int min;
    int max;
    int lrank;
    int num_lrank;
} app_cf_info_t;

typedef struct codeslang_inst
{
  int event_type;
  int64_t num_var;
  int64_t var[CL_INST_MAX_ARGS];
} codeslang_inst;

int codes_kernel_helper_parse_input(CodesIOKernel_pstate * ps,
        CodesIOKernelContext * c, codeslang_inst * inst);

int codes_kernel_helper_bootstrap(char * io_kernel_path, char * def_io_kernel_path,
        char * io_kernel_meta_path, int rank, CodesIOKernelContext * c,
        CodesIOKernel_pstate ** ps, app_cf_info_t * task_info,
        codeslang_inst * next_event);

char * code_kernel_helpers_cleventToStr(int inst);
char * code_kernel_helpers_kinstToStr(int inst);
#endif
Philip Carns's avatar
Philip Carns committed
70 71 72 73 74 75 76 77 78

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