2014-10-22 01:49:18 +04:00
|
|
|
GPU=1
|
2015-01-23 03:38:24 +03:00
|
|
|
DEBUG=0
|
|
|
|
|
|
|
|
VPATH=./src/
|
|
|
|
EXEC=cnn
|
|
|
|
OBJDIR=./obj/
|
2014-11-06 01:49:58 +03:00
|
|
|
|
|
|
|
CC=gcc
|
2015-01-23 03:38:24 +03:00
|
|
|
NVCC=nvcc
|
|
|
|
OPTS=-O3
|
|
|
|
LINKER=$(CC)
|
|
|
|
LDFLAGS=`pkg-config --libs opencv` -lm -pthread
|
|
|
|
COMMON=`pkg-config --cflags opencv` -I/usr/local/cuda/include/
|
|
|
|
CFLAGS=-Wall -Wfatal-errors
|
|
|
|
CFLAGS+=$(OPTS)
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
COMMON+=-O0 -g
|
|
|
|
CFLAGS+=-O0 -g
|
2014-05-03 02:20:34 +04:00
|
|
|
endif
|
2014-11-06 01:49:58 +03:00
|
|
|
|
2015-01-23 03:38:24 +03:00
|
|
|
ifeq ($(GPU), 1)
|
|
|
|
LINKER=$(NVCC)
|
|
|
|
COMMON+=-DGPU
|
|
|
|
CFLAGS+=-DGPU
|
|
|
|
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas
|
2014-11-06 01:49:58 +03:00
|
|
|
endif
|
|
|
|
|
2015-01-23 03:38:24 +03: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 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
|
|
|
|
OBJ=gemm.o utils.o cuda.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o normalization_layer.o parser.o option_list.o cnn.o
|
|
|
|
ifeq ($(GPU), 1)
|
|
|
|
OBJ+=convolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o softmax_layer_kernels.o network_kernels.o
|
2014-04-20 00:10:59 +04:00
|
|
|
endif
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2014-07-14 09:07:51 +04:00
|
|
|
OBJS = $(addprefix $(OBJDIR), $(OBJ))
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2014-01-28 11:16:56 +04:00
|
|
|
all: $(EXEC)
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2014-07-14 09:07:51 +04:00
|
|
|
$(EXEC): $(OBJS)
|
2015-01-23 03:38:24 +03:00
|
|
|
$(CC) $(COMMON) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2014-07-14 09:07:51 +04:00
|
|
|
$(OBJDIR)%.o: %.c
|
2015-01-23 03:38:24 +03:00
|
|
|
$(CC) $(COMMON) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJDIR)%.o: %.cu
|
|
|
|
$(NVCC) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@
|
2013-11-04 23:11:01 +04:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2014-07-14 09:07:51 +04:00
|
|
|
rm -rf $(OBJS) $(EXEC)
|
2013-11-04 23:11:01 +04:00
|
|
|
|