00001
00010 #ifndef _COMPUTE_H_
00011 #define _COMPUTE_H_
00012 #include "globals.h"
00013 #include <assert.h>
00014 #ifdef USE_CL
00015
00019 class TCompute
00020 {
00021 protected:
00022 cl_device_id device;
00023 cl_context context;
00024 cl_command_queue commandQueue;
00025 cl_program program;
00026 cl_kernel kernel;
00027 cl_int status;
00028
00029 size_t groupSize;
00030 size_t* maxWorkItemSizes;
00031 size_t maxWorkGroupSize;
00032 cl_uint maxDimensions;
00033 cl_ulong totalLocalMemory;
00034 cl_ulong usedLocalMemory;
00035
00036 cl_float dT;
00037
00038 public:
00039 cl_float* pos;
00040
00041 TCompute();
00043 ~TCompute()
00044 { Destroy(); }
00045 bool InitCL();
00046 string LoadSource(const char* source);
00047 bool SetupKernel(const char* source_file, const char* func_name);
00048
00049 virtual bool Destroy();
00050
00052 virtual bool Init()
00053 { return true; }
00054 virtual bool SetupKernelArgs()
00055 { return true; }
00056 virtual bool Run()
00057 { return true; }
00058 };
00059
00060
00061
00062 #endif
00063 #endif