# HG changeset patch # User ikkun # Date 1454317423 -32400 # Node ID d400948dbbab03efbff38f7f529012ebb792d65c # Parent 485ea0290faeafacf9ab1688ad500ec482c788b7 add Cuda infomation to context diff -r 485ea0290fae -r d400948dbbab src/CMakeLists.txt --- a/src/CMakeLists.txt Fri Jan 29 05:40:04 2016 +0900 +++ b/src/CMakeLists.txt Mon Feb 01 18:03:43 2016 +0900 @@ -10,7 +10,7 @@ add_definitions("-Wall -g -O0") include_directories(include) - +include_directories($ENV{CUDA_PATH}) add_subdirectory(allocate) add_subdirectory(list) add_subdirectory(llrb) diff -r 485ea0290fae -r d400948dbbab src/parallel_execution/CMakeLists.txt --- a/src/parallel_execution/CMakeLists.txt Fri Jan 29 05:40:04 2016 +0900 +++ b/src/parallel_execution/CMakeLists.txt Mon Feb 01 18:03:43 2016 +0900 @@ -2,7 +2,7 @@ add_definitions("-Wall -g -O0") -set(CMAKE_C_COMPILER $ENV{CbC_Clang}/clang) +set(CMAKE_C_COMPILER cbc-clang) add_executable(twice main.c diff -r 485ea0290fae -r d400948dbbab src/parallel_execution/context.h --- a/src/parallel_execution/context.h Fri Jan 29 05:40:04 2016 +0900 +++ b/src/parallel_execution/context.h Mon Feb 01 18:03:43 2016 +0900 @@ -1,5 +1,6 @@ /* Context definition for llrb example */ #include +#include #include "stack.h" #define ALLOCATE_SIZE 20000000 @@ -106,6 +107,13 @@ int num; struct Context* contexts; } worker; + struct CudaTask { + CUdevice device; + CUcontext cuCtx; + CUfunction code; + CUdeviceptr* deviceptr; + CUstream stream; + } cudatask; struct Task { enum Code code; int key; diff -r 485ea0290fae -r d400948dbbab src/parallel_execution/worker.c --- a/src/parallel_execution/worker.c Fri Jan 29 05:40:04 2016 +0900 +++ b/src/parallel_execution/worker.c Mon Feb 01 18:03:43 2016 +0900 @@ -27,3 +27,8 @@ __code getQueue_stub(struct Context* context) { goto getQueue(context, &context->data[ActiveQueue]->queue, &context->data[Node]->node); } +__code twiceGpu(struct Context* context) { + cuMemcpyHtoDAsync(context,context,context,context->stream); + cuLaunchkanel(); + cuMemcpyDtoHAsync(); +}