-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (45 loc) · 1.51 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CUDA_INSTALL_PATH ?= /usr/local/cuda
VER := -5
CXX := /usr/bin/g++$(VER)
CC := /usr/bin/gcc$(VER)
LINK := /usr/bin/g++$(VER) -fPIC
CCPATH := ./gcc$(VER)
NVCC := $(CUDA_INSTALL_PATH)/bin/nvcc -ccbin $(CCPATH)
# Includes
INCLUDES = -I. -I$(CUDA_INSTALL_PATH)/include
# Libraries
LIB_CUDA := -lcuda
# Options
NVCCOPTIONS = -arch sm_52 -ptx
# Common flags
COMMONFLAGS += $(INCLUDES)
NVCCFLAGS += $(COMMONFLAGS) $(NVCCOPTIONS)
CXXFLAGS += $(COMMONFLAGS) -std=c++11
CFLAGS += $(COMMONFLAGS)
CUDA_OBJS = bitonic/bitonic_sort.ptx odd-even/odd_even.ptx radix/radixsort.ptx \
sample-rand/sample_rand.ptx quick-sort/quick_sort.ptx
#OBJS = thrust/thrust_sort_forwarder.o thrust/thrust_sort.o
OBJS = main.cpp.o bitonic/bitonic_sort.cpp.o odd-even/odd_even.cpp.o utils/utils.cpp.o\
radix/radixsort.cpp.o sample-rand/sample_rand.cpp.o \
sample-rand/sample_rand_context.cpp.o sample-rand/sample_rand_device.cpp.o sample-rand/PrefsumContext.cpp.o \
quick-sort/quick_sort_device.cpp.o quick-sort/quick_sort.cpp.o quick-sort/quick_debug.cpp.o
TARGET = solution_new.x
LINKLINE = $(LINK) -o $(TARGET) $(OBJS) $(LIB_CUDA)
.SUFFIXES: .c .cpp .cu .o
%.c.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.ptx: %.cu
$(NVCC) $(NVCCFLAGS) $< -o $@
%.cpp.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
$(TARGET): prepare $(OBJS) $(CUDA_OBJS)
$(LINKLINE)
clean:
rm -rf -r $(TARGET) *.o *.ptx
find . -type f -name '*.o' -delete
find . -type f -name '*.ptx' -delete
prepare:
rm -rf $(CCPATH);\
mkdir -p $(CCPATH);\
ln -s $(CXX) $(CCPATH)/g++;\
ln -s $(CC) $(CCPATH)/gcc;