void mtapi_context_runtime_notify( MTAPI_IN mtapi_task_context_t* task_context, MTAPI_IN mtapi_notification_t notification, MTAPI_IN void* data, MTAPI_IN mtapi_size_t data_size, MTAPI_OUT mtapi_status_t* status) { mtapi_status_t local_status = MTAPI_ERR_UNKNOWN; EMBB_UNUSED(notification); EMBB_UNUSED(data); EMBB_UNUSED(data_size); embb_mtapi_log_trace("mtapi_context_runtime_notify() called\n"); if (MTAPI_NULL != task_context) { mtapi_task_context_t* local_context = (mtapi_task_context_t*) embb_tss_get( &(task_context->thread_context->tss_id)); if (local_context == task_context) { local_status = MTAPI_SUCCESS; } else { local_status = MTAPI_ERR_CONTEXT_OUTOFCONTEXT; } } else { local_status = MTAPI_ERR_CONTEXT_INVALID; } mtapi_status_set(status, local_status); }
static void CL_API_CALL opencl_task_complete( cl_event ev, cl_int status, void * data) { EMBB_UNUSED(ev); EMBB_UNUSED(status); cl_int err; EMBB_UNUSED_IN_RELEASE(err); embb_mtapi_opencl_task_t * opencl_task = (embb_mtapi_opencl_task_t*)data; if (embb_mtapi_node_is_initialized()) { embb_mtapi_node_t * node = embb_mtapi_node_get_instance(); if (embb_mtapi_task_pool_is_handle_valid( node->task_pool, opencl_task->task)) { embb_mtapi_task_t * local_task = embb_mtapi_task_pool_get_storage_for_handle( node->task_pool, opencl_task->task); err = clWaitForEvents(1, &opencl_task->kernel_finish_event); assert(CL_SUCCESS == err); if (NULL != opencl_task->result_buffer) { err = clReleaseMemObject(opencl_task->result_buffer); assert(CL_SUCCESS == err); } if (NULL != opencl_task->arguments) { err = clReleaseMemObject(opencl_task->arguments); assert(CL_SUCCESS == err); } embb_mtapi_task_set_state(local_task, MTAPI_TASK_COMPLETED); } } }
static void opencl_task_cancel( MTAPI_IN mtapi_task_hndl_t task, MTAPI_OUT mtapi_status_t* status ) { mtapi_status_t local_status = MTAPI_ERR_UNKNOWN; EMBB_UNUSED(task); mtapi_status_set(status, local_status); }
void mtapi_group_get_attribute( MTAPI_IN mtapi_group_hndl_t group, MTAPI_IN mtapi_uint_t attribute_num, MTAPI_OUT void* attribute, MTAPI_IN mtapi_size_t attribute_size, MTAPI_OUT mtapi_status_t* status ) { mtapi_status_t local_status = MTAPI_ERR_UNKNOWN; EMBB_UNUSED(attribute_num); EMBB_UNUSED(attribute_size); embb_mtapi_log_trace("mtapi_group_get_attribute() called\n"); if (embb_mtapi_node_is_initialized()) { embb_mtapi_node_t* node = embb_mtapi_node_get_instance(); if (embb_mtapi_group_pool_is_handle_valid(node->group_pool, group)) { /* the following is not needed for now, since there are no attributes embb_mtapi_group_t* local_group = embb_mtapi_group_pool_get_storage_for_handle( node->group_pool, group); */ if (MTAPI_NULL == attribute) { local_status = MTAPI_ERR_PARAMETER; } else { /* switch is not needed for now, since there are no attributes switch (attribute_num) { default: */ local_status = MTAPI_ERR_ATTR_NUM; /* break; }*/ } } else { local_status = MTAPI_ERR_GROUP_INVALID; } } else { embb_mtapi_log_error("mtapi not initialized\n"); local_status = MTAPI_ERR_NODE_NOTINIT; } mtapi_status_set(status, local_status); }
int embb_mutex_init(embb_mutex_t* mutex, int type) { /* Critical sections in Windows are always recursive */ InitializeCriticalSection(mutex); EMBB_UNUSED(type); return EMBB_SUCCESS; }