-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 790 Bytes
/
Makefile
File metadata and controls
37 lines (26 loc) · 790 Bytes
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
COMMON= -DGPU -I/usr/local/cuda/include/
COMMON+= -DCUDNN
ARCH= -gencode arch=compute_52,code=[sm_52,compute_52]
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas
LDFLAGS= -lm -pthread
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
LDFLAGS+= -lcudnn
LDFLAGS+= -lstdc++
CFLAGS+= -DGPU
CFLAGS+= -DCUDNN -I/usr/local/cudnn/include
CFLAGS+= -O2
SLIB=images.so
OBJDIR=./obj/
OBJ=images.o images_kernel.o
OBJS = $(addprefix $(OBJDIR), $(OBJ))
all:obj $(SLIB)
$(SLIB): $(OBJS)
gcc $(COMMON) $(CFLAGS) -fPIC -shared -o $@ $^ $(LDFLAGS)
$(OBJDIR)%.o: %.c
gcc $(COMMON) $(CFLAGS) -fpic -c $< -o $@
$(OBJDIR)%.o: %.cu
nvcc $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -Xcompiler -fpic -o $@
obj:
mkdir -p obj
clean:
rm -f *.so ./obj/*.o