void Queue::run(Kernel& kernel, unsigned int dimensionsNumber, const size_t *globalOffset, const size_t *globalSize, const size_t *localSize, const std::vector<Event*>& eventWaitList, Event& event) { /* Run kernel from first instrumentation */ cl_event* waitListIds = new cl_event[eventWaitList.size()]; getEventsId(eventWaitList, waitListIds); run(queue, kernel.getLenId(), dimensionsNumber, globalOffset, globalSize, localSize, eventWaitList.size(), waitListIds, event.getId()); cl_int err = clEnqueueReadBuffer(queue, kernel.trace1_buffer, CL_TRUE, 0, sizeof(kernel.h_trace1),kernel.h_trace1, 0, NULL, NULL); verifyOutputCode(err, "could not read buffer"); /* Allocate buffers for second instrumentation */ kernel.alloc(localSize,dimensionsNumber); /* Run kernel from second instrumentation */ run(queue, kernel.getId(), dimensionsNumber, globalOffset, globalSize, localSize, eventWaitList.size(), waitListIds, event.getId()); /* Read trace data from buffers */ err = clEnqueueReadBuffer(queue, kernel.addr_buffer, CL_TRUE, 0, sizeof(kernel.h_addr),kernel.h_addr, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, kernel.id_buffer, CL_TRUE, 0, sizeof(kernel.h_id),kernel.h_id, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, kernel.loop_buffer, CL_TRUE, 0, sizeof(kernel.h_loop),kernel.h_loop, 0, NULL, NULL); verifyOutputCode(err, "could not read buffer"); /* Dump trace to file */ kernel.write_trace(localSize,dimensionsNumber); }
void Queue::run( Kernel& kernel, unsigned int dimensionsNumber, const size_t *globalOffset, const size_t *globalSize, const size_t *localSize) { /* Run kernel from first instrumentation */ run(queue, kernel.getLenId(), dimensionsNumber, globalOffset, globalSize, localSize, 0, NULL, NULL); cl_int err = clEnqueueReadBuffer(queue, kernel.trace1_buffer, CL_TRUE, 0, sizeof(kernel.h_trace1),kernel.h_trace1, 0, NULL, NULL); verifyOutputCode(err, "could not read buffer"); /* Allocate buffers for second instrumentation */ kernel.alloc(localSize,dimensionsNumber); /* Run kernel from second instrumentation */ run(queue, kernel.getId(), dimensionsNumber, globalOffset, globalSize, localSize, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, kernel.addr_buffer, CL_TRUE, 0, sizeof(kernel.h_addr),kernel.h_addr, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, kernel.id_buffer, CL_TRUE, 0, sizeof(kernel.h_id),kernel.h_id, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, kernel.loop_buffer, CL_TRUE, 0, sizeof(kernel.h_loop),kernel.h_loop, 0, NULL, NULL); verifyOutputCode(err, "could not read buffer"); /* Dump trace to file */ kernel.write_trace(localSize,dimensionsNumber); }