changeset 1659:0d25364759e0 draft

add file
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Mon, 15 Jul 2013 18:46:35 +0900
parents ed2fa50168ef
children 8b50b1ee068e
files TaskManager/test/GpuRunTest/Makefile.cell TaskManager/test/GpuRunTest/Makefile.gpu TaskManager/test/GpuRunTest/Makefile.linux TaskManager/test/GpuRunTest/Makefile.macosx TaskManager/test/GpuRunTest/gpu/Makefile TaskManager/test/GpuRunTest/gpu/gpu_task_init.cc TaskManager/test/GpuRunTest/gpu/gpu_task_init.o TaskManager/test/GpuRunTest/gpu/twice.cl TaskManager/test/GpuRunTest/ppe/Twice.cc TaskManager/test/GpuRunTest/ppe/Twice.h TaskManager/test/GpuRunTest/ppe/task_init.cc
diffstat 11 files changed, 282 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/Makefile.cell	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,39 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+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_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lCellManager -lspe2 -lpthread -Wl,--gc-sections 
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET) speobject
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+speobject:
+	cd spe; $(MAKE)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo ppu-gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	cd spe; $(MAKE) clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/Makefile.gpu	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,54 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+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)) $(wildcard $(GPU_TASK_DIR)/*.cc)
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += `sdl-config --libs` -lGpuManager -framework opencl
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET) 
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+test:
+	cpus=0;./$(TARGET) -cpu $$cpus	
+	cpus=1;./$(TARGET) -cpu $$cpus
+	cpus=2;./$(TARGET) -cpu $$cpus
+	cpus=4;./$(TARGET) -cpu $$cpus	
+	cpus=8;./$(TARGET) -cpu $$cpus
+	cpus=16;./$(TARGET) -cpu $$cpus
+	cpus=24;./$(TARGET) -cpu $$cpus
+
+	cpus=0;./$(TARGET) -cpu $$cpus -gpu $$cpus
+	cpus=1;./$(TARGET) -cpu $$cpus -gpu $$cpus
+	cpus=2;./$(TARGET) -cpu $$cpus -gpu $$cpus
+	cpus=4;./$(TARGET) -cpu $$cpus -gpu $$cpus
+	cpus=8;./$(TARGET) -cpu $$cpus -gpu $$cpus
+	cpus=16;./$(TARGET) -cpu $$cpus -gpu $$cpus
+	cpus=24;./$(TARGET) -cpu $$cpus -gpu $$cpus
+
+debug: $(TARGET)
+	sudo ppu-gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	cd spe; $(MAKE) clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/Makefile.linux	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,36 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+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_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lFifoManager -lrt
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/Makefile.macosx	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,38 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+ABIBIT=64
+
+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_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lFifoManager `sdl-config --libs`
+CC += -m$(ABIBIT)
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/gpu/Makefile	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,29 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =   # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+LIBS += -lGpuManager -framework opencl `sdl-config --libs`
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+gpu: all
+
+$(TARGET): $(OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS)
+	rm -f *~ \#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/gpu/gpu_task_init.cc	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,7 @@
+#include "Func.h"
+#include "GpuScheduler.h"
+
+void
+gpu_task_init(void) {
+    GpuSchedRegister(Twice, "gpu/twice.cl", "twice");
+}
Binary file TaskManager/test/GpuRunTest/gpu/gpu_task_init.o has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/gpu/twice.cl	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,21 @@
+__kernel void
+twice(__global long *param,
+      __global int *input_data,
+      __global int *output_data)
+{
+    long count = (long)param[0];
+    long times = (long)param[1];
+    for (int i = 0; i<count; i++) {
+        output_data[i] = input_data[i] * times; 
+    }
+    /*
+      output_data[0] = param[0];
+      output_data[1] = param[1];
+      output_data[2] = param[2];
+      output_data[3] = param[3];
+      output_data[4] = param[4];
+      output_data[5] = param[5];
+      output_data[6] = param[6];
+      output_data[7] = param[7];
+    */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/ppe/Twice.cc	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include "SchedTask.h"
+#include "Twice.h"
+#include "Func.h"
+
+/* これは必須 */
+SchedDefineTask1(Twice,twice);
+
+static int
+twice(SchedTask *s,void *rbuf, void *wbuf)
+{
+    int *i_data;
+    int *o_data;
+    long length;
+    long times;
+    i_data = (int*)s->get_input(rbuf, 0);
+    o_data = (int*)s->get_output(wbuf, 0);
+    length = (long)s->get_param(0);
+    times  = (long)s->get_param(1);
+    for (int i = 0; i < length; i++) {
+        o_data[i] = i_data[i] * times;
+    }
+    
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/ppe/Twice.h	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,16 @@
+#ifndef INCLUDED_TASK_HELLO
+#define INCLUDED_TASK_HELLO
+
+#ifndef INCLUDED_SCHED_TASK
+#  include "SchedTask.h"
+#endif
+/*
+class Twice : public SchedTask {
+public:
+    SchedConstructor(Twice);
+    
+    int run(void *r, void *w);
+};
+ */
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/test/GpuRunTest/ppe/task_init.cc	Mon Jul 15 18:46:35 2013 +0900
@@ -0,0 +1,17 @@
+#include "Func.h"
+#include "Scheduler.h"
+
+/* 必ずこの位置に書いて */
+SchedExternTask(Twice);
+
+/**
+ * この関数は ../spe/spe-main と違って
+ * 自分で呼び出せばいい関数なので
+ * 好きな関数名でおk (SchedRegisterTask は必須)
+ */
+
+void
+task_init(void)
+{
+  SchedRegister(Twice);
+}