|
@@ -1,74 +1,41 @@
|
|
|
# Names of target, sources and object files
|
|
|
BIN = benchmark
|
|
|
-SRC := timer.c utilities.c benchmark.c
|
|
|
+SRC = timer.c utilities.c benchmark.c opencl_fft.c
|
|
|
|
|
|
# Dependencies
|
|
|
DEP_OCLFFT = .deps/oclfft/src/liboclfft.so
|
|
|
DEP_CLFFT = .deps/clFFT/src/library/libclFFT.so
|
|
|
-DEPS = $(DEP_OCLFFT)
|
|
|
+DEPS = $(DEP_OCLFFT) $(DEP_CLFFT)
|
|
|
|
|
|
# Debug mode
|
|
|
CC_MARK := @
|
|
|
+
|
|
|
ifeq ($(V), 1)
|
|
|
override CC_MARK =
|
|
|
endif
|
|
|
|
|
|
-# Get bits of OS
|
|
|
-ARCH := $(shell getconf LONG_BIT 2> /dev/null)
|
|
|
-ifeq ($(ARCH),32)
|
|
|
- override ARCH = ''
|
|
|
-endif
|
|
|
-
|
|
|
# Libs titiles
|
|
|
-LIBS_MSG :=
|
|
|
+LIBS_MSG =
|
|
|
|
|
|
# Common flags definition
|
|
|
-CPPFLAGS :=
|
|
|
-CFLAGS := -O3 -Wall -Werror -Wno-unused-variable -std=c99 -fmessage-length=0
|
|
|
-LDFLAGS := -lm
|
|
|
-
|
|
|
-# Detect OpenCL
|
|
|
-OPENCL_PATH := $(shell find /usr/lib$(ARCH) -type f -name "libOpenCL.so*" 2> /dev/null)
|
|
|
-
|
|
|
-ifneq ($(OPENCL_PATH),)
|
|
|
- override LDFLAGS += -L/usr/lib$(ARCH) -lOpenCL
|
|
|
- override SRC += $(wildcard opencl*.c)
|
|
|
-else
|
|
|
-$(error "OpenCL library cannot be found.")
|
|
|
-endif
|
|
|
+CPPFLAGS =
|
|
|
+CFLAGS ?= -O3 -Wall -Werror -Wno-unused-variable -fmessage-length=0
|
|
|
+CFLAGS += -std=c99
|
|
|
+LDFLAGS += -lm -lOpenCL
|
|
|
|
|
|
-# Detect CUDA FFT library
|
|
|
-CUDA_FFT := $(shell find $(CUDA_PATH)/ -maxdepth 2 -type f -name "libcufft.so*" 2> /dev/null)
|
|
|
-
|
|
|
-# If true then try to use CUDA, otherwise AMD
|
|
|
-ifneq ($(CUDA_FFT),)
|
|
|
+ifneq ($(CUDA_PATH),)
|
|
|
override CPPFLAGS += -DHAVE_CUDA_FFT
|
|
|
override CFLAGS += -I$(CUDA_PATH)/include
|
|
|
- override LDFLAGS += -L$(CUDA_PATH)/lib$(ARCH) -lcufft -lcudart -Wl,-rpath=$(CUDA_PATH)/lib$(ARCH)
|
|
|
+ override LDFLAGS += -L$(CUDA_PATH)/lib$(ARCH) -lcufft -lcudart -Wl,-rpath=$(CUDA_PATH)/lib$(ARCH)
|
|
|
override LIBS_MSG += " +cuda"
|
|
|
override SRC += $(wildcard cuda*.c)
|
|
|
-else
|
|
|
- ifneq ($(AMDAPPSDKROOT),)
|
|
|
- override CFLAGS += -I$(AMDAPPSDKROOT)/include
|
|
|
- else
|
|
|
-$(error "SDKs paths cannot be found. Try setting CUDA_PATH for CUDA SDK or AMDAPPSDKROOT for AMD SDK.")
|
|
|
- endif
|
|
|
endif
|
|
|
|
|
|
# AMD FFT library
|
|
|
-AMD_FFT_EXISTS = $(shell pkg-config --exists clFFT && echo "1" || echo "0")
|
|
|
-
|
|
|
-ifeq ($(AMD_FFT_EXISTS),1)
|
|
|
- override CPPFLAGS += -DHAVE_AMD_FFT
|
|
|
- override CFLAGS += $(shell pkg-config --cflags clFFT)
|
|
|
- override LDFLAGS += $(shell pkg-config --libs clFFT) -Wl,-rpath=$(shell pkg-config --variable=libdir clFFT)
|
|
|
- override LIBS_MSG += " +amd"
|
|
|
-else
|
|
|
- override DEPS += $(DEP_CLFFT)
|
|
|
- override CFLAGS += -I.deps/clFFT/src/include -DHAVE_AMD_FFT
|
|
|
- override LDFLAGS += -L.deps/clFFT/src/library -lclFFT -Wl,-rpath=.deps/clFFT/src/library
|
|
|
- override LIBS_MSG += " +amd"
|
|
|
-endif
|
|
|
+override DEPS += $(DEP_CLFFT)
|
|
|
+override CFLAGS += -I.deps/clFFT/src/include -DHAVE_AMD_FFT
|
|
|
+override LDFLAGS += -L.deps/clFFT/src/library -lclFFT -Wl,-rpath=.deps/clFFT/src/library
|
|
|
+override LIBS_MSG += " +amd"
|
|
|
|
|
|
# Apple FFT library
|
|
|
override CPPFLAGS += -DHAVE_APPLE_FFT
|
|
@@ -76,10 +43,6 @@ override CFLAGS += -I.deps/
|
|
|
override LDFLAGS += -L.deps/oclfft/src -loclfft -Wl,-rpath=.deps/oclfft/src
|
|
|
override LIBS_MSG += " +apple"
|
|
|
|
|
|
-ifneq ($(OPENCL_PATH),)
|
|
|
- override LDFLAGS += -Wl,-rpath=/usr/lib$(ARCH)
|
|
|
-endif
|
|
|
-
|
|
|
# FFTW library
|
|
|
FFTW_EXISTS = $(shell pkg-config --exists fftw3 && echo "1" || echo "0")
|
|
|
|
|
@@ -132,4 +95,4 @@ $(DEP_OCLFFT):
|
|
|
$(DEP_CLFFT):
|
|
|
@mkdir -p .deps
|
|
|
@git clone https://github.com/clMathLibraries/clFFT .deps/clFFT
|
|
|
- @cd .deps/clFFT/src; cmake . -DOPENCL_ROOT=/usr; make
|
|
|
+ @cd .deps/clFFT/src; AMDAPPSDKROOT="" cmake . -DOPENCL_ROOT=/usr; AMDAPPSDKROOT="" make
|