2014-10-22 05:49:18 +08:00
|
|
|
GPU=1
|
2014-11-06 06:49:58 +08:00
|
|
|
CLBLAS=0
|
|
|
|
|
|
|
|
CC=gcc
|
2014-10-28 10:45:06 +08:00
|
|
|
COMMON=-Wall -Wfatal-errors `pkg-config --cflags opencv` -I/usr/local/cuda/include/
|
2014-05-03 06:20:34 +08:00
|
|
|
ifeq ($(GPU), 1)
|
|
|
|
COMMON+=-DGPU
|
|
|
|
endif
|
2014-11-06 06:49:58 +08:00
|
|
|
|
|
|
|
ifeq ($(CLBLAS), 1)
|
|
|
|
COMMON+=-DCLBLAS
|
|
|
|
LDFLAGS=-lclBLAS
|
|
|
|
endif
|
|
|
|
|
2013-12-07 05:26:09 +08:00
|
|
|
UNAME = $(shell uname)
|
2014-05-10 06:14:52 +08:00
|
|
|
OPTS=-Ofast -flto
|
2014-11-19 05:51:04 +08:00
|
|
|
#OPTS=-O3
|
2013-12-07 05:26:09 +08:00
|
|
|
ifeq ($(UNAME), Darwin)
|
2014-04-11 16:00:27 +08:00
|
|
|
COMMON+= -isystem /usr/local/Cellar/opencv/2.4.6.1/include/opencv -isystem /usr/local/Cellar/opencv/2.4.6.1/include
|
2014-04-20 04:10:59 +08:00
|
|
|
ifeq ($(GPU), 1)
|
2014-04-11 16:00:27 +08:00
|
|
|
LDFLAGS= -framework OpenCL
|
2014-04-20 04:10:59 +08:00
|
|
|
endif
|
2013-12-07 05:26:09 +08:00
|
|
|
else
|
2014-05-10 06:14:52 +08:00
|
|
|
OPTS+= -march=native
|
2014-04-20 04:10:59 +08:00
|
|
|
ifeq ($(GPU), 1)
|
2014-11-06 06:49:58 +08:00
|
|
|
LDFLAGS+= -lOpenCL
|
2013-12-07 05:26:09 +08:00
|
|
|
endif
|
2014-04-20 04:10:59 +08:00
|
|
|
endif
|
2014-04-17 08:05:29 +08:00
|
|
|
CFLAGS= $(COMMON) $(OPTS)
|
2014-08-09 03:04:15 +08:00
|
|
|
#CFLAGS= $(COMMON) -O0 -g
|
2014-04-11 16:00:27 +08:00
|
|
|
LDFLAGS+=`pkg-config --libs opencv` -lm
|
2013-11-05 03:11:01 +08:00
|
|
|
VPATH=./src/
|
2014-01-28 15:16:56 +08:00
|
|
|
EXEC=cnn
|
2014-07-14 13:07:51 +08:00
|
|
|
OBJDIR=./obj/
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-12-04 00:48:07 +08:00
|
|
|
OBJ=network.o network_gpu.o image.o cnn.o connected_layer.o maxpool_layer.o activations.o list.o option_list.o parser.o utils.o data.o matrix.o softmax_layer.o mini_blas.o convolutional_layer.o gemm.o normalization_layer.o opencl.o im2col.o col2im.o axpy.o dropout_layer.o crop_layer.o freeweight_layer.o cost_layer.o server.o
|
2014-07-14 13:07:51 +08:00
|
|
|
OBJS = $(addprefix $(OBJDIR), $(OBJ))
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-01-28 15:16:56 +08:00
|
|
|
all: $(EXEC)
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-07-14 13:07:51 +08:00
|
|
|
$(EXEC): $(OBJS)
|
2013-11-05 03:11:01 +08:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
|
|
|
|
2014-07-14 13:07:51 +08:00
|
|
|
$(OBJDIR)%.o: %.c
|
2013-11-05 03:11:01 +08:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2014-07-14 13:07:51 +08:00
|
|
|
rm -rf $(OBJS) $(EXEC)
|
2013-11-05 03:11:01 +08:00
|
|
|
|