aboutsummaryrefslogtreecommitdiff
path: root/aberth/Makefile
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-04-19 23:32:06 +0200
committertomsmeding <tom.smeding@gmail.com>2019-04-19 23:34:01 +0200
commitbe2bc936957d4fcbc2001ca48909bb2ce8d3f5c7 (patch)
tree9b2402ff15cc074e9c7be6de14affc57c735f1bf /aberth/Makefile
parentbc72c77a8a3d6a82cd234d40308dd8c47aa0e742 (diff)
Working Futhark! 🎉
That was actually easier than expected, and (surprise!) it runs ORDERS OF MAGNITUDE faster than my C++ implementation... C++ takes ~1min on my i5-4278U CPU @ 2.60GHz using all 4 virtual cores; the Futhark takes ~11sec on 1 core. Not sure whether my own code is so terribly bad or whether Futhark is cool, but this is cool nevertheless.
Diffstat (limited to 'aberth/Makefile')
-rw-r--r--aberth/Makefile23
1 files changed, 17 insertions, 6 deletions
diff --git a/aberth/Makefile b/aberth/Makefile
index c5a67cf..f610c01 100644
--- a/aberth/Makefile
+++ b/aberth/Makefile
@@ -1,20 +1,31 @@
CXX = g++
-CXXFLAGS = -Wall -Wextra -std=c++17 -O3 -fwrapv -ffast-math -march=native -mtune=native
-LDFLAGS = -pthread
+CXXFLAGS = -Wall -Wextra -std=c++17 -fwrapv $(OPTFLAGS)
+OPTFLAGS = -O3 -ffast-math -march=native -mtune=native
+LDFLAGS = -pthread -framework OpenCL
+
+TARGETS = aberth
+
+OBJECTS = $(patsubst %.cpp,%.o,$(wildcard *.cpp))
.PHONY: all clean remake
-all: aberth
+all: $(TARGETS)
clean:
- rm -f aberth *.o
+ rm -f $(TARGETS) *.o aberth_kernel.h aberth_kernel.c
remake: clean
$(MAKE) all
-aberth: $(patsubst %.cpp,%.o,$(wildcard *.cpp)) ../lodepng.o
+aberth: $(OBJECTS) aberth_kernel.o ../lodepng.o
$(CXX) -o $@ $^ $(LDFLAGS)
-%.o: %.cpp $(wildcard *.h)
+aberth_kernel.h: aberth_kernel.fut
+ futhark c --library $^
+
+aberth_kernel.o: aberth_kernel.h
+ gcc -c $(OPTFLAGS) -o $@ aberth_kernel.c
+
+$(OBJECTS): %.o: %.cpp $(wildcard *.h) aberth_kernel.h
$(CXX) $(CXXFLAGS) -c -o $@ $<