Mercurial > hg > Game > Cerium
changeset 2015:6bf6450bd45a draft
minor change
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 04 Jul 2014 11:26:31 +0900 |
parents | 8c618e912c88 |
children | e904bb51fea9 |
files | TaskManager/Cuda/CudaScheduler.cc TaskManager/Cuda/CudaScheduler.h |
diffstat | 2 files changed, 15 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cuda/CudaScheduler.cc Tue Jul 01 17:04:01 2014 +0900 +++ b/TaskManager/Cuda/CudaScheduler.cc Fri Jul 04 11:26:31 2014 +0900 @@ -134,15 +134,15 @@ for(int i=0;i<nextTask->inData_count;i++) { ListElement *input_buf = nextTask->inData(i); if (input_buf->size==0) break; - if (!transmitted.count(input_buf)) { + if (!transmitted.count(input_buf->addr)) { 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])); - reverse_map.insert(make_pair(&cudabuffer[cur].memin[param], input_buf)); + transmitted.insert(make_pair(input_buf->addr, &cudabuffer[cur].memin[param])); + reverse_map.insert(make_pair(&cudabuffer[cur].memin[param], input_buf->addr)); } - cudabuffer[cur].kernelParams[param] = transmitted[input_buf]; + cudabuffer[cur].kernelParams[param] = transmitted[input_buf->addr]; param++; } @@ -151,13 +151,13 @@ 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.count(output_buf)) { + if (!transmitted.count(output_buf->addr)) { 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])); - reverse_map.insert(make_pair(&cudabuffer[cur].memout[i], output_buf)); + transmitted.insert(make_pair(output_buf->addr, &cudabuffer[cur].memout[i])); + reverse_map.insert(make_pair(&cudabuffer[cur].memout[i], output_buf->addr)); } - cudabuffer[cur].kernelParams[param] = transmitted[output_buf]; + cudabuffer[cur].kernelParams[param] = transmitted[output_buf->addr]; param++; } cudabuffer[cur].out_size = param - cudabuffer[cur].in_size; // no buffer on flip, but flip use memout event @@ -193,11 +193,11 @@ for(int i=0;i<nextTask->outData_count;i++) { // read output data ListElement *output_buf = nextTask->outData(i); if (output_buf->size==0) break; - if (transmitted.count(output_buf)) { - ret = cuMemcpyDtoHAsync(output_buf->addr, *transmitted[output_buf], output_buf->size, cudabuffer[cur].stream); + if (transmitted.count(output_buf->addr)) { + ret = cuMemcpyDtoHAsync(output_buf->addr, *transmitted[output_buf->addr], output_buf->size, cudabuffer[cur].stream); if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } - reverse_map.erase(transmitted[output_buf]); - transmitted.erase(output_buf); + reverse_map.erase(transmitted[output_buf->addr]); + transmitted.erase(output_buf->addr); } } } @@ -205,7 +205,7 @@ } static void -release_buf_event(int cur, CudaScheduler::CudaBufferPtr mem, map<CUdeviceptr*, ListElement*> map) { +release_buf_event(int cur, CudaScheduler::CudaBufferPtr mem, map<CUdeviceptr*, memaddr> map) { for (int i=0; i<mem[cur].in_size; i++) { if (!map.count(&mem[cur].memin[i])) { cuMemFree(mem[cur].memin[i]);
--- a/TaskManager/Cuda/CudaScheduler.h Tue Jul 01 17:04:01 2014 +0900 +++ b/TaskManager/Cuda/CudaScheduler.h Fri Jul 04 11:26:31 2014 +0900 @@ -48,8 +48,8 @@ CudaBuffer cudabuffer[STAGE]; // record transmitted data. - map<ListElement*, CUdeviceptr*> transmitted; - map<CUdeviceptr*, ListElement*> reverse_map; + map<memaddr, CUdeviceptr*> transmitted; + map<CUdeviceptr*, memaddr> reverse_map; HTask::htask_flag flag[STAGE];