Mercurial > hg > Game > Cerium
changeset 1654:0e1d40a3474b draft
fix basic/Makefile.gpu
author | shoheikokubo |
---|---|
date | Wed, 26 Jun 2013 19:41:18 +0900 |
parents | cb1e5f6177b9 |
children | 963d2fc5f685 |
files | example/basic/Makefile.gpu example/multiply/gpu/Multi.cl example/multiply/main.cc example/multiply/ppe/Multi.cc |
diffstat | 4 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/example/basic/Makefile.gpu Wed Jun 26 19:09:29 2013 +0900 +++ b/example/basic/Makefile.gpu Wed Jun 26 19:41:18 2013 +0900 @@ -5,10 +5,11 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -TASK_DIR = gpu +GPU_TASK_DIR = gpu +TASK_DIR = ppe TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) TASK_SRCS_EXCLUDE = -TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(GPU_TASK_DIR)*.cc) TASK_OBJS = $(TASK_SRCS:.cc=.o) LIBS += `sdl-config --libs` -lGpuManager -framework opencl
--- a/example/multiply/gpu/Multi.cl Wed Jun 26 19:09:29 2013 +0900 +++ b/example/multiply/gpu/Multi.cl Wed Jun 26 19:41:18 2013 +0900 @@ -1,8 +1,9 @@ __kernel void -multi(__global const void *params,__global const float *A, __global const float*B, __global float *C) +multi(__global const void *params,__global const float *A, __global const float*B, __global float *C,int param0,int param1) { - int i=get_global_id(0); + if (param0 ==256 && param1 == 512) { + int i=get_global_id(0); - C[i]=A[i]*B[i]; - + C[i]=A[i]*B[i]; + } }
--- a/example/multiply/main.cc Wed Jun 26 19:09:29 2013 +0900 +++ b/example/multiply/main.cc Wed Jun 26 19:41:18 2013 +0900 @@ -93,6 +93,8 @@ multiply->set_inData(0,(memaddr)A, sizeof(float)*length); multiply->set_inData(1,(memaddr)B, sizeof(float)*length); + multiply->set_param(3,256); + multiply->set_param(4,512); /** * Set of OutPut area * add_outData(address of output area, size of output area);
--- a/example/multiply/ppe/Multi.cc Wed Jun 26 19:09:29 2013 +0900 +++ b/example/multiply/ppe/Multi.cc Wed Jun 26 19:41:18 2013 +0900 @@ -17,7 +17,10 @@ C = (float*)s->get_output(wbuf, 0); long i = (long)s->get_param(0); - C[i]=A[i]*B[i]; - + long a = (long)s->get_param(3); + long b = (long)s->get_param(4); + if (a==256 && b==512) { + C[i]=A[i]*B[i]; + } return 0; }