00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _TEST_COMPUTE_H_
00012 #define _TEST_COMPUTE_H_
00013 #include "test.h"
00014
00015 #ifdef USE_CL
00016 const int BODIES = 4096;
00017 const int MESH_SIZE = 32;
00018
00023 class NBodySim : public TCompute
00024 {
00025 private:
00026
00027 cl_uint numBodies;
00028 cl_float espSqr;
00029
00030 cl_float* initPos;
00031 cl_float* pos;
00032
00033 cl_float* initVel;
00034 cl_float* vel;
00035
00036 cl_mem updatedPos;
00037 cl_mem updatedVel;
00038
00039
00040 cl_ulong start, end;
00041 float kernel_time, flops, total_flops;
00042
00043
00044 public:
00045 bool Init();
00046 bool SetupKernelArgs();
00047 bool Run();
00048 bool Destroy();
00049
00050 float GetPos(int index)
00051 { return pos[index]; }
00052 float GetFLOPS()
00053 { return flops; }
00054 float GetTotalFLOPS()
00055 { return total_flops; }
00056 };
00057
00091 class TestCompute : public Test
00092 {
00093 private:
00094 NBodySim *nbody;
00095
00096 string name;
00097
00098 int body,halfbody;
00099 char objname[32];
00100 public:
00101 TestCompute(int duration,int type, TScene *s);
00102 ~TestCompute();
00103 void SaveResults();
00104 void Run();
00105 void Animate();
00106 };
00107 #endif
00108 #endif