Mercurial > hg > GearsTemplate
comparison src/parallel_execution/CUDAtwice.cbc @ 316:54d203daf06b
CUDAtwice.cbc is called.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 15 Feb 2017 16:25:23 +0900 (2017-02-15) |
parents | 1839586f5b41 |
children | 054c47e6ca20 |
comparison
equal
deleted
inserted
replaced
314:1839586f5b41 | 316:54d203daf06b |
---|---|
16 | 16 |
17 checkCudaErrors(cuMemAlloc(&devA, array->size)); | 17 checkCudaErrors(cuMemAlloc(&devA, array->size)); |
18 checkCudaErrors(cuMemAlloc(&devLoopCounter, sizeof(LoopCounter))); | 18 checkCudaErrors(cuMemAlloc(&devLoopCounter, sizeof(LoopCounter))); |
19 | 19 |
20 //twiceカーネルが定義されてなければそれをロードする | 20 //twiceカーネルが定義されてなければそれをロードする |
21 checkCudaErrors(cuModuleLoad(&context->module, "CUDAtwice.ptx")); | 21 checkCudaErrors(cuModuleLoad(&context->module, "c/CUDAtwice.ptx")); |
22 checkCudaErrors(cuModuleGetFunction(&context->function, context->module, "twice")); | 22 checkCudaErrors(cuModuleGetFunction(&context->function, context->module, "twice")); |
23 printf("CUdA Exe 2\n"); | 23 printf("CUdA Exe 2\n"); |
24 | 24 |
25 //入力のDataGearをGPUにbuffer経由で送る | 25 //入力のDataGearをGPUにbuffer経由で送る |
26 // Synchronous data transfer(host to device) | 26 // Synchronous data transfer(host to device) |
36 0, NULL , args, NULL)); | 36 0, NULL , args, NULL)); |
37 | 37 |
38 //結果を取ってくるコマンドを入力する | 38 //結果を取ってくるコマンドを入力する |
39 //コマンドの終了待ちを行う | 39 //コマンドの終了待ちを行う |
40 checkCudaErrors(cuMemcpyDtoH(array->array, devA, array->size)); | 40 checkCudaErrors(cuMemcpyDtoH(array->array, devA, array->size)); |
41 | |
41 // wait for stream | 42 // wait for stream |
43 checkCudaErrors(cuCtxSynchronize()); | |
42 } | 44 } |
43 | 45 |
44 __code CUDAtwice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, struct Context* workerContext) { | 46 __code CUDAtwice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, struct Context* workerContext) { |
45 int i = loopCounter->i; | 47 int i = loopCounter->i; |
46 if (i < prefix) { | 48 if (i < prefix) { |