Mercurial > hg > Members > yutaka > OpenCL
changeset 5:ef8efbd04df9 default tip
minor change
author | Yutaka_Kinjyo |
---|---|
date | Thu, 28 Jul 2011 11:10:28 +0900 |
parents | 641eef31681e |
children | |
files | WordCount/main.cc |
diffstat | 1 files changed, 2 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/WordCount/main.cc Thu Jul 28 10:55:36 2011 +0900 +++ b/WordCount/main.cc Thu Jul 28 11:10:28 2011 +0900 @@ -163,7 +163,6 @@ // このdivi_size はどうやって決めるよ int divi_size = 1024; - //size_t global_work_size = (st_mmap.size + divi_size - 1) / divi_size; size_t global_work_size = st_mmap.size / divi_size; int remain_size = st_mmap.size - global_work_size * divi_size; if (remain_size > 0) { @@ -219,19 +218,10 @@ int *out_data = (int*)malloc(out_size); -#ifndef BLOKING - - // 演算結果の読み込み - // CL_TRUE で bloking - ret = clEnqueueReadBuffer(command_queue, out_memobj, CL_TRUE, 0, - out_size, out_data, 0, NULL, NULL); - -#else - cl_event ev; // 演算結果の読み込み - // CL_FALSE で non-bloking + // CL_FALSE で non-bloking, CL_TURE で bloking ret = clEnqueueReadBuffer(command_queue, out_memobj, CL_FALSE, 0, out_size, out_data, 0, NULL, &ev); @@ -239,7 +229,6 @@ // これはeventひとつだけど、listにして、複数 wait できる clWaitForEvents(1, &ev); -#endif oclCheckError(ret, CL_SUCCESS); @@ -280,6 +269,7 @@ clReleaseMemObject(out_memobj); clReleaseCommandQueue(command_queue); clReleaseContext(context); + clReleaseEvent(ev); free(source_str); free(out_data);