-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathocl.h
74 lines (67 loc) · 3.73 KB
/
ocl.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
/*
* This file is part of oclkit.
*
* oclkit is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* oclkit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with oclkit. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OCL_H
#define OCL_H
#include <CL/cl.h>
#include <stdio.h>
typedef struct OclPlatform OclPlatform;
#define OCL_CHECK_ERROR(error) { \
if ((error) != CL_SUCCESS) fprintf (stderr, "OpenCL error <%s:%i>: %s\n", __FILE__, __LINE__, ocl_strerr((error))); }
int ocl_read_args (int argc,
const char **argv,
unsigned int *platform,
cl_device_type *type);
OclPlatform * ocl_new (unsigned platform,
cl_device_type type);
OclPlatform * ocl_new_with_queues (unsigned platform,
cl_device_type type,
cl_command_queue_properties
queue_properties);
OclPlatform * ocl_new_from_args (int argc,
const char ** argv,
cl_command_queue_properties
queue_properties);
OclPlatform * ocl_new_from_args_bare
(int argc,
const char **argv);
void ocl_print_usage (void);
void ocl_free (OclPlatform *ocl);
char * ocl_get_platform_info
(OclPlatform *ocl,
cl_platform_info param);
cl_context ocl_get_context (OclPlatform *ocl);
cl_program ocl_create_program_from_file
(OclPlatform *ocl,
const char *filename,
const char *options,
cl_int *errcode);
cl_program ocl_create_program_from_source
(OclPlatform *ocl,
const char *source,
const char *options,
cl_int *errcode);
int ocl_get_num_devices (OclPlatform *ocl);
cl_device_id * ocl_get_devices (OclPlatform *ocl);
cl_command_queue * ocl_get_cmd_queues (OclPlatform *ocl);
const char* ocl_strerr (int error);
char* ocl_read_program (const char *filename);
void ocl_get_event_times (cl_event event,
cl_ulong *start,
cl_ulong *end,
cl_ulong *queued,
cl_ulong *submitted);
#endif