CodesKernelHelpers.h 1.26 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#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>


14 15 16
#include "codes/CodesIOKernelTypes.h"
#include "codes/CodesIOKernelParser.h"
#include "codes/codeslexer.h"
17 18 19 20 21 22 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

#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