Skip to content

Commit 8ed16e2

Browse files
Add debug option for examples (which also dumps kernels).
1 parent 1f839ca commit 8ed16e2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clfft++.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ class clfft_base
238238
ret = clfftInitSetupData(&fftSetup);
239239
if(ret < CL_SUCCESS) std::cerr << clfft_errorstring(ret) << std::endl;
240240
assert(ret >= CL_SUCCESS);
241+
#ifdef DEBUG
242+
fftSetup.debugFlags = CLFFT_DUMP_PROGRAMS;
243+
#endif
244+
241245
ret = clfftSetup(&fftSetup);
242246
if(ret < CL_SUCCESS) std::cerr << clfft_errorstring(ret) << std::endl;
243247
assert(ret >= CL_SUCCESS);

examples/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ vpath %.c ../
3535

3636
# Set up CXXFLAGS
3737
CXXFLAGS=
38-
CXXFLAGS+=-O3
38+
ifeq (debug,$(firstword $(MAKECMDGOALS)))
39+
CXXFLAGS+=-ggdb -g3 -Og
40+
CXXFLAGS+=-DDEBUG
41+
else
42+
CXXFLAGS+=-Ofast
43+
endif
44+
3945
CXXFLAGS+=-Wall
4046

4147
CXXFLAGS+=$(INCL)
@@ -66,6 +72,8 @@ SRCS_C=clutils
6672
OBJS=$(SRCS_CPP:=.o) $(SRCS_C:=.o)
6773
ALL=$(SRCS_CPP) $(SRCS_C) $(OUTPUT)
6874

75+
debug: $(OUTPUT)
76+
6977
all: $(OUTPUT)
7078

7179
fft1: $(OBJS) fft1.o

0 commit comments

Comments
 (0)