[code="java"][/code]#ifndef DEVICE_H
#define DEVICE_H
#include <string.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
#include <time.h>
#include <CL/opencl.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/time.h>
#include <linux/limits.h>
#endif
#define SDK_SUCCESS 0
#define SDK_FAILURE 1
#define WIDTH 128*1024
#define HEIGHT 512
#define NUM_THREADS 128*1024*512
#define NUM_GROUP_THREADS 1024*512
#define GROUP 128
//macro function for opencl API check.
#define CHECK_CL_ERROR(status,msg)\
if (CL_SUCCESS != status )\
{\
std::cout<<"Error:"<<msg<<std::endl;\
return SDK_FAILURE;\
}
/* Timer class to handle time measuring functionality */
class Timer
{
public:
int createTimer();
int startTimer();
int resetTimer();
int stopTimer();
double readTimer();
private:
long long _freq; // clock frequency
long long _clocks;// number of ticks at end
long long _start;//start point ticks
double totaltime;//time elapsed
};
class Device
{
public:
//CL Objects and memory buffers
int status;
cl_device_type dType; //device type
cl_device_id deviceId; //device ID
cl_context context; //context
cl_command_queue queue; //command-queue
cl_mem inputBuffer; //input buffer
cl_mem outputBuffer; //output buffer
cl_program program; //program object
cl_kernel kernel; //kernel object
cl_event eventObject; //event object
cl_ulong kernelStartTime; //kernel start time
cl_ulong kernelEndTime; //kernel end time
double elapsedTime; //elapsed time in ms
cl_int eventStatus; //command queue event status flag
size_t globalThreads[2] ;
size_t localThreads[2] ;
Device();
~Device();
};
#endif /* #ifndef MULTI_GPU_H */
#define DEVICE_H
#include <string.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
#include <time.h>
#include <CL/opencl.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/time.h>
#include <linux/limits.h>
#endif
#define SDK_SUCCESS 0
#define SDK_FAILURE 1
#define WIDTH 128*1024
#define HEIGHT 512
#define NUM_THREADS 128*1024*512
#define NUM_GROUP_THREADS 1024*512
#define GROUP 128
//macro function for opencl API check.
#define CHECK_CL_ERROR(status,msg)\
if (CL_SUCCESS != status )\
{\
std::cout<<"Error:"<<msg<<std::endl;\
return SDK_FAILURE;\
}
/* Timer class to handle time measuring functionality */
class Timer
{
public:
int createTimer();
int startTimer();
int resetTimer();
int stopTimer();
double readTimer();
private:
long long _freq; // clock frequency
long long _clocks;// number of ticks at end
long long _start;//start point ticks
double totaltime;//time elapsed
};
class Device
{
public:
//CL Objects and memory buffers
int status;
cl_device_type dType; //device type
cl_device_id deviceId; //device ID
cl_context context; //context
cl_command_queue queue; //command-queue
cl_mem inputBuffer; //input buffer
cl_mem outputBuffer; //output buffer
cl_program program; //program object
cl_kernel kernel; //kernel object
cl_event eventObject; //event object
cl_ulong kernelStartTime; //kernel start time
cl_ulong kernelEndTime; //kernel end time
double elapsedTime; //elapsed time in ms
cl_int eventStatus; //command queue event status flag
size_t globalThreads[2] ;
size_t localThreads[2] ;
Device();
~Device();
};
#endif /* #ifndef MULTI_GPU_H */