bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
 All Classes Files Functions Variables Typedefs Macros
opencl.h
Go to the documentation of this file.
1 /*
2  * opencl.h
3  *
4  * Copyright (C) 2013-2016 Fabian Gieseke <fabian.gieseke@di.ku.dk>
5  * 2013 Justin Heinermann <justin.heinermann@uni-oldenburg.de>
6  * License: GPL v2
7  *
8  */
9 
10 #ifndef INCLUDE_OPENCL_H_
11 #define INCLUDE_OPENCL_H_
12 
13 #ifdef MAC
14 #include <OpenCL/cl.h>
15 #else
16 #include <CL/cl.h>
17 #endif
18 
19 #include <unistd.h>
20 #include <stdio.h>
21 #include <string.h>
22 
23 // helper macros
24 #define STR_HELPER(x) #x
25 #define STR(x) STR_HELPER(x)
26 
27 #define MAX_KERNEL_SOURCE_LENGTH 100000
28 #define MAX_KERNEL_CONSTANTS_LENGTH 1000
29 
30 typedef struct {
33 } DEVICE_INFOS;
34 
35 #define ERROR_NO_PLATFORMS -1
36 #define ERROR_INVALID_PLATFORMS -2
37 #define ERROR_NO_DEVICES -3
38 #define ERROR_INVALID_DEVICE -4
39 
52 void init_opencl(cl_uint platform_number,
53  cl_platform_id *platform,
54  cl_uint device_number,
55  cl_device_id *device,
56  cl_context *context,
57  cl_command_queue *command_queue,
58  int verbose);
59 
68 void init_command_queue(cl_command_queue *command_queue,
69  cl_device_id *device,
70  cl_context *context);
71 
79 void print_build_information(cl_program program,
80  cl_device_id device);
81 
90 int get_device_infos(cl_uint platform_number,
91  cl_uint device_number,
92  DEVICE_INFOS *device_infos);
93 
102 void check_cl_error(cl_int err,
103  const char *file,
104  int line);
105 
115 cl_kernel make_kernel_from_file(cl_context context,
116  cl_device_id device,
117  char *kernel_constants,
118  char *kernel_filename,
119  const char *kernel_name);
120 
128 void readfile(char *filename,
129  char **text,
130  unsigned long *size);
131 
132 #endif /* INCLUDE_OPENCL_H_ */
long device_mem_bytes
Definition: opencl.h:31
void readfile(char *filename, char **text, unsigned long *size)
Definition: opencl.c:363
cl_kernel make_kernel_from_file(cl_context context, cl_device_id device, char *kernel_constants, char *kernel_filename, const char *kernel_name)
Definition: opencl.c:300
long device_max_alloc_bytes
Definition: opencl.h:32
void check_cl_error(cl_int err, const char *file, int line)
Definition: opencl.c:280
void init_opencl(cl_uint platform_number, cl_platform_id *platform, cl_uint device_number, cl_device_id *device, cl_context *context, cl_command_queue *command_queue, int verbose)
Definition: opencl.c:24
Definition: opencl.h:30
int get_device_infos(cl_uint platform_number, cl_uint device_number, DEVICE_INFOS *device_infos)
Definition: opencl.c:199
void init_command_queue(cl_command_queue *command_queue, cl_device_id *device, cl_context *context)
Definition: opencl.c:148
void print_build_information(cl_program program, cl_device_id device)
Definition: opencl.c:166