1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include <iostream>
- #include <stdio.h>
- #include <map>
- #include <string>
- #include <cstring>
- // OpenCL header files
- #ifdef __APPLE__
- #include <OpenCL/cl.h>
- #include <OpenCL/cl_gl.h>
- #include <OpenCL/cl_gl_ext.h>
- #include <OpenCL/cl_ext.h>
- #else
- #include <CL/cl.h>
- #include <CL/cl_gl.h>
- #include <CL/cl_gl_ext.h>
- #include <CL/cl_ext.h>
- #endif
- using namespace std;
- class OpenCL
- {
- public:
- OpenCL(int displayOutput);
- ~OpenCL();
- void init(int platform_idx, int device_idx, int use_gpu);
- void createKernel(string kernelName, int device_idx);
- cl_kernel kernel(string kernelName);
- void gwSize(size_t theSize);
- cl_context ctxt();
- cl_command_queue q();
- void launch(string toLaunch);
- size_t localSize();
- private:
- int VERBOSE; // Display output text from various functions?
- size_t lwsize; // Local work size.
- size_t gwsize; // Global work size.
- cl_int ret; // Holds the error code returned by cl functions.
- //cl_platform_id platform_id[100];
- cl_device_id device_id[100];
- map<string, cl_kernel> kernelArray;
- cl_context context;
- cl_command_queue command_queue;
- cl_program program;
- void getDevices(int platform_idx, int device_idx, cl_device_type deviceType);
- void buildKernel(int device_idx);
- };
|