-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopencl.hpp
29 lines (29 loc) · 1 KB
/
opencl.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <iostream>
#include <fstream>
#include <sstream>
#include <time.h>
#include "mat.h"
#pragma warning( disable : 4996 )
#ifdef __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
using namespace std;
//声明这些变量,注意只能定义一次
extern FILE *fpp;//保存OPENCL计算时间
extern cl_context context;
extern cl_command_queue commandQueue;
extern cl_program program;
extern cl_device_id device;
extern cl_kernel kernel,kernel2;
extern cl_mem memObjects[3];//默认没什么用
extern cl_int errNum;
const int ARRAY_SIZE = 10000;
int initOpenCL(FILE *fp);
cl_context CreateContext(int type);
cl_command_queue CreateCommandQueue(cl_context context, cl_device_id *device, int type);
cl_program CreateProgram(cl_context context, cl_device_id device, const char* fileName);
bool CreateMemObjects(cl_context context, cl_mem memObjects[3], float *a, float *b);
void Cleanup(cl_context context, cl_command_queue commandQueue, cl_program program, cl_kernel kernel, cl_mem memObjects[3]);