-
Notifications
You must be signed in to change notification settings - Fork 27
/
oclfunctions.h
135 lines (111 loc) · 2.8 KB
/
oclfunctions.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#ifndef OCLFUNCTIONS_H
#define OCLFUNCTIONS_H
#define CL_TARGET_OPENCL_VERSION 120
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#ifdef __APPLE__
# include <OpenCL/cl.h>
# define CL_CALLBACK
#else
# include <CL/cl.h>
#endif
#include <iostream>
#include <vector>
#pragma warning (disable : 4996)
using namespace std;
cl_mem oclCreateBuffer(
cl_context context,
cl_mem_flags flags,
size_t size,
void *host_ptr);
void oclGetPlatformIDs(
cl_uint num_entries,
cl_platform_id *platforms,
cl_uint *num_platforms);
void oclGetDeviceIDs(
cl_platform_id platform,
cl_device_type device_type, cl_uint num_entries,
cl_device_id *devices,
cl_uint *num_devices);
cl_context oclCreateContext(
cl_context_properties *properties,
cl_uint num_devices,
const cl_device_id *devices,
void (CL_CALLBACK *pfn_notify)(
const char *errinfo,
const void *private_info,
size_t cb,
void *user_data
),
void *user_data);
cl_program oclCreateProgramWithSource(
cl_context context,
cl_uint count,
const char **strings,
const size_t *lengths);
void oclBuildProgram(
cl_program program,
cl_uint num_devices,
const cl_device_id *device_list,
const char *options,
void(CL_CALLBACK *pfn_notify)(cl_program, void *user_data),
void *user_data);
cl_kernel oclCreateKernel(
cl_program program,
const char *kernel_name);
cl_command_queue oclCreateCommandQueue(
cl_context context,
cl_device_id device,
cl_command_queue_properties properties);
void oclGetPlatformInfo(
cl_platform_id platform,
cl_platform_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
void oclGetDeviceInfo(
cl_device_id device,
cl_device_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
void oclReleaseKernel(cl_kernel kernel);
void oclReleaseCommandQueue(cl_command_queue command_queue);
void oclReleaseContext(cl_context context);
void oclEnqueueWriteBuffer(
cl_command_queue command_queue,
cl_mem buffer,
cl_bool blocking_write,
size_t offset,
size_t cb,
const void *ptr,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
void oclFinish(cl_command_queue command_queue);
void oclSetKernelArg(
cl_kernel kernel,
cl_uint arg_index,
size_t arg_size,
const void *arg_value);
void oclEnqueueNDRangeKernel(
cl_command_queue command_queue,
cl_kernel kernel,
cl_uint work_dim,
const size_t *global_work_offset,
const size_t *global_work_size,
const size_t *local_work_size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
void oclEnqueueReadBuffer(
cl_command_queue command_queue,
cl_mem buffer,
cl_bool blocking_read,
size_t offset,
size_t cb,
void *ptr,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
void clearbufvec(vector<cl_mem> *bufvec);
#endif