mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
[cudnn] remove hardcoded version in cmake module (#3738)
collateral fixes: * handle opencv4 upgrade on vcpkg * add yasm (ffmpeg prerequisite) on travis * install ffmpeg separately from opencv to circumvent time limits * build only release to halve ci time * do not build as shared libs when using vcpkg, since default triplets are static * remove debug configs from appveyor matrix
This commit is contained in:

committed by
GitHub

parent
4c315ea26b
commit
35346d2ef8
30
.travis.yml
30
.travis.yml
@ -78,8 +78,8 @@ matrix:
|
|||||||
name: macOS - clang - vcpkg
|
name: macOS - clang - vcpkg
|
||||||
osx_image: xcode10.1
|
osx_image: xcode10.1
|
||||||
env:
|
env:
|
||||||
- additional_defines=""
|
- additional_defines="-DBUILD_SHARED_LIBS=OFF"
|
||||||
- MATRIX_EVAL="brew install gcc && unset CC && unset CXX"
|
- MATRIX_EVAL="brew install gcc && brew install yasm && unset CC && unset CXX"
|
||||||
- USE_VCPKG=true
|
- USE_VCPKG=true
|
||||||
- VCPKG_DEFINES="-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
- VCPKG_DEFINES="-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||||
|
|
||||||
@ -111,8 +111,13 @@ matrix:
|
|||||||
compiler: gcc
|
compiler: gcc
|
||||||
dist: bionic
|
dist: bionic
|
||||||
name: ubuntu 18.04 - gcc - vcpkg
|
name: ubuntu 18.04 - gcc - vcpkg
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
update: true
|
||||||
|
packages:
|
||||||
|
- yasm
|
||||||
env:
|
env:
|
||||||
- additional_defines=""
|
- additional_defines="-DBUILD_SHARED_LIBS=OFF"
|
||||||
- USE_VCPKG=true
|
- USE_VCPKG=true
|
||||||
- VCPKG_DEFINES="-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
- VCPKG_DEFINES="-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
@ -181,8 +186,13 @@ matrix:
|
|||||||
compiler: gcc
|
compiler: gcc
|
||||||
dist: bionic
|
dist: bionic
|
||||||
name: ubuntu 18.04 - gcc - CUDA 10 - vcpkg
|
name: ubuntu 18.04 - gcc - CUDA 10 - vcpkg
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
update: true
|
||||||
|
packages:
|
||||||
|
- yasm
|
||||||
env:
|
env:
|
||||||
- additional_defines=""
|
- additional_defines="-DBUILD_SHARED_LIBS=OFF"
|
||||||
- USE_VCPKG=true
|
- USE_VCPKG=true
|
||||||
- VCPKG_DEFINES="-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
- VCPKG_DEFINES="-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||||
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
|
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
|
||||||
@ -209,22 +219,20 @@ install:
|
|||||||
- cd vcpkg
|
- cd vcpkg
|
||||||
- git pull
|
- git pull
|
||||||
- if [ "${USE_VCPKG}" = true ] ; then ./bootstrap-vcpkg.sh ; fi
|
- if [ "${USE_VCPKG}" = true ] ; then ./bootstrap-vcpkg.sh ; fi
|
||||||
- if [ "${USE_VCPKG}" = true ] ; then travis_wait ./vcpkg install stb pthreads ; fi
|
- if [ "${USE_VCPKG}" = true ] ; then echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x64-osx.cmake ; fi
|
||||||
|
- if [ "${USE_VCPKG}" = true ] ; then echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x64-linux.cmake ; fi
|
||||||
|
- if [ "${USE_VCPKG}" = true ] ; then travis_wait ./vcpkg install stb pthreads --recurse; fi
|
||||||
|
- if [ "${USE_VCPKG}" = true ] ; then travis_wait 45 ./vcpkg install ffmpeg --recurse; fi
|
||||||
#- if [ "${USE_VCPKG}" = true ] && [[ ! -z "${CUDACXX}" ]] ; then travis_wait 45 ./vcpkg install opencv[ffmpeg,cuda] --recurse; fi
|
#- if [ "${USE_VCPKG}" = true ] && [[ ! -z "${CUDACXX}" ]] ; then travis_wait 45 ./vcpkg install opencv[ffmpeg,cuda] --recurse; fi
|
||||||
#- if [ "${USE_VCPKG}" = true ] && [[ -z "${CUDACXX}" ]] ; then travis_wait 45 ./vcpkg install opencv[ffmpeg] --recurse; fi
|
#- if [ "${USE_VCPKG}" = true ] && [[ -z "${CUDACXX}" ]] ; then travis_wait 45 ./vcpkg install opencv[ffmpeg] --recurse; fi
|
||||||
- if [ "${USE_VCPKG}" = true ] ; then travis_wait 45 ./vcpkg install opencv[ffmpeg] ; fi
|
- if [ "${USE_VCPKG}" = true ] ; then travis_wait 45 ./vcpkg install opencv[ffmpeg] --recurse; fi
|
||||||
- popd
|
- popd
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir build_debug
|
|
||||||
- cd build_debug
|
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE="Debug" ${VCPKG_DEFINES} ${additional_defines}
|
|
||||||
- cd ..
|
|
||||||
- mkdir build_release
|
- mkdir build_release
|
||||||
- cd build_release
|
- cd build_release
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE="Release" ${VCPKG_DEFINES} ${additional_defines}
|
- cmake .. -DCMAKE_BUILD_TYPE="Release" ${VCPKG_DEFINES} ${additional_defines}
|
||||||
- cd ..
|
- cd ..
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd build_debug && cmake --build . --target install -- -j8 && cd ..
|
|
||||||
- cd build_release && cmake --build . --target install -- -j8 && cd ..
|
- cd build_release && cmake --build . --target install -- -j8 && cd ..
|
||||||
|
30
appveyor.yml
30
appveyor.yml
@ -10,29 +10,17 @@ environment:
|
|||||||
CYGWIN_NOWINPATH: yes
|
CYGWIN_NOWINPATH: yes
|
||||||
CYGSH: C:\cygwin64\bin\bash -c
|
CYGSH: C:\cygwin64\bin\bash -c
|
||||||
- platform: Win64
|
- platform: Win64
|
||||||
|
USE_CUDA: yes
|
||||||
COMPILER: vs
|
COMPILER: vs
|
||||||
configuration: Release
|
configuration: Release
|
||||||
VCPKG_ROOT: C:\Tools\vcpkg
|
VCPKG_ROOT: C:\Tools\vcpkg
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-windows
|
VCPKG_DEFAULT_TRIPLET: x64-windows
|
||||||
USE_CUDA: yes
|
|
||||||
- platform: Win64
|
|
||||||
COMPILER: vs
|
|
||||||
configuration: Debug
|
|
||||||
VCPKG_ROOT: C:\Tools\vcpkg
|
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-windows
|
|
||||||
USE_CUDA: yes
|
|
||||||
- platform: Win64
|
- platform: Win64
|
||||||
|
USE_CUDA: no
|
||||||
COMPILER: vs
|
COMPILER: vs
|
||||||
configuration: Release
|
configuration: Release
|
||||||
VCPKG_ROOT: C:\Tools\vcpkg
|
VCPKG_ROOT: C:\Tools\vcpkg
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-windows
|
VCPKG_DEFAULT_TRIPLET: x64-windows
|
||||||
USE_CUDA: no
|
|
||||||
- platform: Win64
|
|
||||||
COMPILER: vs
|
|
||||||
configuration: Debug
|
|
||||||
VCPKG_ROOT: C:\Tools\vcpkg
|
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-windows
|
|
||||||
USE_CUDA: no
|
|
||||||
- platform: Win64
|
- platform: Win64
|
||||||
COMPILER: vs
|
COMPILER: vs
|
||||||
configuration: Release
|
configuration: Release
|
||||||
@ -71,14 +59,15 @@ install:
|
|||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] cd %VCPKG_ROOT%
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] cd %VCPKG_ROOT%
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] git pull
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] git pull
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] .\bootstrap-vcpkg.bat
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] .\bootstrap-vcpkg.bat
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%USE_CUDA%]==[yes] vcpkg install cuda
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] echo set(VCPKG_BUILD_TYPE release) >> triplets\%VCPKG_DEFAULT_TRIPLET%.cmake
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] vcpkg install stb pthreads
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%USE_CUDA%]==[yes] vcpkg install cuda --recurse
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] vcpkg install opencv[ffmpeg] ## opencv[ffmpeg,cuda] is too big to build, timing out (>1h). We use plain openCV also for CUDA builds (toolchain can manage this strange situation anyway)
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] vcpkg install stb pthreads --recurse
|
||||||
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] vcpkg install ffmpeg --recurse
|
||||||
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] vcpkg install opencv[ffmpeg] --recurse ## opencv[ffmpeg,cuda] is too big to build, timing out (>1h). We use plain openCV also for CUDA builds (toolchain can manage this strange situation anyway)
|
||||||
- cd %WORKSPACE%\darknet\
|
- cd %WORKSPACE%\darknet\
|
||||||
- mkdir build_debug && cd build_debug
|
- if [%COMPILER%]==[cygwin] mkdir build_debug && cd build_debug
|
||||||
- if [%COMPILER%]==[cygwin] %CYGSH% 'cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Debug"'
|
- if [%COMPILER%]==[cygwin] %CYGSH% 'cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Debug"'
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%configuration%]==[Debug] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=%VCPKG_DEFAULT_TRIPLET%" -DCMAKE_BUILD_TYPE="Debug" ..
|
- if [%COMPILER%]==[cygwin] cd ..
|
||||||
- cd ..
|
|
||||||
- mkdir build_release && cd build_release
|
- mkdir build_release && cd build_release
|
||||||
- if [%COMPILER%]==[cygwin] %CYGSH% 'cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release"'
|
- if [%COMPILER%]==[cygwin] %CYGSH% 'cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release"'
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%configuration%]==[Release] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=%VCPKG_DEFAULT_TRIPLET%" -DCMAKE_BUILD_TYPE="Release" ..
|
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%configuration%]==[Release] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=%VCPKG_DEFAULT_TRIPLET%" -DCMAKE_BUILD_TYPE="Release" ..
|
||||||
@ -89,7 +78,6 @@ install:
|
|||||||
build_script:
|
build_script:
|
||||||
- if [%COMPILER%]==[cygwin] cd build_debug && %CYGSH% 'cmake --build . --target install -- -j8' && cd ..
|
- if [%COMPILER%]==[cygwin] cd build_debug && %CYGSH% 'cmake --build . --target install -- -j8' && cd ..
|
||||||
- if [%COMPILER%]==[cygwin] cd build_release && %CYGSH% 'cmake --build . --target install -- -j8' && cd ..
|
- if [%COMPILER%]==[cygwin] cd build_release && %CYGSH% 'cmake --build . --target install -- -j8' && cd ..
|
||||||
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%configuration%]==[Debug] cd build_debug && cmake --build . --config Debug --parallel 8 --target install && cd ..
|
|
||||||
- if [%COMPILER%]==[vs] if [%configuration%]==[Release] cd build_release && cmake --build . --config Release --parallel 8 --target install && cd ..
|
- if [%COMPILER%]==[vs] if [%configuration%]==[Release] cd build_release && cmake --build . --config Release --parallel 8 --target install && cd ..
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
|
2
build.sh
2
build.sh
@ -16,12 +16,14 @@ then
|
|||||||
vcpkg_define="-DCMAKE_TOOLCHAIN_FILE=${vcpkg_path}/scripts/buildsystems/vcpkg.cmake"
|
vcpkg_define="-DCMAKE_TOOLCHAIN_FILE=${vcpkg_path}/scripts/buildsystems/vcpkg.cmake"
|
||||||
vcpkg_triplet_define="-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
|
vcpkg_triplet_define="-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
|
||||||
echo "Found vcpkg in VCPKG_ROOT: ${vcpkg_path}"
|
echo "Found vcpkg in VCPKG_ROOT: ${vcpkg_path}"
|
||||||
|
additional_defines="-DBUILD_SHARED_LIBS=OFF"
|
||||||
elif [[ ! -z "${WORKSPACE}" ]] && [ -d ${WORKSPACE}/vcpkg ] && [ ! "$bypass_vcpkg" = true ]
|
elif [[ ! -z "${WORKSPACE}" ]] && [ -d ${WORKSPACE}/vcpkg ] && [ ! "$bypass_vcpkg" = true ]
|
||||||
then
|
then
|
||||||
vcpkg_path="${WORKSPACE}/vcpkg"
|
vcpkg_path="${WORKSPACE}/vcpkg"
|
||||||
vcpkg_define="-DCMAKE_TOOLCHAIN_FILE=${vcpkg_path}/scripts/buildsystems/vcpkg.cmake"
|
vcpkg_define="-DCMAKE_TOOLCHAIN_FILE=${vcpkg_path}/scripts/buildsystems/vcpkg.cmake"
|
||||||
vcpkg_triplet_define="-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
|
vcpkg_triplet_define="-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
|
||||||
echo "Found vcpkg in WORKSPACE/vcpkg: ${vcpkg_path}"
|
echo "Found vcpkg in WORKSPACE/vcpkg: ${vcpkg_path}"
|
||||||
|
additional_defines="-DBUILD_SHARED_LIBS=OFF"
|
||||||
elif [ ! "$bypass_vcpkg" = true ]
|
elif [ ! "$bypass_vcpkg" = true ]
|
||||||
then
|
then
|
||||||
(>&2 echo "darknet is unsupported without vcpkg, use at your own risk!")
|
(>&2 echo "darknet is unsupported without vcpkg, use at your own risk!")
|
||||||
|
@ -34,10 +34,7 @@ if(NOT CUDNN_LIBRARY)
|
|||||||
PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)
|
PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package_handle_standard_args(
|
if(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn.h")
|
||||||
CUDNN DEFAULT_MSG CUDNN_INCLUDE_DIR CUDNN_LIBRARY)
|
|
||||||
|
|
||||||
if(CUDNN_FOUND)
|
|
||||||
file(READ ${CUDNN_INCLUDE_DIR}/cudnn.h CUDNN_HEADER_CONTENTS)
|
file(READ ${CUDNN_INCLUDE_DIR}/cudnn.h CUDNN_HEADER_CONTENTS)
|
||||||
string(REGEX MATCH "define CUDNN_MAJOR * +([0-9]+)"
|
string(REGEX MATCH "define CUDNN_MAJOR * +([0-9]+)"
|
||||||
CUDNN_VERSION_MAJOR "${CUDNN_HEADER_CONTENTS}")
|
CUDNN_VERSION_MAJOR "${CUDNN_HEADER_CONTENTS}")
|
||||||
@ -60,21 +57,17 @@ endif()
|
|||||||
|
|
||||||
set(CUDNN_INCLUDE_DIRS ${CUDNN_INCLUDE_DIR})
|
set(CUDNN_INCLUDE_DIRS ${CUDNN_INCLUDE_DIR})
|
||||||
set(CUDNN_LIBRARIES ${CUDNN_LIBRARY})
|
set(CUDNN_LIBRARIES ${CUDNN_LIBRARY})
|
||||||
if(CUDNN_FOUND)
|
|
||||||
message(STATUS "Found cuDNN: v${CUDNN_VERSION} (include: ${CUDNN_INCLUDE_DIR}, library: ${CUDNN_LIBRARY})")
|
|
||||||
endif()
|
|
||||||
mark_as_advanced(CUDNN_LIBRARY CUDNN_INCLUDE_DIR)
|
mark_as_advanced(CUDNN_LIBRARY CUDNN_INCLUDE_DIR)
|
||||||
|
|
||||||
# Register imported libraries:
|
find_package_handle_standard_args(CUDNN
|
||||||
# 1. If we can find a Windows .dll file (or if we can find both Debug and
|
REQUIRED_VARS CUDNN_INCLUDE_DIR CUDNN_LIBRARY
|
||||||
# Release libraries), we will set appropriate target properties for these.
|
VERSION_VAR CUDNN_VERSION
|
||||||
# 2. However, for most systems, we will only register the import location and
|
)
|
||||||
# include directory.
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CUDNN_DLL_DIR ${CUDNN_INCLUDE_DIR})
|
set(CUDNN_DLL_DIR ${CUDNN_INCLUDE_DIR})
|
||||||
list(TRANSFORM CUDNN_DLL_DIR APPEND "/../bin")
|
list(TRANSFORM CUDNN_DLL_DIR APPEND "/../bin")
|
||||||
message(STATUS "CUDNN_DLL_DIR: ${CUDNN_DLL_DIR}")
|
find_file(CUDNN_LIBRARY_DLL NAMES cudnn64_${CUDNN_VERSION_MAJOR}.dll PATHS ${CUDNN_DLL_DIR})
|
||||||
find_file(CUDNN_LIBRARY_DLL NAMES cudnn64_7.dll PATHS ${CUDNN_DLL_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( CUDNN_FOUND AND NOT TARGET CuDNN::CuDNN )
|
if( CUDNN_FOUND AND NOT TARGET CuDNN::CuDNN )
|
||||||
|
Reference in New Issue
Block a user