Mercurial > hg > Game > Cerium
changeset 1966:d45b7223515b draft
add comment
author | kkb |
---|---|
date | Thu, 13 Feb 2014 14:57:04 +0900 |
parents | 59105550c175 |
children | e1b377a42c54 a68dbdf9b429 |
files | TaskManager/Cuda/CudaScheduler.cc |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cuda/CudaScheduler.cc Thu Feb 13 00:29:49 2014 +0900 +++ b/TaskManager/Cuda/CudaScheduler.cc Thu Feb 13 14:57:04 2014 +0900 @@ -107,9 +107,12 @@ void CudaScheduler::wait_for_event(CudaBufferPtr cudabuffer, TaskListPtr taskList, int cur) { + if (cuStreamQuery(cudabuffer[cur].stream) == CUDA_SUCCESS) { + // all operation is not executed in the stream } else if (cuStreamQuery(cudabuffer[cur].stream) == CUDA_ERROR_NOT_READY){ + // wait for finish ret = cuStreamSynchronize(cudabuffer[cur].stream); if (ret!=0) { error(convert_error_status(ret)); @@ -263,10 +266,10 @@ ret = cuMemcpyDtoHAsync(output_buf->addr, mem[i0], output_buf->size, cudabuffer[cur].stream); if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } } + wait_for_event(cudabuffer, tasklist, cur); cur++; // wait write[cur+1] if (STAGE <= cur) // to stop pipeline move to after wait_for_event cur = 0; // - wait_for_event(cudabuffer, tasklist, cur); } reply = (memaddr)tasklist->waiter; param_addr = (memaddr)tasklist->next;