AlexeyAB / darknet

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

Why is my build using debug when the Makefile has DEBUG=0? #7365

Closed asfarley closed 3 years ago

asfarley commented 3 years ago

I'm trying to make a build targeting GTX2070, RTX3070 and RTX3080 for Windows. I have VS2019, CUDA 11.1 and CUDNN 11.2 installed. I'm following the Windows build instructions using vcpkg, and I have ninja installed as well.

On my build PC (with GTX2070), the darknet executable works fine and produces the expected output using darknet_yolo_V3.cmd. On my test PC with RTX3080 (and without VS2019), I am hitting an issue where the same script (darknet_yolo_v3.cmd) complains that several runtime dlls are not found:

VCOMP140D.DLL MSVCP140D.DLL VCRUNTIME140D.dll VCRUNTIME140_1D.dll

It seems that the build script build.ps1 is executing the build in debug mode:

[169/170] cmd.exe /C "cd /D C:\VTCProject\darknet\build_win_release_novcpkg && "C:\Program Files\CMake\bin\cmake.exe" -P cmake_install.cmake"
-- Install configuration: "Debug"
-- Installing: C:/VTCProject/darknet/darknetd.lib
-- Installing: C:/VTCProject/darknet/darknetd.dll
-- Installing: C:/VTCProject/darknet/include/darknet/darknet.h
-- Installing: C:/VTCProject/darknet/include/darknet/yolo_v2_class.hpp
-- Installing: C:/VTCProject/darknet/uselib.exe
-- Installing: C:/VTCProject/darknet/darknet.exe
-- Installing: C:/VTCProject/darknet/share/darknet/DarknetTargets.cmake
-- Installing: C:/VTCProject/darknet/share/darknet/DarknetTargets-debug.cmake
-- Installing: C:/VTCProject/darknet/share/darknet/DarknetConfig.cmake
-- Installing: C:/VTCProject/darknet/share/darknet/DarknetConfigVersion.cmake

Also, examining some of the previous build output, it appears to be targeting compute_52 instead of compute_86:

[168/170] C:\PROGRA~1\NVIDIA~2\CUDA\v11.1\bin\nvcc.exe -forward-unknown-to-host-compiler -DCUDNN -DGPU -DNOMINMAX -DOPENCV -DUSE_CMAKE_LIBS -D_CRT_RAND_S -D_TIMESPEC_DEFINED -D_USE_MATH_DEFINES -I..\include -I..\src -I..\3rdparty\stb\include -isystem="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -isystem=C:\opencv-4.5.1-vc14_vc15\build\include -isystem=..\3rdparty\pthreads\include -Wno-deprecated-declarations -Xcompiler="/wd4013,/wd4018,/wd4028,/wd4047,/wd4068,/wd4090,/wd4101,/wd4113,/wd4133,/wd4190,/wd4244,/wd4267,/wd4305,/wd4477,/wd4996,/wd4819,/fp:fast,/DGPU,/DCUDNN,/DOPENCV" -D_WINDOWS -Xcompiler=" /GR /EHsc" -Xcompiler="-Zi -Ob0 -Od /RTC1" --generate-code=arch=compute_52,code=[compute_52,sm_52] -Xcompiler=-MDd -MD -MT CMakeFiles\darknet.dir\src\maxpool_layer_kernels.cu.obj -MF CMakeFiles\darknet.dir\src\maxpool_layer_kernels.cu.obj.d -x cu -c ..\src\maxpool_layer_kernels.cu -o CMakeFiles\darknet.dir\src\maxpool_layer_kernels.cu.obj -Xcompiler=-FdCMakeFiles\darknet.dir\,-FS
maxpool_layer_kernels.cu

Here is the top of my Makefile:

GPU=1
CUDNN=1
CUDNN_HALF=1
OPENCV=1
AVX=0
OPENMP=0
LIBSO=0
ZED_CAMERA=0
ZED_CAMERA_v2_8=0

# set GPU=1 and CUDNN=1 to speedup on GPU
# set CUDNN_HALF=1 to further speedup 3 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher
# set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)
# set ZED_CAMERA=1 to enable ZED SDK 3.0 and above
# set ZED_CAMERA_v2_8=1 to enable ZED SDK 2.X

USE_CPP=0
DEBUG=0

ARCH= -gencode arch=compute_75,code=[sm_75,compute_75] \
    -gencode arch=compute_86,code=[sm_86,compute_86]

I see some comments in this discussion suggesting that the Makefile is the only necessary change, but I see other comments indicating that the Makefile is not the appropriate place (which corresponds with my experience - if my Makefile was being used, the build would be targetting 86).

Where should I make the appropriate changes to set release mode and target compute_86?

asfarley commented 3 years ago

It seems that there might be something wrong with the vcpkg build process; I switched to the CMake build process and was able to generate Debug and Release builds using the Visual Studio build option.