-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (55 loc) · 1.69 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
GPU_SM_ARCH=
MAX_SEQ_LEN=
N_CODE=
N_PENALTY=
GPU_COMPUTE_ARCH=$(subst sm,compute,$(GPU_SM_ARCH))
NVCC=/usr/local/cuda/bin/nvcc
SRC_DIR=./src/
OBJ_DIR=./obj/
LIB_DIR=./lib/
INCLUDE_DIR=./include/
LOBJS= gasal.o
LOBJS_PATH=$(addprefix $(OBJ_DIR),$(LOBJS))
VPATH=src:obj:lib
YELLOW=\033[1;33m
NC=\033[0m # No Color
ifeq ($(GPU_SM_ARCH),)
error1:
@echo "Must specify GPU architecture as sm_xx"
endif
ifeq ($(MAX_SEQ_LEN),)
error2:
@echo "Must specify maximum sequence length"
endif
ifeq ($(N_CODE),)
error3:
@echo "Must specify the code for 'N'"
endif
#ifneq ($(GPU_SM_ARCH),clean)
.SUFFIXES: .cu .c .o .cc .cpp
ifeq ($(N_PENALTY),)
.cu.o:
$(NVCC) -c -g -O3 -Xcompiler -Wall,-DMAX_SEQ_LEN=$(MAX_SEQ_LEN),-DN_CODE=$(N_CODE) -Xptxas -Werror --gpu-architecture=$(GPU_COMPUTE_ARCH) --gpu-code=$(GPU_SM_ARCH) -lineinfo --ptxas-options=-v --default-stream per-thread $< -o $(OBJ_DIR)$@
else
.cu.o:
$(NVCC) -c -g -O3 -Xcompiler -Wall,-DMAX_SEQ_LEN=$(MAX_SEQ_LEN),-DN_CODE=$(N_CODE),-DN_PENALTY=$(N_PENALTY) -Xptxas -Werror --gpu-architecture=$(GPU_COMPUTE_ARCH) --gpu-code=$(GPU_SM_ARCH) -lineinfo --ptxas-options=-v --default-stream per-thread $< -o $(OBJ_DIR)$@
endif
all: makedir libgasal.a
makedir:
@mkdir -p $(OBJ_DIR)
@mkdir -p $(LIB_DIR)
@mkdir -p $(INCLUDE_DIR)
@cp $(SRC_DIR)/gasal.h $(INCLUDE_DIR)
@sed -i "s,MAX_SEQ_LEN=.*,MAX_SEQ_LEN=$(MAX_SEQ_LEN),g" ./test_prog/Makefile
ifeq ($(N_PENALTY),)
libgasal.a: $(LOBJS)
ar -csru $(LIB_DIR)$@ $(LOBJS_PATH)
@echo ""
@echo -e "${YELLOW}WARNING:${NC}\"N\" is not defined"
else
libgasal.a: $(LOBJS)
ar -csru $(LIB_DIR)$@ $(LOBJS_PATH)
endif
clean:
rm -f -r $(OBJ_DIR) $(LIB_DIR) $(INCLUDE_DIR) *~ *.exe *.o *.txt *~
gasal.o: gasal.h gasal_kernels_inl.h