changeset 2028:131d90cc3f85 draft

fix HelloWorld
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Tue, 02 Sep 2014 16:54:51 +0900
parents cd2ef2861eb1
children c8e35ceae52b
files example/HelloWorld/Makefile example/HelloWorld/Makefile.def example/HelloWorld/Makefile.gpu example/HelloWorld/Makefile.macosx example/HelloWorld/main.cc example/word_count/Makefile.gpu
diffstat 6 files changed, 60 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/example/HelloWorld/Makefile	Tue Sep 02 16:39:06 2014 +0900
+++ b/example/HelloWorld/Makefile	Tue Sep 02 16:54:51 2014 +0900
@@ -1,4 +1,4 @@
-default: macosx
+default: gpu
 
 macosx: FORCE
 	@echo "Make for Mac OS X"
@@ -16,9 +16,16 @@
 	@echo "Make for PS3 (Cell)"
 	@$(MAKE) -f Makefile.cell
 
+gpu: FORCE
+	@echo "Make for OpenCL"
+	@$(MAKE) -f Makefile.gpu
+
+test:
+	./hello -cpu 2 -count 8
+
 FORCE:
 
 clean:
 	@$(MAKE) -f Makefile.macosx clean
 	@$(MAKE) -f Makefile.linux clean
-	@$(MAKE) -f Makefile.cell clean
\ No newline at end of file
+	@$(MAKE) -f Makefile.cell clean
--- a/example/HelloWorld/Makefile.def	Tue Sep 02 16:39:06 2014 +0900
+++ b/example/HelloWorld/Makefile.def	Tue Sep 02 16:54:51 2014 +0900
@@ -7,8 +7,10 @@
 # ex  linux/ps3
 CERIUM = ../../../Cerium
 
-CC      = g++
-CFLAGS  = -g -Wall -O3
+OPT =  -g -O0
+
+CC      = clang++
+CFLAGS  =  -m64 -Wall $(OPT) 
 
 INCLUDE = -I${CERIUM}/include/TaskManager -I. -I..
 LIBS = -L${CERIUM}/TaskManager
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/HelloWorld/Makefile.gpu	Tue Sep 02 16:54:51 2014 +0900
@@ -0,0 +1,45 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE = # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR1  = ppe
+TASK_DIR2  = gpu
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR2)/*.cc $(TASK_DIR1)/*.cc)
+TASK_SRCS_EXCLUDE = # Exec.cc
+TASK_SRCS = $(filter-out $(TASK_DIR1)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+CC += $(ABI)
+CFLAGS  += -D__CERIUM_GPU__
+
+INCLUDE = -I${CERIUM}/include/TaskManager -I. -I..
+LIBS = -L${CERIUM}/TaskManager -DUSE_SIMPLE_TASK -lGpuManager -framework opencl `sdl-config --libs`
+
+.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 lldb -- ./$(TARGET) -file c.txt -gpu -g
+
+test :
+	./$(TARGET) -file c.txt -gpu -g
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
+	rm -f gpu/*~ gpu/\#*
--- a/example/HelloWorld/Makefile.macosx	Tue Sep 02 16:39:06 2014 +0900
+++ b/example/HelloWorld/Makefile.macosx	Tue Sep 02 16:54:51 2014 +0900
@@ -12,6 +12,7 @@
 TASK_OBJS = $(TASK_SRCS:.cc=.o)
 
 LIBS += -lFifoManager `sdl-config --libs`
+CC += -m$(ABIBIT)
 
 .SUFFIXES: .cc .o
 
--- a/example/HelloWorld/main.cc	Tue Sep 02 16:39:06 2014 +0900
+++ b/example/HelloWorld/main.cc	Tue Sep 02 16:54:51 2014 +0900
@@ -141,7 +141,7 @@
              * Set 32bits parameter
              *   add_param(32bit parameter);
              */
-            hello->set_param(0,(memaddr)i);
+            hello->set_param(0,(long)i);
 
             hello->spawn();
         }
--- a/example/word_count/Makefile.gpu	Tue Sep 02 16:39:06 2014 +0900
+++ b/example/word_count/Makefile.gpu	Tue Sep 02 16:54:51 2014 +0900
@@ -43,20 +43,3 @@
 	rm -f ppe/*~ ppe/\#*
 	rm -f spe/*~ spe/\#*
 	rm -f gpu/*~ gpu/\#*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-