AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.76k stars 7.96k forks source link

gpu isn't used #6104

Open lixiaohui2020 opened 4 years ago

lixiaohui2020 commented 4 years ago

I use darknet by linux. When i train, it show "gpu isn't used". The info such as, ./darknet detector train ./cfg/person_only.data ./cfg/yolov3.cfg ./weights/yolov3.weights GPU isn't used Used AVX Used FMA & AVX2 OpenCV version: 3.4.9 yolov3_v2_person_s1 mini_batch = 4, batch = 64, time_steps = 1, train = 1

My makefile is :

ifeq ($(GPU), 1)
COMMON+= -DGPU -I/usr/local/cuda-10.0/include/
CFLAGS+= -DGPU
ifeq ($(OS),Darwin) #MAC
LDFLAGS+= -L/usr/local/cuda/lib -lcuda -lcudart -lcublas -lcurand
else
LDFLAGS+= -L/usr/local/cuda-10.0/lib64 -lcuda -lcudart -lcublas -lcurand
endif
endif

ifeq ($(CUDNN), 1)
COMMON+= -DCUDNN 
ifeq ($(OS),Darwin) #MAC
CFLAGS+= -DCUDNN -I/usr/local/cuda/include
LDFLAGS+= -L/usr/local/cuda/lib -lcudnn
else
CFLAGS+= -DCUDNN -I/usr/local/cuda-10.0/include
LDFLAGS+= -L/usr/local/cuda-10.0/lib64 -lcudnn
endif
endif

I hope you can help me know why it shows "gpu isn't used".

docquantum commented 4 years ago

Did you set the flags at the start of the makefile to 1?

Makefile#L1

lixiaohui2020 commented 4 years ago

Did you set the flags at the start of the makefile to 1?

Makefile#L1

I set the flags as 1, such as follows,

GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=1
AVX=0
OPENMP=0
LIBSO=0
ZED_CAMERA=0 # ZED SDK 3.0 and above
ZED_CAMERA_v2_8=0 # ZED SDK 2.X

....
NVCC = /usr/local/cuda/bin/nvcc

....
ifeq ($(GPU), 1)
COMMON+= -DGPU -I/usr/local/cuda-10.0/include/
CFLAGS+= -DGPU
ifeq ($(OS),Darwin) #MAC
LDFLAGS+= -L/usr/local/cuda/lib -lcuda -lcudart -lcublas -lcurand
else
LDFLAGS+= -L/usr/local/cuda-10.0/lib64 -lcuda -lcudart -lcublas -lcurand
endif
endif

ifeq ($(CUDNN), 1)
COMMON+= -DCUDNN 
ifeq ($(OS),Darwin) #MAC
CFLAGS+= -DCUDNN -I/usr/local/cuda/include
LDFLAGS+= -L/usr/local/cuda/lib -lcudnn
else
CFLAGS+= -DCUDNN -I/usr/local/cuda-10.0/include
LDFLAGS+= -L/usr/local/cuda-10.0/lib64 -lcudnn
endif
endif
docquantum commented 4 years ago

Well, if it was able to compile using CUDA, I'd assume that everything was set up right then.

You do have a CUDA capable GPU on the system you're running with the CUDA toolkit installed, yes?

lixiaohui2020 commented 4 years ago

Well, if it was able to compile using CUDA, I'd assume that everything was set up right then.

You do have a CUDA capable GPU on the system you're running with the CUDA toolkit installed, yes?

I am sorry, I can not understand your meaning, can you interpret it again? thanks

docquantum commented 4 years ago

Something that might make this easier is if you could document your system that you're using for compilation and training, along with the steps you took to compile.

I was referring to the CUDA toolkit, the libraries needed to be able to compile yolo to use the GPU. If you don't have that, along with cuDNN installed on the linux system you compiled, you wont be able to compile to use GPU.