StarPU Handbook - StarPU Introduction
starpu_opencl.h File Reference
#include <starpu_config.h>
#include <CL/cl.h>
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  starpu_opencl_program
 

Macros

#define CL_TARGET_OPENCL_VERSION
 

Functions

Writing OpenCL kernels
void starpu_opencl_get_context (int devid, cl_context *context)
 
void starpu_opencl_get_device (int devid, cl_device_id *device)
 
void starpu_opencl_get_queue (int devid, cl_command_queue *queue)
 
void starpu_opencl_get_current_context (cl_context *context)
 
void starpu_opencl_get_current_queue (cl_command_queue *queue)
 
int starpu_opencl_set_kernel_args (cl_int *err, cl_kernel *kernel,...)
 
Compiling OpenCL kernels

Source codes for OpenCL kernels can be stored in a file or in a string. StarPU provides functions to build the program executable for each available OpenCL device as a cl_program object. This program executable can then be loaded within a specific queue as explained in the next section. These are only helpers, Applications can also fill a starpu_opencl_program array by hand for more advanced use (e.g. different programs on the different OpenCL devices, for relocation purpose for instance).

void starpu_opencl_load_program_source (const char *source_file_name, char *located_file_name, char *located_dir_name, char *opencl_program_source)
 
void starpu_opencl_load_program_source_malloc (const char *source_file_name, char **located_file_name, char **located_dir_name, char **opencl_program_source)
 
int starpu_opencl_compile_opencl_from_file (const char *source_file_name, const char *build_options)
 
int starpu_opencl_compile_opencl_from_string (const char *opencl_program_source, const char *file_name, const char *build_options)
 
int starpu_opencl_load_binary_opencl (const char *kernel_id, struct starpu_opencl_program *opencl_programs)
 
int starpu_opencl_load_opencl_from_file (const char *source_file_name, struct starpu_opencl_program *opencl_programs, const char *build_options)
 
int starpu_opencl_load_opencl_from_string (const char *opencl_program_source, struct starpu_opencl_program *opencl_programs, const char *build_options)
 
int starpu_opencl_unload_opencl (struct starpu_opencl_program *opencl_programs)
 
Loading OpenCL kernels
int starpu_opencl_load_kernel (cl_kernel *kernel, cl_command_queue *queue, struct starpu_opencl_program *opencl_programs, const char *kernel_name, int devid)
 
int starpu_opencl_release_kernel (cl_kernel kernel)
 
OpenCL Statistics
int starpu_opencl_collect_stats (cl_event event)
 

OpenCL Utilities

#define STARPU_OPENCL_DISPLAY_ERROR(status)
 
#define STARPU_OPENCL_REPORT_ERROR(status)
 
#define STARPU_OPENCL_REPORT_ERROR_WITH_MSG(msg, status)
 
const char * starpu_opencl_error_string (cl_int status)
 
void starpu_opencl_display_error (const char *func, const char *file, int line, const char *msg, cl_int status)
 
static __starpu_inline void starpu_opencl_report_error (const char *func, const char *file, int line, const char *msg, cl_int status)
 
cl_int starpu_opencl_allocate_memory (int devid, cl_mem *addr, size_t size, cl_mem_flags flags)
 
cl_int starpu_opencl_copy_ram_to_opencl (void *ptr, unsigned src_node, cl_mem buffer, unsigned dst_node, size_t size, size_t offset, cl_event *event, int *ret)
 
cl_int starpu_opencl_copy_opencl_to_ram (cl_mem buffer, unsigned src_node, void *ptr, unsigned dst_node, size_t size, size_t offset, cl_event *event, int *ret)
 
cl_int starpu_opencl_copy_opencl_to_opencl (cl_mem src, unsigned src_node, size_t src_offset, cl_mem dst, unsigned dst_node, size_t dst_offset, size_t size, cl_event *event, int *ret)
 
cl_int starpu_opencl_copy_async_sync (uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, cl_event *event)