Commit 2edfb1b8 by Marcus Winter Committed by unknown

mtapi_opencl_c: implemented mtapi opencl action plugin

parent f9fd8a10
......@@ -25,6 +25,7 @@ include_directories(${EMBB_MTAPI_OPENCL_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../base_c/include
${CMAKE_CURRENT_BINARY_DIR}/../base_c/include
${CMAKE_CURRENT_SOURCE_DIR}/../mtapi_c/include
${CMAKE_CURRENT_SOURCE_DIR}/../mtapi_c/src
)
add_library(embb_mtapi_opencl_c ${EMBB_MTAPI_OPENCL_C_SOURCES} ${EMBB_MTAPI_OPENCL_C_HEADERS})
......
/*
* Copyright (c) 2014, Siemens AG. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMBB_MTAPI_C_MTAPI_OPENCL_H_
#define EMBB_MTAPI_C_MTAPI_OPENCL_H_
#include <embb/mtapi/c/mtapi_ext.h>
#ifdef __cplusplus
extern "C" {
#endif
void mtapi_opencl_plugin_initialize(
MTAPI_OUT mtapi_status_t* status
);
void mtapi_opencl_plugin_finalize(
MTAPI_OUT mtapi_status_t* status
);
mtapi_action_hndl_t mtapi_opencl_action_create(
MTAPI_IN mtapi_job_id_t job_id,
MTAPI_IN char* kernel_source,
MTAPI_IN char* kernel_name,
MTAPI_IN mtapi_size_t local_work_size,
MTAPI_IN mtapi_size_t element_size,
MTAPI_IN void* node_local_data,
MTAPI_IN mtapi_size_t node_local_data_size,
MTAPI_OUT mtapi_status_t* status
);
#ifdef __cplusplus
}
#endif
#endif // EMBB_MTAPI_C_MTAPI_OPENCL_H_
......@@ -53,6 +53,11 @@ DECLARECLFUNC(cl_int, clBuildProgram, (cl_program program, cl_uint num_devices,
return clBuildProgram_Dynamic(program, num_devices, device_list, options, pfn_notify, user_data);
}
DECLARECLFUNC(cl_int, clGetProgramBuildInfo, (cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret))
{
return clGetProgramBuildInfo_Dynamic(program, device, param_name, param_value_size, param_value, param_value_size_ret);
}
DECLARECLFUNC(cl_kernel, clCreateKernel, (cl_program program, const char * kernel_name, cl_int * errcode_ret))
{
return clCreateKernel_Dynamic(program, kernel_name, errcode_ret);
......@@ -78,6 +83,16 @@ DECLARECLFUNC(cl_int, clEnqueueReadBuffer, (cl_command_queue command_queue, cl_m
return clEnqueueReadBuffer_Dynamic(command_queue, buffer, blocking_read, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
}
DECLARECLFUNC(cl_int, clSetEventCallback, (cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *), void * user_data))
{
return clSetEventCallback_Dynamic(event, command_exec_callback_type, pfn_notify, user_data);
}
DECLARECLFUNC(cl_int, clWaitForEvents, (cl_uint num_events, const cl_event * event_list))
{
return clWaitForEvents_Dynamic(num_events, event_list);
}
DECLARECLFUNC(cl_int, clReleaseKernel, (cl_kernel kernel))
{
return clReleaseKernel_Dynamic(kernel);
......@@ -103,6 +118,11 @@ DECLARECLFUNC(cl_int, clReleaseMemObject, (cl_mem memobj))
return clReleaseMemObject_Dynamic(memobj);
}
DECLARECLFUNC(cl_int, clFlush, (cl_command_queue command_queue))
{
return clFlush_Dynamic(command_queue);
}
DECLARECLFUNC(cl_int, clFinish, (cl_command_queue command_queue))
{
return clFinish_Dynamic(command_queue);
......@@ -166,16 +186,20 @@ int embb_mtapi_opencl_link_at_runtime() {
CHECKEDIMPORT(clCreateBuffer);
CHECKEDIMPORT(clCreateProgramWithSource);
CHECKEDIMPORT(clBuildProgram);
CHECKEDIMPORT(clGetProgramBuildInfo);
CHECKEDIMPORT(clCreateKernel);
CHECKEDIMPORT(clSetKernelArg);
CHECKEDIMPORT(clEnqueueWriteBuffer);
CHECKEDIMPORT(clEnqueueNDRangeKernel);
CHECKEDIMPORT(clEnqueueReadBuffer);
CHECKEDIMPORT(clSetEventCallback);
CHECKEDIMPORT(clWaitForEvents);
CHECKEDIMPORT(clReleaseKernel);
CHECKEDIMPORT(clReleaseProgram);
CHECKEDIMPORT(clReleaseCommandQueue);
CHECKEDIMPORT(clReleaseContext);
CHECKEDIMPORT(clReleaseMemObject);
CHECKEDIMPORT(clFlush);
CHECKEDIMPORT(clFinish);
CHECKEDIMPORT(clCreateSampler);
CHECKEDIMPORT(clReleaseSampler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment