changeset 1816:6118e0b77d74 draft

fix Makefile
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Fri, 13 Dec 2013 05:13:15 +0900
parents 9de57d13a386
children b0376e1c51e9
files TaskManager/test/UtilizationTest/multiply example/fft/Makefile example/fft/Makefile.def example/fft/Makefile.gpu example/fft/gpu/bitReverse.cc example/fft/gpu/bitReverse.h example/fft/gpu/bitReverse.o example/fft/gpu/butterfly.cc example/fft/gpu/butterfly.h example/fft/gpu/butterfly.o example/fft/gpu/gpu_task_init.o example/fft/gpu/highPassFilter.cc example/fft/gpu/highPassFilter.h example/fft/gpu/highPassFilter.o example/fft/gpu/norm.cc example/fft/gpu/norm.h example/fft/gpu/norm.o example/fft/gpu/spinFact.cc example/fft/gpu/spinFact.h example/fft/gpu/spinFact.o example/fft/gpu/task_init.cc example/fft/gpu/task_init.o example/fft/gpu/transpose.cc example/fft/gpu/transpose.h example/fft/gpu/transpose.o
diffstat 25 files changed, 17 insertions(+), 329 deletions(-) [+]
line wrap: on
line diff
Binary file TaskManager/test/UtilizationTest/multiply has changed
--- a/example/fft/Makefile	Thu Dec 12 19:23:39 2013 +0900
+++ b/example/fft/Makefile	Fri Dec 13 05:13:15 2013 +0900
@@ -28,4 +28,4 @@
 clean:
 	@$(MAKE) -f Makefile.macosx clean
 	@$(MAKE) -f Makefile.linux clean
-	@$(MAKE) -f Makefile.cell clean
+	@$(MAKE) -f Makefile.gpu clean
--- a/example/fft/Makefile.def	Thu Dec 12 19:23:39 2013 +0900
+++ b/example/fft/Makefile.def	Fri Dec 13 05:13:15 2013 +0900
@@ -6,16 +6,11 @@
 
 CERIUM = ../../../Cerium
 
-OPT = -O
+CC      = clang++
 OPT = -g -O0
-# OPT = -g
-CC      = clang++
-CXX = clang++
-CFLAGS  =  -Wall  $(OPT) -DUSE_SIMPLE_TASK
-CXXFLAGS  = ${CFLAGS}
+#CXX = clang++
+CFLAGS  =  -Wall  $(OPT)
+#CXXFLAGS  = ${CFLAGS}
 
 INCLUDE = -I. -I.. -I${CERIUM}/include/TaskManager 
 LIBS = -L${CERIUM}/TaskManager
-
-ABIBIT = 64
-ABI = -m$(ABIBIT)
--- a/example/fft/Makefile.gpu	Thu Dec 12 19:23:39 2013 +0900
+++ b/example/fft/Makefile.gpu	Fri Dec 13 05:13:15 2013 +0900
@@ -6,16 +6,20 @@
 OBJS = $(SRCS:.cc=.o)
 
 GPU_TASK_DIR  = gpu
+GPU_TASK_SRCS_TMP = $(wildcard $(GPU_TASK_DIR)/*.cc)
+GPU_TASK_SRCS_EXCLUDE =
+GPU_TASK_SRCS = $(filter-out $(GPU_TASK_DIR)/$(GPU_TASK_SRCS_EXCLUDE),$(GPU_TASK_SRCS_TMP))
+GPU_TASK_OBJS = $(GPU_TASK_SRCS:.cc=.o)
+
 TASK_DIR = ppe
 TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
 TASK_SRCS_EXCLUDE = 
-TASK_SRCS = $(filter-out $(GPU_TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(GPU_TASK_DIR)/*.cc)
+TASK_SRCS = $(filter-out $(GPU_TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
 TASK_OBJS = $(TASK_SRCS:.cc=.o)
 
-CC += $(ABI)
-CFLAGS  += -D__CERIUM_GPU__
+CFLAGS  += -DGPU
 
-LIBS = -L${CERIUM}/TaskManager -DUSE_SIMPLE_TASK -lGpuManager -framework opencl `sdl-config --libs`
+LIBS += `sdl-config --libs` -lGpuManager -framework opencl 
 
 .SUFFIXES: .cc .o
 
@@ -24,18 +28,17 @@
 
 all: $(TARGET)
 
-$(TARGET): $(OBJS) $(TASK_OBJS)
-	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+$(TARGET): $(OBJS) $(TASK_OBJS) $(GPU_TASK_OBJS)
+	$(CC) $(OPT) -o $@ $(OBJS) $(TASK_OBJS) $(GPU_TASK_OBJS) $(LIBS)
 
 link:
-	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+	$(CC) $(OPT) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(GPU_TASK_OBJS) $(LIBS)
 
 debug: $(TARGET)
 	sudo gdb ./$(TARGET)
 
 clean:
-	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS) $(GPU_TASK_OBJS)
 	rm -f *~ \#*
 	rm -f ppe/*~ ppe/\#*
-	rm -f spe/*~ spe/\#*
 	rm -f gpu/*~ gpu/\#*
--- a/example/fft/gpu/bitReverse.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#include "bitReverse.h"
-#ifdef __APPLE__
-#include <OpenCL/opencl.h>
-#else
-#include <CL/cl.h>
-#endif
-#include "Func.h"
-
-SchedDefineTask1(bitReverse,bitReverse);
-
-static int
-bitReverse(SchedTask* s, void* rbuf, void* wbuf)
-{
-    cl_float2* src = (cl_float2*)s->get_inputAddr(0);
-    cl_float2* dst = (cl_float2*)s->get_outputAddr(0);
-    
-    unsigned long gid = s->x; // (unsigned long)s->get_param(0);
-    unsigned long nid = s->y; // (unsigned long)s->get_param(1);
-    
-    unsigned long m = (unsigned long)s->get_param(3);
-    unsigned long n = (unsigned long)s->get_param(4);
-    unsigned int j = gid;
-
-    j = (j & 0x55555555) << 1 | (j & 0xAAAAAAAA) >> 1;
-    j = (j & 0x33333333) << 2 | (j & 0xCCCCCCCC) >> 2;
-    j = (j & 0x0F0F0F0F) << 4 | (j & 0xF0F0F0F0) >> 4;
-    j = (j & 0x00FF00FF) << 8 | (j & 0xFF00FF00) >> 8;
-    j = (j & 0x0000FFFF) << 16 | (j & 0xFFFF0000) >> 16;
-
-    j >>= (32-m);
-
-    dst[nid*n+j] = src[nid*n+gid];
-    return 0;
-}
--- a/example/fft/gpu/bitReverse.h	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef INCLUDED_TASK_BITREVERSE
-#define INCLUDED_TASK_BITREVERSE
-
-#ifndef INCLUDED_SCHED_TASK
-#include "SchedTask.h"
-#endif
-
-#endif
Binary file example/fft/gpu/bitReverse.o has changed
--- a/example/fft/gpu/butterfly.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#include "butterfly.h"
-#ifdef __APPLE__
-#include <OpenCL/opencl.h>
-#else
-#include <CL/cl.h>
-#endif
-#include "Func.h"
-SchedDefineTask1(butterfly,butterfly);
-
-static int
-butterfly(SchedTask* s,void* rbuf,void* wbuf)
-{
-    cl_float2* x_in = (cl_float2*)s->get_inputAddr(0);
-    cl_float2* w = (cl_float2*)s->get_inputAddr(1);
-    
-    cl_float2* x_out = (cl_float2*)s->get_outputAddr(0);
-
-    unsigned long gid = s->x; // (unsigned long)s->get_param(0);
-    unsigned long nid = s->y; // (unsigned long)s->get_param(1);
-    
-    long n = (long)s->get_param(3);
-    unsigned long direction_flag = (unsigned long)s->get_param(4);
-    long iter = (long)s->get_param(5);
-
-    int butterflySize = 1 << (iter-1);
-    int butterflyGrpDist = 1 << iter;
-    int butterflyGrpNum = n >> iter;
-    int butterflyGrpBase = (gid >> (iter-1))*(butterflyGrpDist);
-    int butterflyGrpOffset = gid & (butterflySize-1);
-
-    int a = nid * n + butterflyGrpBase + butterflyGrpOffset;
-    int b = a + butterflySize;
-    
-    int l = butterflyGrpNum * butterflyGrpOffset;
-
-    cl_float2 xa, xb, xbxx, xbyy, wab, wayx, wbyx, resa, resb;
-
-    xa = x_in[a];
-    xb = x_in[b];
-    xbxx.x = xbxx.y = xb.x;
-    xbyy.x = xbyy.y = xb.y;
-    
-    wab.x = w[l].x;
-    if(direction_flag == 0x80000000) {
-        wab.y = -w[l].y;
-    } else {
-        wab.y = w[l].y;
-    }
-
-    wayx.x = -wab.y;
-    wayx.y = wab.x;
-
-    wbyx.x = wab.y;
-    wbyx.y = -wab.x;
-
-    resa.x = xa.x + xbxx.x*wab.x + xbyy.x*wayx.x;
-    resa.y = xa.y + xbxx.y*wab.y + xbyy.y*wayx.y;
-
-    resb.x = xa.x - xbxx.x*wab.x + xbyy.x*wbyx.x;
-    resb.y = xa.y - xbxx.y*wab.y + xbyy.y*wbyx.y;
-
-    x_out[a] = resa;
-    x_out[b] = resb;
-
-    return 0;
-}
--- a/example/fft/gpu/butterfly.h	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef INCUDED_TASK_BUTTERFLY
-#define INCUDED_TASK_BUTTERFLY
-
-#ifndef INCLUDED_SCHED_TASK
-#include "SchedTask.h"
-#endif
-
-#endif
Binary file example/fft/gpu/butterfly.o has changed
Binary file example/fft/gpu/gpu_task_init.o has changed
--- a/example/fft/gpu/highPassFilter.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#include "highPassFilter.h"
-#ifdef __APPLE__
-#include <OpenCL/opencl.h>
-#else
-#include <CL/cl.h>
-#endif
-#include "Func.h"
-SchedDefineTask1(highPassFilter,highPassFilter);
-
-static int
-highPassFilter(SchedTask* s,void* rbuf,void* wbuf)
-{
-    cl_float2* in = (cl_float2*)s->get_inputAddr(0);
-
-    cl_float2* image = (cl_float2*)s->get_outputAddr(0);
-
-    unsigned long xgid = s->x; // (unsigned long)s->get_param(0);
-    unsigned long ygid = s->y; // (unsigned long)s->get_param(1);
-
-    long n = (long)s->get_param(3);
-    long radius = (long)s->get_param(4);
-
-    cl_int2 n_2;
-    n_2.x = n_2.y = n>>1;
-    
-    cl_int2 mask;
-    mask.x = mask.y = n-1;
-
-    cl_int2 gid;
-    gid.x = (xgid + n_2.x) & mask.x;
-    gid.y = (ygid + n_2.y) & mask.y;
-
-    cl_int2 diff;
-    diff.x = n_2.x - gid.x;
-    diff.y = n_2.y - gid.y;
-    
-    cl_int2 diff2;
-    diff2.x = diff.x * diff.x;
-    diff2.y = diff.y * diff.y;
-
-    int dist2 = diff2.x + diff2.y;
-
-    cl_int2 window;
-
-    if (dist2 < radius*radius) {
-        window.x = window.y = (int)0L;
-    } else {
-        window.x = window.y = (int)-1L;
-    }
-
-    image[ygid*n+xgid].x = (float)((int)in[ygid*n+xgid].x & window.x);
-    image[ygid*n+xgid].y = (float)((int)in[ygid*n+xgid].y & window.y);
-
-    return 0;
-}
--- a/example/fft/gpu/highPassFilter.h	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef INCLUDED_TASK_HIGHPASSFILTER
-#define INCLUDED_TASK_HIGHPASSFILTER
-
-#ifndef INCLUDED_SCHED_TASK
-#include "SchedTask.h"
-#endif
-
-#endif
Binary file example/fft/gpu/highPassFilter.o has changed
--- a/example/fft/gpu/norm.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#include "norm.h"
-#ifdef __APPLE__
-#include <OpenCL/opencl.h>
-#else
-#include <CL/cl.h>
-#endif
-#include "Func.h"
-SchedDefineTask1(norm,norm);
-
-static int
-norm(SchedTask* s, void* rbuf,void* wbuf)
-{
-    cl_float2* in_x = (cl_float2*)s->get_inputAddr(0);
-
-    cl_float2* out_x = (cl_float2*)s->get_outputAddr(0);
-
-    unsigned long gid = s->x; // (unsigned long)s->get_param(0);
-    unsigned long nid = s->y; //(unsigned long)s->get_param(1);
-
-    long n = (long)s->get_param(3);
-
-    out_x[nid*n+gid].x = in_x[nid*n+gid].x / (float)n;
-    out_x[nid*n+gid].y = in_x[nid*n+gid].y / (float)n;
-
-    return 0;
-}
--- a/example/fft/gpu/norm.h	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef INCLUDED_TASK_NORM
-#define INCLUDED_TASK_NORM
-
-#ifndef INCLUDED_SCHED_TASK
-#include "SchedTask.h"
-#endif
-
-#endif
Binary file example/fft/gpu/norm.o has changed
--- a/example/fft/gpu/spinFact.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#include <math.h>
-#include "spinFact.h"
-#ifdef __APPLE__
-#include <OpenCL/opencl.h>
-#else
-#include <CL/cl.h>
-#endif
-#include "Func.h"
-
-#define PI 3.14159265358979323846
-#define PI_2 1.57079632679489661923
-
-SchedDefineTask1(spinFact,spinFact);
-
-static int
-spinFact(SchedTask* s,void* rbuf,void* wbuf)
-{
-    cl_float2* w = (cl_float2*)s->get_outputAddr(0);
-
-    unsigned long i = s->x; // (unsigned long)s->get_param(0);
-    
-    long n = (long)s->get_param(3);
-
-    cl_float2 angle;
-    angle.x = (float)(2*i*PI/(float)n);
-    angle.y = (float)((2*i*PI/(float)n) + PI_2);
-
-    w[i].x = cos(angle.x);
-    w[i].y = cos(angle.y);
-
-    return 0;
-}
--- a/example/fft/gpu/spinFact.h	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef INCLUDED_TASK_SPINFACT
-#define INCLUDED_TASK_SPINFACT
-
-#ifndef INCLUDED_SCHED_TASK
-#include "SchedTask.h"
-#endif
-
-#endif
Binary file example/fft/gpu/spinFact.o has changed
--- a/example/fft/gpu/task_init.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#include "Func.h"
-#include "Scheduler.h"
-
-SchedExternTask(spinFact);
-SchedExternTask(bitReverse);
-SchedExternTask(norm);
-SchedExternTask(butterfly);
-SchedExternTask(transpose);
-SchedExternTask(highPassFilter);
-
-void
-task_init(void)
-{
-    SchedRegisterTask(SPIN_FACT,spinFact);
-    SchedRegisterTask(NORMALIZATION, norm);
-    SchedRegisterTask(BIT_REVERSE, bitReverse);
-    SchedRegisterTask(BUTTERFLY, butterfly);
-    SchedRegisterTask(TRANSPOSE, transpose);
-    SchedRegisterTask(HIGH_PASS_FILTER, highPassFilter);
-}
Binary file example/fft/gpu/task_init.o has changed
--- a/example/fft/gpu/transpose.cc	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#include "transpose.h"
-#ifdef __APPLE__
-#include <OpenCL/opencl.h>
-#else
-#include <CL/cl.h>
-#endif
-#include "Func.h"
-
-SchedDefineTask1(transpose,transpose);
-
-static int
-transpose(SchedTask* s,void* rbuf,void* wbuf)
-{
-    cl_float2* src = (cl_float2*)s->get_inputAddr(0);
-
-    cl_float2* dst = (cl_float2*)s->get_outputAddr(0);
-
-    unsigned long xgid = s->x; // (unsigned long)s->get_param(0);
-    unsigned long ygid = s->y; // (unsigned long)s->get_param(1);
-
-    long n = (long)s->get_param(3);
-
-    unsigned int iid = ygid * n + xgid;
-    unsigned int oid = xgid * n + ygid;
-
-    dst[oid] = src[iid];
-
-    return 0;
-}
--- a/example/fft/gpu/transpose.h	Thu Dec 12 19:23:39 2013 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef INCLUDED_TASK_TRANSPOSE
-#define INCLUDED_TASK_TRANSPOSE
-
-#ifndef INCLUDED_SCHED_TASK
-#include "SchedTask.h"
-#endif
-
-#endif
Binary file example/fft/gpu/transpose.o has changed