/// Wait for events in the list inline void wait_for_events(const wait_list &events) { std::map<context_id, wait_list> by_context; for(auto e = events.begin(); e != events.end(); ++e) { context_id ctx = get_context_id(*e); by_context[ctx].push_back(*e); } for(auto c = by_context.begin(); c != by_context.end(); ++c) cl::Event::waitForEvents(c->second); }
/// Enqueue marker (with wait list) into the queue inline event enqueue_marker(command_queue &q, const wait_list &events = wait_list()) { context_id ctx = get_context_id(q); wait_list my_events; std::copy_if(events.begin(), events.end(), std::back_inserter(my_events), [=](const event &e){ return ctx == get_context_id(e); }); event e; q.enqueueMarkerWithWaitList(&my_events, &e); return e; }
/// Append wait list to wait list inline void wait_list_append(wait_list &dst, const wait_list &src) { dst.insert(dst.begin(), src.begin(), src.end()); }