-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
50 lines (33 loc) · 1.08 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
# Makefile for the GPUDirect RDMA benchmark program
PROJECT := rdma-bench
DIS_HOME := /opt/DIS
CU_HOME := /usr/local/cuda
# Locate project files
CC_SRC := $(wildcard src/*.cc)
CU_SRC := $(wildcard src/*.cu)
HEADERS := $(wildcard src/*.h)
OBJECTS := $(CC_SRC:%.cc=%.o) $(CU_SRC:%.cu=%.o)
# Compiler and linker settings
CC := /usr/bin/g++
NVCC := $(CU_HOME)/bin/nvcc
CFLAGS := -Wall -Wextra -D_REENTRANT -g -O0
INCLUDE := -I$(DIS_HOME)/include -I$(DIS_HOME)/include/dis -I$(CU_HOME)/include
LDLIBS := -lsisci -lpthread -lcuda -lboost_regex
ifneq ($(shell getconf LONG_BIT),)
LDFLAGS := -L$(DIS_HOME)/lib64 -L$(CU_HOME)/lib64
else
LDFLAGS := -L$(DIS_HOME)/lib -L$(CU_HOME)/lib
endif
# Compilation targets
.PHONY: all clean
all: $(PROJECT)
clean:
-$(RM) $(PROJECT) $(OBJECTS)
$(PROJECT): $(OBJECTS)
$(NVCC) -ccbin $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
# How to compile CUDA
%.o: %.cu $(HEADERS)
$(NVCC) -std=c++11 -x cu -ccbin $(CC) -Xcompiler "$(CFLAGS)" $(INCLUDE) -o $@ $< -c
# How to compile C++
%.o: %.cc $(HEADERS)
$(CC) -x c++ -std=c++11 $(CFLAGS) $(INCLUDE) -o $@ $< -c