2016-09-02 07:48:41 +08:00
|
|
|
GPU=0
|
|
|
|
CUDNN=0
|
2018-04-16 22:52:03 +08:00
|
|
|
CUDNN_HALF=0
|
2016-09-02 07:48:41 +08:00
|
|
|
OPENCV=0
|
2018-04-17 19:39:27 +08:00
|
|
|
AVX=0
|
2017-08-04 03:18:00 +08:00
|
|
|
OPENMP=0
|
2017-08-04 22:57:05 +08:00
|
|
|
LIBSO=0
|
2020-07-06 12:49:57 +08:00
|
|
|
ZED_CAMERA=0
|
|
|
|
ZED_CAMERA_v2_8=0
|
2015-06-10 15:11:41 +08:00
|
|
|
|
2018-04-17 19:39:27 +08:00
|
|
|
# set GPU=1 and CUDNN=1 to speedup on GPU
|
2018-12-08 03:52:07 +08:00
|
|
|
# set CUDNN_HALF=1 to further speedup 3 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher
|
2018-04-17 19:39:27 +08:00
|
|
|
# set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)
|
2020-07-06 12:49:57 +08:00
|
|
|
# set ZED_CAMERA=1 to enable ZED SDK 3.0 and above
|
|
|
|
# set ZED_CAMERA_v2_8=1 to enable ZED SDK 2.X
|
2018-04-17 19:39:27 +08:00
|
|
|
|
2019-12-16 23:26:50 +08:00
|
|
|
USE_CPP=0
|
2018-04-17 19:39:27 +08:00
|
|
|
DEBUG=0
|
|
|
|
|
2020-12-01 10:14:02 +08:00
|
|
|
ARCH= -gencode arch=compute_35,code=sm_35 \
|
2016-11-25 14:56:23 +08:00
|
|
|
-gencode arch=compute_50,code=[sm_50,compute_50] \
|
2017-08-04 22:57:05 +08:00
|
|
|
-gencode arch=compute_52,code=[sm_52,compute_52] \
|
2020-12-01 21:45:28 +08:00
|
|
|
-gencode arch=compute_61,code=[sm_61,compute_61]
|
2016-11-25 14:56:23 +08:00
|
|
|
|
2018-03-21 12:54:44 +08:00
|
|
|
OS := $(shell uname)
|
|
|
|
|
2020-12-01 21:45:28 +08:00
|
|
|
# GeForce RTX 3070, 3080, 3090
|
|
|
|
# ARCH= -gencode arch=compute_86,code=[sm_86,compute_86]
|
|
|
|
|
2020-12-01 10:14:02 +08:00
|
|
|
# Kepler GeForce GTX 770, GTX 760, GT 740
|
|
|
|
# ARCH= -gencode arch=compute_30,code=sm_30
|
|
|
|
|
2020-07-24 04:52:15 +08:00
|
|
|
# Tesla A100 (GA100), DGX-A100, RTX 3080
|
|
|
|
# ARCH= -gencode arch=compute_80,code=[sm_80,compute_80]
|
|
|
|
|
2018-02-23 20:05:31 +08:00
|
|
|
# Tesla V100
|
|
|
|
# ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]
|
|
|
|
|
2019-02-02 20:16:57 +08:00
|
|
|
# GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores
|
2018-10-14 05:20:23 +08:00
|
|
|
# ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]
|
|
|
|
|
2018-10-12 20:12:36 +08:00
|
|
|
# Jetson XAVIER
|
|
|
|
# ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]
|
|
|
|
|
2018-02-23 20:05:31 +08:00
|
|
|
# GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4
|
|
|
|
# ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61
|
|
|
|
|
2019-03-14 05:56:44 +08:00
|
|
|
# GP100/Tesla P100 - DGX-1
|
2018-02-23 20:05:31 +08:00
|
|
|
# ARCH= -gencode arch=compute_60,code=sm_60
|
2018-02-08 06:09:30 +08:00
|
|
|
|
2018-07-01 04:12:25 +08:00
|
|
|
# For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment:
|
|
|
|
# ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]
|
2018-02-08 06:09:30 +08:00
|
|
|
|
2018-02-23 20:05:31 +08:00
|
|
|
# For Jetson Tx2 or Drive-PX2 uncomment:
|
2018-02-08 06:09:30 +08:00
|
|
|
# ARCH= -gencode arch=compute_62,code=[sm_62,compute_62]
|
|
|
|
|
2020-11-12 17:12:50 +08:00
|
|
|
# For Tesla GA10x cards, RTX 3090, RTX 3080, RTX 3070, RTX A6000, RTX A40 uncomment:
|
|
|
|
# ARCH= -gencode arch=compute_86,code=[sm_86,compute_86]
|
|
|
|
|
2018-02-08 06:09:30 +08:00
|
|
|
|
2015-01-23 08:38:24 +08:00
|
|
|
VPATH=./src/
|
2015-01-28 05:52:37 +08:00
|
|
|
EXEC=darknet
|
2015-01-23 08:38:24 +08:00
|
|
|
OBJDIR=./obj/
|
2014-11-06 06:49:58 +08:00
|
|
|
|
2017-08-04 22:57:05 +08:00
|
|
|
ifeq ($(LIBSO), 1)
|
2019-01-07 04:51:38 +08:00
|
|
|
LIBNAMESO=libdarknet.so
|
2017-08-04 22:57:05 +08:00
|
|
|
APPNAMESO=uselib
|
|
|
|
endif
|
|
|
|
|
2019-12-16 23:26:50 +08:00
|
|
|
ifeq ($(USE_CPP), 1)
|
|
|
|
CC=g++
|
|
|
|
else
|
2014-11-06 06:49:58 +08:00
|
|
|
CC=gcc
|
2019-12-16 23:26:50 +08:00
|
|
|
endif
|
|
|
|
|
2019-03-13 05:54:28 +08:00
|
|
|
CPP=g++ -std=c++11
|
2019-03-14 05:56:44 +08:00
|
|
|
NVCC=nvcc
|
2015-09-02 02:21:01 +08:00
|
|
|
OPTS=-Ofast
|
2019-03-14 05:56:44 +08:00
|
|
|
LDFLAGS= -lm -pthread
|
|
|
|
COMMON= -Iinclude/ -I3rdparty/stb/include
|
2019-01-19 00:54:05 +08:00
|
|
|
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC
|
2015-01-23 08:38:24 +08:00
|
|
|
|
2019-03-14 05:56:44 +08:00
|
|
|
ifeq ($(DEBUG), 1)
|
2019-02-05 05:36:17 +08:00
|
|
|
#OPTS= -O0 -g
|
|
|
|
#OPTS= -Og -g
|
2019-02-02 20:16:57 +08:00
|
|
|
COMMON+= -DDEBUG
|
|
|
|
CFLAGS+= -DDEBUG
|
2018-04-12 18:33:51 +08:00
|
|
|
else
|
2019-03-14 05:56:44 +08:00
|
|
|
ifeq ($(AVX), 1)
|
2018-08-13 07:43:45 +08:00
|
|
|
CFLAGS+= -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a
|
2014-05-03 06:20:34 +08:00
|
|
|
endif
|
2018-04-17 19:39:27 +08:00
|
|
|
endif
|
2014-11-06 06:49:58 +08:00
|
|
|
|
2015-02-07 10:53:53 +08:00
|
|
|
CFLAGS+=$(OPTS)
|
|
|
|
|
2019-11-24 08:17:32 +08:00
|
|
|
ifneq (,$(findstring MSYS_NT,$(OS)))
|
|
|
|
LDFLAGS+=-lws2_32
|
|
|
|
endif
|
|
|
|
|
2019-03-14 05:56:44 +08:00
|
|
|
ifeq ($(OPENCV), 1)
|
2015-06-10 15:11:41 +08:00
|
|
|
COMMON+= -DOPENCV
|
|
|
|
CFLAGS+= -DOPENCV
|
2018-12-29 09:13:14 +08:00
|
|
|
LDFLAGS+= `pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv`
|
|
|
|
COMMON+= `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv`
|
2015-06-10 15:11:41 +08:00
|
|
|
endif
|
|
|
|
|
2017-08-04 03:18:00 +08:00
|
|
|
ifeq ($(OPENMP), 1)
|
2020-06-10 09:05:11 +08:00
|
|
|
ifeq ($(OS),Darwin) #MAC
|
|
|
|
CFLAGS+= -Xpreprocessor -fopenmp
|
|
|
|
else
|
|
|
|
CFLAGS+= -fopenmp
|
|
|
|
endif
|
2017-08-04 03:18:00 +08:00
|
|
|
LDFLAGS+= -lgomp
|
|
|
|
endif
|
|
|
|
|
2018-03-21 12:54:44 +08:00
|
|
|
ifeq ($(GPU), 1)
|
2015-09-22 08:30:32 +08:00
|
|
|
COMMON+= -DGPU -I/usr/local/cuda/include/
|
2015-06-10 15:11:41 +08:00
|
|
|
CFLAGS+= -DGPU
|
2018-03-21 12:54:44 +08:00
|
|
|
ifeq ($(OS),Darwin) #MAC
|
|
|
|
LDFLAGS+= -L/usr/local/cuda/lib -lcuda -lcudart -lcublas -lcurand
|
|
|
|
else
|
2015-03-22 03:25:14 +08:00
|
|
|
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
|
2014-11-06 06:49:58 +08:00
|
|
|
endif
|
2018-03-21 12:54:44 +08:00
|
|
|
endif
|
2014-11-06 06:49:58 +08:00
|
|
|
|
2018-03-21 12:54:44 +08:00
|
|
|
ifeq ($(CUDNN), 1)
|
|
|
|
COMMON+= -DCUDNN
|
|
|
|
ifeq ($(OS),Darwin) #MAC
|
|
|
|
CFLAGS+= -DCUDNN -I/usr/local/cuda/include
|
|
|
|
LDFLAGS+= -L/usr/local/cuda/lib -lcudnn
|
|
|
|
else
|
2017-08-07 03:21:46 +08:00
|
|
|
CFLAGS+= -DCUDNN -I/usr/local/cudnn/include
|
|
|
|
LDFLAGS+= -L/usr/local/cudnn/lib64 -lcudnn
|
2016-05-14 02:59:43 +08:00
|
|
|
endif
|
2018-04-16 22:58:08 +08:00
|
|
|
endif
|
2018-04-16 22:52:03 +08:00
|
|
|
|
|
|
|
ifeq ($(CUDNN_HALF), 1)
|
|
|
|
COMMON+= -DCUDNN_HALF
|
|
|
|
CFLAGS+= -DCUDNN_HALF
|
2018-04-17 07:51:11 +08:00
|
|
|
ARCH+= -gencode arch=compute_70,code=[sm_70,compute_70]
|
2018-03-21 12:54:44 +08:00
|
|
|
endif
|
2016-05-14 02:59:43 +08:00
|
|
|
|
2019-03-19 05:17:09 +08:00
|
|
|
ifeq ($(ZED_CAMERA), 1)
|
2019-03-19 19:41:47 +08:00
|
|
|
CFLAGS+= -DZED_STEREO -I/usr/local/zed/include
|
2020-01-28 02:12:08 +08:00
|
|
|
ifeq ($(ZED_CAMERA_v2_8), 1)
|
2019-03-19 05:17:09 +08:00
|
|
|
LDFLAGS+= -L/usr/local/zed/lib -lsl_core -lsl_input -lsl_zed
|
2020-05-01 15:49:40 +08:00
|
|
|
#-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0
|
2020-01-28 02:12:08 +08:00
|
|
|
else
|
|
|
|
LDFLAGS+= -L/usr/local/zed/lib -lsl_zed
|
2020-05-01 15:49:40 +08:00
|
|
|
#-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0
|
2020-01-28 02:12:08 +08:00
|
|
|
endif
|
2019-03-19 05:17:09 +08:00
|
|
|
endif
|
|
|
|
|
2021-05-12 03:59:21 +08:00
|
|
|
OBJ=image_opencv.o http_stream.o gemm.o utils.o dark_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 parser.o option_list.o darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o representation_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o reorg_old_layer.o super.o voxel.o tree.o yolo_layer.o gaussian_yolo_layer.o upsample_layer.o lstm_layer.o conv_lstm_layer.o scale_channels_layer.o sam_layer.o
|
2020-05-01 15:49:40 +08:00
|
|
|
ifeq ($(GPU), 1)
|
|
|
|
LDFLAGS+= -lstdc++
|
2016-10-22 04:16:43 +08:00
|
|
|
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 network_kernels.o avgpool_layer_kernels.o
|
2014-04-20 04:10:59 +08:00
|
|
|
endif
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-07-14 13:07:51 +08:00
|
|
|
OBJS = $(addprefix $(OBJDIR), $(OBJ))
|
2019-01-07 04:51:38 +08:00
|
|
|
DEPS = $(wildcard src/*.h) Makefile include/darknet.h
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2019-11-21 09:53:31 +08:00
|
|
|
all: $(OBJDIR) backup results setchmod $(EXEC) $(LIBNAMESO) $(APPNAMESO)
|
2017-08-04 22:57:05 +08:00
|
|
|
|
2019-03-14 05:56:44 +08:00
|
|
|
ifeq ($(LIBSO), 1)
|
2017-08-04 22:57:05 +08:00
|
|
|
CFLAGS+= -fPIC
|
|
|
|
|
2019-11-21 09:53:31 +08:00
|
|
|
$(LIBNAMESO): $(OBJDIR) $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp
|
2019-01-07 04:51:38 +08:00
|
|
|
$(CPP) -shared -std=c++11 -fvisibility=hidden -DLIB_EXPORTS $(COMMON) $(CFLAGS) $(OBJS) src/yolo_v2_class.cpp -o $@ $(LDFLAGS)
|
2019-03-14 05:56:44 +08:00
|
|
|
|
2019-01-07 04:51:38 +08:00
|
|
|
$(APPNAMESO): $(LIBNAMESO) include/yolo_v2_class.hpp src/yolo_console_dll.cpp
|
|
|
|
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) -o $@ src/yolo_console_dll.cpp $(LDFLAGS) -L ./ -l:$(LIBNAMESO)
|
2017-08-04 22:57:05 +08:00
|
|
|
endif
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-07-14 13:07:51 +08:00
|
|
|
$(EXEC): $(OBJS)
|
2018-09-28 04:49:03 +08:00
|
|
|
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2015-04-14 05:09:55 +08:00
|
|
|
$(OBJDIR)%.o: %.c $(DEPS)
|
2015-01-23 08:38:24 +08:00
|
|
|
$(CC) $(COMMON) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2018-02-18 07:31:56 +08:00
|
|
|
$(OBJDIR)%.o: %.cpp $(DEPS)
|
2019-01-19 02:29:06 +08:00
|
|
|
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) -c $< -o $@
|
2018-02-18 07:31:56 +08:00
|
|
|
|
2015-04-14 05:09:55 +08:00
|
|
|
$(OBJDIR)%.o: %.cu $(DEPS)
|
2015-01-28 05:31:06 +08:00
|
|
|
$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2019-11-21 09:53:31 +08:00
|
|
|
$(OBJDIR):
|
|
|
|
mkdir -p $(OBJDIR)
|
2016-11-19 13:51:36 +08:00
|
|
|
backup:
|
|
|
|
mkdir -p backup
|
2015-06-17 05:54:26 +08:00
|
|
|
results:
|
|
|
|
mkdir -p results
|
2019-01-07 04:51:38 +08:00
|
|
|
setchmod:
|
|
|
|
chmod +x *.sh
|
2015-06-10 15:22:48 +08:00
|
|
|
|
2013-11-05 03:11:01 +08:00
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2017-08-04 22:57:05 +08:00
|
|
|
rm -rf $(OBJS) $(EXEC) $(LIBNAMESO) $(APPNAMESO)
|