# HG changeset patch # User Yutaka_Kinjyo # Date 1311819028 -32400 # Node ID ef8efbd04df98edf072b87bd3494c368ed8a6987 # Parent 641eef31681eb8714d20dbc613036b6b5e6206ce minor change diff -r 641eef31681e -r ef8efbd04df9 WordCount/main.cc --- 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);