00001 #ifndef _CKLOOPAPI_H
00002 #define _CKLOOPAPI_H
00003
00004 #include "CkLoop.decl.h"
00005
00006
00007 typedef void (*HelperFn)(int first,int last, void *result, int paramNum, void *param);
00008
00009 typedef void (*CallerFn)(int paramNum, void *param);
00010
00011 typedef enum REDUCTION_TYPE {
00012 CKLOOP_NONE=0,
00013 CKLOOP_INT_SUM,
00014 CKLOOP_FLOAT_SUM,
00015 CKLOOP_DOUBLE_SUM,
00016 CKLOOP_DOUBLE_MAX
00017 } REDUCTION_TYPE;
00018
00019 typedef enum CkLoop_sched { CKLOOP_NODE_QUEUE=0, CKLOOP_TREE, CKLOOP_LIST} CkLoop_sched;
00020
00021 class CProxy_FuncCkLoop;
00022
00023
00024
00025
00026
00027 extern CProxy_FuncCkLoop CkLoop_Init(int numThreads=0);
00028
00029
00030 extern void CkLoop_Exit(CProxy_FuncCkLoop ckLoop);
00031
00032 extern void CkLoop_Parallelize(
00033 HelperFn func,
00034 int paramNum, void * param,
00035 int numChunks,
00036 int lowerRange, int upperRange,
00037 int sync=1,
00038 void *redResult=NULL, REDUCTION_TYPE type=CKLOOP_NONE,
00039 CallerFn cfunc=NULL,
00040 int cparamNum=0, void *cparam=NULL
00041 );
00042
00043 extern void CkLoop_ParallelizeHybrid(
00044 float staticFraction,
00045 HelperFn func,
00046 int paramNum, void * param,
00047 int numChunks,
00048 int lowerRange, int upperRange,
00049 int sync=1,
00050 void *redResult=NULL, REDUCTION_TYPE type=CKLOOP_NONE,
00051 CallerFn cfunc=NULL,
00052 int cparamNum=0, void *cparam=NULL
00053 );
00054
00055
00056 extern void CkLoop_SetSchedPolicy(CkLoop_sched schedPolicy);
00057
00058 extern void CkLoop_DestroyHelpers();
00059 #endif