-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (31 loc) · 1.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
SOURCE_DIR = src
BUILD_DIR = build
EXECUTABLE = eigensolver
CXX = g++
CXXFLAGS = -m64 -O3 -Wall -std=c++11
NVCC = nvcc
NVCCFLAGS = -m64 -O3 -arch compute_20 -std=c++11
#NVCCLINKFLAGS = -dlink -arch compute_35
LDFLAGS = -L/usr/local/cuda/lib64/ -lcudart -lcusparse
INCLUDES = $(addprefix $(SOURCE_DIR)/, matrix.h graph_io.h linear_algebra.h cuda_algebra.h cycle_timer.h eigen.h utils.h)
OBJECTS = $(addprefix $(BUILD_DIR)/, cuda_algebra.o)
TESTS = $(addprefix test_, sparse_eigen symm_tridiag_eigen vector_operations mv_multiply)
.PHONY: all tests clean
all: $(EXECUTABLE)
tests: $(TESTS)
$(BUILD_DIR):
mkdir -p $@
$(OBJECTS): $(INCLUDES) | $(BUILD_DIR)
$(EXECUTABLE): $(OBJECTS) $(BUILD_DIR)/main.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
test_%: $(OBJECTS) $(BUILD_DIR)/%.test.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cc
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cu
$(NVCC) $(NVCCFLAGS) -c -o $@ $<
# $(NVCC) $(NVCCLINKFLAGS) -o cu.o $@
$(BUILD_DIR)/%.test.o: $(SOURCE_DIR)/test/%.cc
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -rf $(BUILD_DIR) $(EXECUTABLE) test_*