view TaskManager/ManyCore/FileMapReduce.h @ 2069:26aa08c9a1de draft default tip

cuda example fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Feb 2017 10:04:55 +0900
parents 58a32f966763
children
line wrap: on
line source

#include <sys/types.h>

#include "TaskManager.h"
#include "SchedTask.h"
#include "HTask.h"

class FileMapReduce;

typedef struct mapReduce {
    struct mapReduce *self;
    FileMapReduce *fmp;
    long fd;
    long read_filesize;
    CPU_TYPE read_cpu;

    long size;             // remaining file size
    long division_size;    // for each word count task
    long division_out_size;
    long overrap;          // block overrap size
    long task_num;         // task count
    long remain_task;      // remaining task count
    long task_blocks;      // spawn task one at a time
    long task_spawned;
    unsigned long long *o_data;
    long pad;
    char *file_mmap;
    long file_size;
    HTaskPtr t_print;
    void* global;          // generale user data
} MapReduce, *MapReducePtr;

// Read Type
enum {
    MY_MMAP,
    MY_READ,
    BLOCKED_READ,
    BLOCKED_MMAP,
};

#define DATA_ID 0

class FileMapReduce {
public:
    /* constructor */
    FileMapReduce(TaskManager *manager,int TASK_EXEC,int TASK_EXEC_DATA_PARALLEL,int TASK_PRINT);
    ~FileMapReduce();

    /* User API */
    void run_start(TaskManager *manager, const char *filename);
    void run_tasks(SchedTask *manager, MapReduce *w, int task_count, HTaskPtr t_read, HTaskPtr t_next, int size);
    char* init(int argc, char **argv);

private:
    void my_read(const char *filename, MapReduce *w, TaskManager *manager);
    void my_mmap(const char *filename, MapReduce *w);
    void task_init(void);

    /* variable */
    int all;
    int use_task_array;
    int use_task_creater ;
    int use_compat ;
    int array_task_num ;
    int spe_num ;
    int read_type ;
    int t_exec_num ;
    CPU_TYPE spe_cpu ;
    int TASK_EXEC;
    int TASK_EXEC_DATA_PARALLEL;
    int TASK_PRINT;
public:
    MapReducePtr w;
    CPU_TYPE read_spe_cpu;
    int blocks;
    int division; // in Kbyte
    int division_out_size;
    int overrap;
    int use_iterate;
    int task_exec_id;
    int task_print_id;
    bool debug;
    const char *fmp_help_str;
};