00001 #ifndef OPENCL_SOLVER_H
00002 #define OPENCL_SOLVER_H
00003
00004 #include "parallel_solver.h"
00005
00006 #include <string>
00007
00008 namespace parallel_ode
00009 {
00010
00011 static const int DEFAULT_CL_FLAGS =
00012 ParallelFlags::PARALLEL_ALIGN
00013
00014 | ParallelFlags::PARALLEL_REDUCE
00015 | ParallelFlags::PARALLEL_ASYNC
00016 | ParallelFlags::PARALLEL_RANDOMIZE;
00017
00018 template<typename T>
00019 class OpenCLPGSSolver : public ParallelPGSSolver<T, T, ParallelTypes::OpenCL>
00020 {
00021 public:
00022 typedef typename vec4<T>::Type Vec4T;
00023 typedef const T* TPtr;
00024 typedef T* TMutablePtr;
00025
00026 OpenCLPGSSolver( int parallelFlags = DEFAULT_CL_FLAGS,
00027 BatchType batchType = BatchTypes::DEFAULT_BATCH_TYPE,
00028 ReduceType reduceType = ReduceTypes::REDUCE_STRIDED,
00029 uint numBatches = ParallelOptions::MAXBATCHES )
00030
00031 : ParallelPGSSolver<T, T, ParallelTypes::OpenCL>( parallelFlags, batchType, reduceType, numBatches ) {
00032
00033 }
00034
00035 virtual ~OpenCLPGSSolver( ) {
00036
00037 }
00038
00039 virtual void initialize( );
00040
00041 protected:
00042
00043 virtual void solveAndReduce( const int offset, const int batchSize );
00044
00045 virtual void loadConstraints( );
00046
00047 virtual void loadKernels( );
00048
00049 };
00050
00051 }
00052
00053 #endif