Mercurial > hg > Game > Cerium
changeset 1679:ff43dc274ec9 draft
word_count fix for GPU
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 04 Aug 2013 02:14:18 +0900 |
parents | 9ceb824e9be1 |
children | e44e5a18392c |
files | example/word_count/Makefile.gpu example/word_count/main.cc example/word_count/task_init.cc |
diffstat | 3 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/example/word_count/Makefile.gpu Sun Aug 04 01:58:09 2013 +0900 +++ b/example/word_count/Makefile.gpu Sun Aug 04 02:14:18 2013 +0900 @@ -6,10 +6,9 @@ OBJS = $(SRCS:.cc=.o) TASK_DIR1 = ppe -#TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) TASK_DIR2 = gpu TASK_SRCS_TMP = $(wildcard $(TASK_DIR2)/*.cc $(TASK_DIR1)/*.cc) -TASK_SRCS_EXCLUDE = Exec.cc +TASK_SRCS_EXCLUDE = # Exec.cc TASK_SRCS = $(filter-out $(TASK_DIR1)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) TASK_OBJS = $(TASK_SRCS:.cc=.o)
--- a/example/word_count/main.cc Sun Aug 04 01:58:09 2013 +0900 +++ b/example/word_count/main.cc Sun Aug 04 02:14:18 2013 +0900 @@ -27,7 +27,7 @@ int array_task_num = 8; int spe_num = 1; CPU_TYPE spe_cpu = SPE_ANY; -const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-file filename]\n"; +const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-g] [-file filename]\n"; static double getTime() { @@ -454,11 +454,13 @@ for (int i = 1; argv[i]; ++i) { if (strcmp(argv[i], "-file") == 0) { - filename = argv[i+1]; + filename = argv[i+1]; i++; } else if (strcmp(argv[i], "-division") == 0) { division = atoi(argv[i+1]); + i++; } else if (strcmp(argv[i], "-block") == 0) { blocks = atoi(argv[i+1]); + i++; } else if (strcmp(argv[i], "-a") == 0) { // create task all at once all = 1; @@ -474,11 +476,16 @@ use_compat = 0; } else if (strcmp(argv[i], "-anum") == 0) { array_task_num = atoi(argv[i+1]); + i++; } else if (strcmp(argv[i], "-g") == 0 ) { spe_cpu = GPU_0; } else if (strcmp(argv[i], "-cpu") == 0) { spe_num = atoi(argv[i+1]); + i++; if (spe_num==0) spe_num = 1; + } else { + fprintf(stderr,"%s\n",usr_help_str); + exit (0); } } if (filename==0) {
--- a/example/word_count/task_init.cc Sun Aug 04 01:58:09 2013 +0900 +++ b/example/word_count/task_init.cc Sun Aug 04 02:14:18 2013 +0900 @@ -3,9 +3,7 @@ #include "GpuScheduler.h" /* 必ずこの位置に書いて */ -#ifndef __CERIUM_GPU__ SchedExternTask(Exec); -#endif SchedExternTask(Print); SchedExternTask(RUN_TASK_BLOCKS); @@ -19,9 +17,8 @@ { #ifdef __CERIUM_GPU__ GpuSchedRegister(TASK_EXEC, "gpu/Exec.cl", "wordcount"); -#else +#endif SchedRegisterTask(TASK_EXEC, Exec); -#endif SchedRegisterTask(TASK_PRINT, Print); SchedRegister(RUN_TASK_BLOCKS);