changeset 1973:6dd11261489a draft

add makefile
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 26 Feb 2014 13:35:57 +0900
parents 6fa9e5d55774
children 9ebee99a9aef
files example/fft/Makefile.cuda example/fft/cuda/task_init.cc
diffstat 2 files changed, 57 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fft/Makefile.cuda	Wed Feb 26 13:35:57 2014 +0900
@@ -0,0 +1,51 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+CUDA_TASK_DIR = cuda
+
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(CUDA_TASK_DIR)/*.cc)
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+CUDA_SRCS_TMP = $(wildcard $(CUDA_TASK_DIR)/*.cu)
+CUDA_SRCS_EXCLUDE = # 除外するファイルを書く
+CUDA_SRCS = $(filter-out $(CUDA_TASK_DIR)/$(CUDA_SRCS_EXCLUDE),$(CUDA_SRCS_TMP))
+CUDA_OBJS = $(CUDA_SRCS:.cu=.ptx)
+
+CFLAGS += -D__CERIUM_CUDA__
+LIBS += `sdl-config --libs` -lCudaManager -F/Library/Frameworks -framework CUDA
+
+INCLUDE += -I/Developer/NVIDIA/CUDA-5.5/include
+
+NVCC = /Developer/NVIDIA/CUDA-5.5/bin/nvcc
+NVCCFLAGS = -ptx -arch=sm_20
+
+.SUFFIXES: .cc .o .cu .ptx
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+.cu.ptx:
+	$(NVCC) $(NVCCFLAGS) $< -o $@
+
+all: $(TARGET) $(CUDA_OBJS)
+
+$(TARGET): $(OBJS) $(TASK_OBJS) $(CUDA_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo ppu-gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS) $(CUDA_OBJS)
+	rm -f *~ \#*
+	rm -f cuda/*~ cuda/\#*
--- a/example/fft/cuda/task_init.cc	Wed Feb 26 13:10:20 2014 +0900
+++ b/example/fft/cuda/task_init.cc	Wed Feb 26 13:35:57 2014 +0900
@@ -5,10 +5,10 @@
 void
 gpu_task_init(void)
 {
-    CudaSchedRegisterTask(SPIN_FACT, "cuda/spinFact.ptx", "spinFact");
-    CudaSchedRegisterTask(NORMALIZATION, "cuda/norm.ptx", "norm");
-    CudaSchedRegisterTask(BIT_REVERSE, "cuda/bitReverse.ptx", "bitReverse");
-    CudaSchedRegisterTask(BUTTERFLY, "cuda/butterfly.ptx", "butterfly");
-    CudaSchedRegisterTask(TRANSPOSE, "cuda/transpose.ptx", "transpose");
-    CudaSchedRegisterTask(HIGH_PASS_FILTER, "gpu/highPassFilter.ptx", "highPassFilter");
+    CudaSchedRegister(SPIN_FACT, "cuda/spinFact.ptx", "spinFact");
+    CudaSchedRegister(NORMALIZATION, "cuda/norm.ptx", "norm");
+    CudaSchedRegister(BIT_REVERSE, "cuda/bitReverse.ptx", "bitReverse");
+    CudaSchedRegister(BUTTERFLY, "cuda/butterfly.ptx", "butterfly");
+    CudaSchedRegister(TRANSPOSE, "cuda/transpose.ptx", "transpose");
+    CudaSchedRegister(HIGH_PASS_FILTER, "gpu/highPassFilter.ptx", "highPassFilter");
 }