Mercurial > hg > Game > Cerium
changeset 2013:d43c2b7932ea draft
fix
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 01 Jul 2014 11:17:12 +0900 |
parents | 9360e782a431 |
children | 8c618e912c88 |
files | TaskManager/Cuda/CudaScheduler.cc TaskManager/Cuda/CudaScheduler.h example/fft/main.cc |
diffstat | 3 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cuda/CudaScheduler.cc Tue Jul 01 03:40:54 2014 +0900 +++ b/TaskManager/Cuda/CudaScheduler.cc Tue Jul 01 11:17:12 2014 +0900 @@ -126,20 +126,19 @@ ret = cuMemcpyHtoDAsync(cudabuffer[cur].memin[param], nextTask->param(0), sizeof(memaddr)*nextTask->param_count, cudabuffer[cur].stream); if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } cudabuffer[cur].kernelParams[param] = &cudabuffer[cur].memin[param]; - param++; for(int i=0;i<nextTask->inData_count;i++) { ListElement *input_buf = nextTask->inData(i); if (input_buf->size==0) break; - if (!transmitted[input_buf]) { + if (!transmitted.count(input_buf)) { createBuffer(&cudabuffer[cur], cudabuffer[cur].memin, param, input_buf->size); if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } ret = cuMemcpyHtoDAsync(cudabuffer[cur].memin[param], input_buf->addr, input_buf->size, cudabuffer[cur].stream); if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } - transmitted.insert(make_pair(input_buf, cudabuffer[cur].memin[param])); + transmitted.insert(make_pair(input_buf, &cudabuffer[cur].memin[param])); } - cudabuffer[cur].kernelParams[param] = &(transmitted[input_buf]); + cudabuffer[cur].kernelParams[param] = transmitted[input_buf]; param++; } @@ -148,12 +147,12 @@ for(int i = 0; i<nextTask->outData_count;i++) { // set output data ListElement *output_buf = nextTask->outData(i); if (output_buf->size==0) break; - if (!transmitted[output_buf]) { + if (!transmitted.count(output_buf)) { createBuffer(&cudabuffer[cur], cudabuffer[cur].memout, i, output_buf->size); if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } - transmitted.insert(make_pair(output_buf, cudabuffer[cur].memout[i])); + transmitted.insert(make_pair(output_buf, &cudabuffer[cur].memout[i])); } - cudabuffer[cur].kernelParams[param] = &(transmitted[output_buf]); + cudabuffer[cur].kernelParams[param] = transmitted[output_buf]; param++; } cudabuffer[cur].out_size = param - cudabuffer[cur].in_size; // no buffer on flip, but flip use memout event
--- a/TaskManager/Cuda/CudaScheduler.h Tue Jul 01 03:40:54 2014 +0900 +++ b/TaskManager/Cuda/CudaScheduler.h Tue Jul 01 11:17:12 2014 +0900 @@ -44,13 +44,11 @@ int ret; memaddr reply; // cl_kernel に相当 - // 変数名は function にすべきか kernel にすべきか - // とりあえず、OpenCL に合わせて kernel で CUfunction kernel[STAGE]; CudaBuffer cudabuffer[STAGE]; // record transmitted data. - map<ListElement*, CUdeviceptr> transmitted; + map<ListElement*, void*> transmitted; HTask::htask_flag flag[STAGE];