From 900d913e053ae2793e9050ab414b8804d5aa261f Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 10:35:07 +1300 Subject: [PATCH 01/65] update download scripts --- .github/workflows/build-options.yml | 15 +++-- options/options.txt | 6 +- options/options_no_cuda.txt | 12 ++++ ...s_opencv4.9.0_contrib_cuda_cudnn_vc15.txt} | 2 +- ...options_opencv4.9.0_contrib_cuda_vc15.txt} | 2 +- ...options_opencv4.9.0_contrib_cuda_vc16.txt} | 2 +- ...t => options_opencv4.9.0_contrib_vc16.txt} | 2 +- scripts/linux/cuda-keyring_1.1-1_all.deb | Bin 0 -> 4332 bytes scripts/linux/download.sh | 18 +----- scripts/linux/download_cuda.sh | 52 ++++++++++++++---- scripts/linux/download_cudnn.sh | 33 +++++++++-- scripts/windows/download.bat | 18 +----- 12 files changed, 102 insertions(+), 60 deletions(-) create mode 100644 options/options_no_cuda.txt rename options/{options_opencv4.5.0_contrib_cuda_cudnn_vc15.txt => options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt} (95%) rename options/{options_opencv4.5.0_contrib_cuda_vc15.txt => options_opencv4.9.0_contrib_cuda_vc15.txt} (95%) rename options/{options_opencv4.5.0_contrib_cuda_vc16.txt => options_opencv4.9.0_contrib_cuda_vc16.txt} (95%) rename options/{options_opencv4.5.0_contrib_vc16.txt => options_opencv4.9.0_contrib_vc16.txt} (95%) create mode 100644 scripts/linux/cuda-keyring_1.1-1_all.deb diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 51a4749..95d3e14 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -1,4 +1,4 @@ -name: Build options +name: Build non-CUDA options on: [push] @@ -10,11 +10,11 @@ jobs: - name: Download OpenCV repo/s working-directory: scripts/windows shell: cmd - run: .\download.bat options\options_opencv4.5.0_contrib_vc16.txt + run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt - name: Build OpenCV working-directory: scripts/windows shell: cmd - run: .\build.bat options\options_opencv4.5.0_contrib_vc16.txt + run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt - name: Upload build artifacts uses: actions/upload-artifact@v2 with: @@ -22,17 +22,20 @@ jobs: path: install build-linux: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-23.04] steps: - uses: actions/checkout@v2 - name: Download OpenCV repo/s working-directory: scripts/linux run: | - ./download.sh options/options_opencv4.5.0_contrib_vc16.txt + ./download.sh options/options_opencv4.9.0_contrib_vc16.txt - name: Build OpenCV working-directory: scripts/linux run: | - ./build.sh options/options_opencv4.5.0_contrib_vc16.txt + ./build.sh options/options_opencv4.9.0_contrib_vc16.txt - name: Upload build artifacts uses: actions/upload-artifact@v2 with: diff --git a/options/options.txt b/options/options.txt index 8ec5af6..2490126 100644 --- a/options/options.txt +++ b/options/options.txt @@ -1,12 +1,12 @@ -opencv_version$=4.5.0 +opencv_version$=4.9.0 visual_studio_version$="Visual Studio 15 2017 Win64" clean_on_build$=true with_contrib$=true -with_cuda$=true +with_cuda$=false with_examples$=false build_world$=true with_debug$=true with_python_release$=false with_python_debug$=false -additional_build_options$=-D OPENCV_DNN_CUDA=ON -D WITH_CUDNN=ON -D WITH_CUBLAS=ON -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=ON -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON +additional_build_options$=-D OPENCV_DNN_CUDA=OFF -D WITH_CUDNN=OFF -D WITH_CUBLAS=OFF -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON custom_build_options$=NA \ No newline at end of file diff --git a/options/options_no_cuda.txt b/options/options_no_cuda.txt new file mode 100644 index 0000000..2490126 --- /dev/null +++ b/options/options_no_cuda.txt @@ -0,0 +1,12 @@ +opencv_version$=4.9.0 +visual_studio_version$="Visual Studio 15 2017 Win64" +clean_on_build$=true +with_contrib$=true +with_cuda$=false +with_examples$=false +build_world$=true +with_debug$=true +with_python_release$=false +with_python_debug$=false +additional_build_options$=-D OPENCV_DNN_CUDA=OFF -D WITH_CUDNN=OFF -D WITH_CUBLAS=OFF -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON +custom_build_options$=NA \ No newline at end of file diff --git a/options/options_opencv4.5.0_contrib_cuda_cudnn_vc15.txt b/options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt similarity index 95% rename from options/options_opencv4.5.0_contrib_cuda_cudnn_vc15.txt rename to options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt index 77d5f00..7d089ae 100644 --- a/options/options_opencv4.5.0_contrib_cuda_cudnn_vc15.txt +++ b/options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt @@ -1,4 +1,4 @@ -opencv_version$=4.5.0 +opencv_version$=4.9.0 visual_studio_version$="Visual Studio 15 2017 Win64" clean_on_build$=false with_contrib$=true diff --git a/options/options_opencv4.5.0_contrib_cuda_vc15.txt b/options/options_opencv4.9.0_contrib_cuda_vc15.txt similarity index 95% rename from options/options_opencv4.5.0_contrib_cuda_vc15.txt rename to options/options_opencv4.9.0_contrib_cuda_vc15.txt index ecd97c2..531bf3f 100644 --- a/options/options_opencv4.5.0_contrib_cuda_vc15.txt +++ b/options/options_opencv4.9.0_contrib_cuda_vc15.txt @@ -1,4 +1,4 @@ -opencv_version$=4.5.0 +opencv_version$=4.9.0 visual_studio_version$="Visual Studio 15 2017 Win64" clean_on_build$=false with_contrib$=true diff --git a/options/options_opencv4.5.0_contrib_cuda_vc16.txt b/options/options_opencv4.9.0_contrib_cuda_vc16.txt similarity index 95% rename from options/options_opencv4.5.0_contrib_cuda_vc16.txt rename to options/options_opencv4.9.0_contrib_cuda_vc16.txt index 41262cc..ca1e326 100644 --- a/options/options_opencv4.5.0_contrib_cuda_vc16.txt +++ b/options/options_opencv4.9.0_contrib_cuda_vc16.txt @@ -1,4 +1,4 @@ -opencv_version$=4.5.0 +opencv_version$=4.9.0 visual_studio_version$="Visual Studio 16 2019" -A x64 clean_on_build$=false with_contrib$=true diff --git a/options/options_opencv4.5.0_contrib_vc16.txt b/options/options_opencv4.9.0_contrib_vc16.txt similarity index 95% rename from options/options_opencv4.5.0_contrib_vc16.txt rename to options/options_opencv4.9.0_contrib_vc16.txt index 41262cc..ca1e326 100644 --- a/options/options_opencv4.5.0_contrib_vc16.txt +++ b/options/options_opencv4.9.0_contrib_vc16.txt @@ -1,4 +1,4 @@ -opencv_version$=4.5.0 +opencv_version$=4.9.0 visual_studio_version$="Visual Studio 16 2019" -A x64 clean_on_build$=false with_contrib$=true diff --git a/scripts/linux/cuda-keyring_1.1-1_all.deb b/scripts/linux/cuda-keyring_1.1-1_all.deb new file mode 100644 index 0000000000000000000000000000000000000000..d02294184b32b91eb1a7d348406ebaa0f3218bdd GIT binary patch literal 4332 zcmbtXcT`i^`b9y7h>8vexk+wFNC>1tG9nHrqc|2+EP#%v zSg>FPMG+jTf(ljy5gZ$cjvWLAewp%{HSevr*8Agq>#V!Zz31F>);ZtW-`?9R1klTr zp%6JJRRP*XQk53aTcA)V0*glwFmM7E35CLK@BjZqz~NXl8Va?wzd`~*2Eie+WUW!3 ztO+s#`k*xHfB&BV|8rF+R00{sS!2X@b`CG@p9^=Wt{K0Y>osP&-Jemr>wS5*@2LIa zIJ+4WFV9IIlUF^L8ESF+rFp@D6>f`quaMUU4VO*4D(HM*x(FxL`n$iI(j?p_Nlwar za#>0jHhmj%6O=*KmBhG1YuYZ&IW{e5G+w*wb<%liwu^7?gB>vYI|JUYuD^S=_EKoP zJ*GCwX>|!YP@EoGofc(1ktouOG3zJP+*(tRQsv||uz#Lf@sY3&zlCfcInF_UpYon@ zez5gr#Yi5m`1+2_4)0YHs*WeL*TgfHXO%qu&ETd*-h@cnhAUHtJ4kQg1)gzFnoF;K z?TW_|cL>%x>kmY&KUElaCbekkZ#N%$6HeT?1}=->HmNqwV*wd^mf<4-H3bT{FFdLKI>l2&o?rx)$WKZ--@FQN)XO!cRSOIw(Ff84H-4EiE9l5GqceK(=bV*c(sr)BeM4AI&5`HS=1&tdvNk2nI%Duelj`$P zCk|{U?Gz4fo#){UGU;O!Xo6H&yQ`Coo!-I=fw(YeQE??sX(VnViHns4O> zY0_d|K)e3~W!Lr>HYnvu1Rtih*MN3ox@`EevvZ!YE9i7>!q>6C!^|O8EC-Ch-{7?& z`@i8IK|t6l!|(C$_&q;)^}aEG130TT>{>Txbi$(l0l%WDJ3`O?+FSR!xovjDg3p$p z`>%W-I`_NzVEDPAll!3A9?Py=Sl=Xmv*Soo-<<9r*PYi4!w2D;$1kty@sxd;UQy!O zSl3V!IJlp2tNX)!Wtztql_W0vH2CpcS~@tFdG~#_``azW@wkP|{LPUOohS1$tWOZ= z=W$s-j69v(+W5WOq;nqZubwv+3PV4??XHnynJrymTi`j4`X(NA`gqnY`+T3;+pi?W zL}$K=d$^10bre`#c=6~92ai$~(?5LA6ZGDZyodFKUlw$oY1IiH-yD9CDxhY%L*457 z#F9A|9fd~870d1?{qtdYg@$;)v-zg6$1+jH@O;iCeb~Fvh2C~!u{SPU%g1EV#&*2O z861Ad_+C1r>{PHi8;-P#J;h=>Ka<*+D8&LW{v9M+2iF$mira>J9nLnxc0{75b+p)#f_t*N(BT6!gauX?YXA9rzHmAV|knRxxeJNtf0&{uJXyl{|# z^iqeFcFlCAH`8Wr)Q7cfo?!_3l)B_n-NKJ%r!}QlTTG732?f|qf*g{qXhkeI6F4om zV?6H|Yd7iq{FWhm$HG&)cs^p{+Mo78`vjZ5P&Gs3+=Fi^uLqh+)&}_0n=0l`_dRw> zsV751+@CGp>dMc5mw0KbtJiYLiWQYZ&w2O1b4D(IEIPQ(KOa9c;9E}MmXFmTL9wrP zm2C@3e$Dw{=d!l8!-}mr0={y-Wxi0>DTCbc(7}E!>z;9~?s?6n?vMIR&Pc=SocI?5 zpMTNfysrxHHjZf*InGYGQm`-9SJU2VSa9vfj6EbmjFTt#Q?V~klHHkmQnBKl?C|EH zmBn2-hu0hvza4t1+un3?K4JftBfyHJR-dq}qrTnn%baCf>gJ4G6>rI!M(+DL!d$SX zNlNH%qo#S?|2Cne#(lQ>>$chFGrbjGFYiAcPj3^1UU!_B6?nvWJiCb(*^hax0m8yqugm_Jyb`5lj(my4B7vY)ZE z%XOQhOGrKJ1-T{%e0pzG9)F>I@sjYMo@_@gJvBGyRPN)(68fU|8{_UmmHMgoiv06N z$Kv=;M+Wy-*&B0kUTM+OT(VxoZn(laZHIpOwb9a&H9BSLPp=`y_v@C)W=;FC1=Ht1 zf7;Ug-m$&DFO>T_Oj)w0`pvWas0V&`9&I$$?BhnL!-S!;i<_2F`)74DMjh~&B)C3u zW8+NfXTtm%VZHNy zc`O-TFIeh<9?hIJb?+PQtW~6-u7wSlN4`lPm5VAvPaW_)fQzq)V=Z6V57mBU1)rTd zA@;}yW_64xW0&BN%k~X!+g`UVT~hL=_PstZh#D*Eq}z>Y{hd?o0yCDZ`zL3|C!{1u zO)8BX)c?W6e{wbgfwPJ8|D@RwNG$G;i8jt&^m~w~GzJ^WrE#Hr28~UnKv`5ipGc$r zF$kdp24ygmPbXp!NC-p(>J6%7Z7>uK;j0p~pgtHXGuc!_aS707ftvDo~oB#1uUg35UYr!6-s73T^8nQIM!)jcxd^6F|aM8qg37g*c&P3IYO; z#32<503!!&HUx)3%5f+KN)Dhv3<$*$Fa#L^O90^nqyh@< zMd8ta+-6e##nwQa05lwq#)EP^+%^M+B48AFg%l+NaZ(Im+Xo8;0Xz;)z<~rg8f*Kg zK!9i|h{j;0C^-s+kP>hhg;ar)5um^Omw)v<5GN^s1wasx%K;=xDgzZLDPAVU+0H>g zqTmWp29?55fNfXMwmc4x02KrfVe?ZMBo4sf&PY4A_|02 ze`V_L+|aZpE)8n78L}WG66!}|3t^EettrhP0#Wf8G7^zWA}0`OBpy@EV`ynaVltB& z!G{ClSX=;&%fjfAc|-vSSb$IUj_@ zV)ap?WTc5LX0drBGb)o`;(rVbAf&~6B$g2D58KFpkd<0Ff2L1%tgndm{tfJ#$;+ZEP{rF5HZtK;c^2( zLAIDlG))S}f=AF35kioz7R$+KeJloJRe`o##)#4o@JLmR5rCs15ojF?BL-}>hop=Z c6GS{fkA*BDC(3ny;)Kek{9V-kffC670c3a*V*mgE literal 0 HcmV?d00001 diff --git a/scripts/linux/download.sh b/scripts/linux/download.sh index e3c02a6..e049432 100755 --- a/scripts/linux/download.sh +++ b/scripts/linux/download.sh @@ -104,22 +104,8 @@ echo "custom_build_options:$custom_build_options" echo "================" # download opencv repo -git clone https://github.com/opencv/opencv.git +git clone https://github.com/opencv/opencv.git --depth 1 -b $opencv_version if [ "$with_contrib" = "true" ]; then # download opencv_contrib repo - git clone https://github.com/opencv/opencv_contrib.git -fi - -# checkout specific opencv version -cd opencv -git checkout tags/$opencv_version -# reset working directory -cd .. - -if [ "$with_contrib" = "true" ]; then - # checkout specific opencv_contrib version - cd opencv_contrib - git checkout tags/$opencv_version - # reset working directory - cd .. + git clone https://github.com/opencv/opencv_contrib.git --depth 1 -b $opencv_version fi \ No newline at end of file diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index a88f616..2b0fb37 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -1,10 +1,42 @@ -# Should be run with ligthdm off -#sudo service lightdm stop -wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-ubuntu1604.pin -sudo mv cuda-ubuntu1604.pin /etc/apt/preferences.d/cuda-repository-pin-600 -sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub -sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/ /" -sudo apt-get update -sudo apt-get -y install cuda -# Then restart lightdm (do not restart os before doing this) -#sudo service lightdm restart \ No newline at end of file +#!/bin/bash + +# Ensure the script is run with superuser privileges +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +# Tested inside Docker with very sparse images, where wget etc may not be installed +apt-get update +apt-get install -y lsb-release wget linux-headers-generic + +# Automatically detect the distribution and architecture +distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]')$(lsb_release -sr | tr -d '.') +raw_arch=$(dpkg --print-architecture) +if [ "$raw_arch" == "amd64" ]; then + arch="x86_64" +else + arch=$raw_arch +fi + +# From Lunar onwards, CUDA is present in the main package repo +ubuntu_version=$(echo $distro | sed s/ubuntu//g) +if [ $ubuntu_version -ge 2000 ]; then + apt-get -y install nvidia-cuda-toolkit +else + # Download the CUDA keyring package + wget "https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb" + + # Install the CUDA keyring package + dpkg -i cuda-keyring_1.1-1_all.deb + + # Update the package lists + apt-get update + + # Install CUDA + apt-get install -y cuda-toolkit + apt-get install -y nvidia-gds + + # Clean up the downloaded package + rm cuda-keyring_1.1-1_all.deb +fi \ No newline at end of file diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index 3c4c964..38b7899 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -1,5 +1,28 @@ -# uses download link secure redirect link to avoid needing to join developer program -wget -O libcudnn8_8.0.5.39-1+cuda11.1_amd64.deb https://developer.download.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/11.1_20201106/Ubuntu16_04-x64/libcudnn8_8.0.5.39-1%2Bcuda11.1_amd64.deb?pqUXol3nvqRYPFtuFMLlzzSZ2g2VZ7GD75M9Ff4BgKykVwGpUWqeZ6Y1pgYl9pLJEs58N4d44r0c72KrkvMvBmtV6-unSh9nAV32sSO1tmGiw-hJ4SaH47GV4vtLPaIs8fvaQpL2mNkL-9J-kZubgcjouZLcohT41gB5JYaaO7Wa54ltxsPYNwUEb3NYVnE6YGN9fcApPPduV8ej5Cj8NuScBvwvWRKcBW94Cq8k37f5Rg -wget -O libcudnn8-dev_8.0.5.39-1+cuda11.1_amd64.deb https://developer.download.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/11.1_20201106/Ubuntu16_04-x64/libcudnn8-dev_8.0.5.39-1%2Bcuda11.1_amd64.deb?E_1fGc1AOWyn1g1cXF5eBRqCAASR6uXAR49i5QzpMnoZDj4ug06R1WBY2ZdzuiFLxCSu0GKs5DNn7DbiTxosRvAvglGdQ1NOecY_2f7GngVemWOgy_QCRzV6ym77C0T3uKowbgHZ7OHNzjhISoN0DzM3Ic5hXiGdO4O2GRaePFxJrzBB7ABrfUMbY0X00JAEAvX2KqS_nOuk7npARzCW81PeEqzrvWWqh_HRHojOypnQ_N-WeqI -sudo dpkg -i libcudnn8_8.0.5.39-1+cuda11.1_amd64.deb -sudo dpkg -i libcudnn8-dev_8.0.5.39-1+cuda11.1_amd64.deb \ No newline at end of file +#!/bin/bash + +# Ensure the script is run with superuser privileges +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +# Tested inside Docker with very sparse images, where wget etc may not be installed +apt-get update +apt-get install -y lsb-release wget linux-headers-generic + +# Automatically detect the distribution and architecture +distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]')$(lsb_release -sr | tr -d '.') +raw_arch=$(dpkg --print-architecture) +if [ "$raw_arch" == "amd64" ]; then + arch="x86_64" +else + arch=$raw_arch +fi + +# From Lunar onwards, CUDA is present in the main package repo +ubuntu_version=$(echo $distro | sed s/ubuntu//g) +if [ $ubuntu_version -ge 2200 ]; then + apt-get -y install nvidia-cudnn +else + apt-get install -y cudnn9-cuda-12 +fi \ No newline at end of file diff --git a/scripts/windows/download.bat b/scripts/windows/download.bat index fb49ede..87e0891 100644 --- a/scripts/windows/download.bat +++ b/scripts/windows/download.bat @@ -113,25 +113,11 @@ echo custom_build_options:%custom_build_options% echo ================ :: download opencv repo -git clone https://github.com/opencv/opencv.git +git clone https://github.com/opencv/opencv.git --depth 1 -b %opencv_version% if "%with_contrib%" == "true" ( :: download opencv_contrib repo - git clone https://github.com/opencv/opencv_contrib.git -) - -:: checkout specific opencv version -cd opencv -git checkout tags/%opencv_version% -:: reset working directory -cd ..\ - -if "%with_contrib%" == "true" ( - :: checkout specific opencv_contrib version - cd opencv_contrib - git checkout tags/%opencv_version% - :: reset working directory - cd ..\ + git clone https://github.com/opencv/opencv_contrib.git --depth 1 -b %opencv_version% ) :: reset working directory From 09da0d4884049175cd04fba15e095210d233e94f Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 10:36:50 +1300 Subject: [PATCH 02/65] update workflow --- .github/workflows/build-cuda-options.yml | 33 ++++++++++++++++++++++++ .github/workflows/build-options.yml | 13 +++++----- scripts/linux/download_cudnn.sh | 12 +++++++++ 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build-cuda-options.yml diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml new file mode 100644 index 0000000..6ffa09d --- /dev/null +++ b/.github/workflows/build-cuda-options.yml @@ -0,0 +1,33 @@ +name: Build CUDA options + +on: [push] + +env: + option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt +jobs: + build-linux: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-23.04] + steps: + - uses: actions/checkout@v2 + - name: Download CUDA + working-directory: scripts/linux + run: | + sudo ./download_cuda.sh + - name: Download CUDNN + working-directory: scripts/linux + run: | + sudo ./download_cudnn.sh + - name: Download OpenCV repo/s + run: | + scripts/linux/download.sh $option_path + - name: Build OpenCV + run: | + scripts/linux/build.sh $option_path + - name: Upload build artifacts + uses: actions/upload-artifact@v2 + with: + name: Build artifact + path: install diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 95d3e14..b9fa9bb 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -2,6 +2,9 @@ name: Build non-CUDA options on: [push] +env: + option_path: options\options_opencv4.9.0_contrib_vc16.txt + jobs: build-windows: runs-on: windows-latest @@ -10,11 +13,11 @@ jobs: - name: Download OpenCV repo/s working-directory: scripts/windows shell: cmd - run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt + run: .\download.bat $option_path - name: Build OpenCV working-directory: scripts/windows shell: cmd - run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt + run: .\build.bat $option_path - name: Upload build artifacts uses: actions/upload-artifact@v2 with: @@ -29,13 +32,11 @@ jobs: steps: - uses: actions/checkout@v2 - name: Download OpenCV repo/s - working-directory: scripts/linux run: | - ./download.sh options/options_opencv4.9.0_contrib_vc16.txt + scripts/linux/download.sh $option_path - name: Build OpenCV - working-directory: scripts/linux run: | - ./build.sh options/options_opencv4.9.0_contrib_vc16.txt + scripts/linux/build.sh $option_path - name: Upload build artifacts uses: actions/upload-artifact@v2 with: diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index 38b7899..043712f 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -24,5 +24,17 @@ ubuntu_version=$(echo $distro | sed s/ubuntu//g) if [ $ubuntu_version -ge 2200 ]; then apt-get -y install nvidia-cudnn else + # Download the CUDA keyring package + wget "https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb" + + # Install the CUDA keyring package + dpkg -i cuda-keyring_1.1-1_all.deb + + # Update the package lists + apt-get update + + # Clean up the downloaded package + rm cuda-keyring_1.1-1_all.deb + apt-get install -y cudnn9-cuda-12 fi \ No newline at end of file From 9a53ed8d5ed9bf685c5a42f0ca14bb73bc8db341 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 11:38:41 +1300 Subject: [PATCH 03/65] update cuda/cudnn paths --- scripts/linux/build.sh | 4 ++++ scripts/linux/download_cuda.sh | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 7f1fa68..dcedc70 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -259,6 +259,10 @@ if [ "$custom_build_options" == "NA" ]; then $cmake_addition_build_options ../.. fi + if [ "$with_cuda" == "true" ]; then + export CUDNN_LIBRARY=/usr/local/cuda-12/lib64 + fi + # install opencv release cd $build_release_folder make -j$((`nproc`+1)) diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 2b0fb37..b80e2cb 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -21,8 +21,8 @@ fi # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) -if [ $ubuntu_version -ge 2000 ]; then - apt-get -y install nvidia-cuda-toolkit +if [ $ubuntu_version -ge 2200 ]; then + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nvidia-cuda-toolkit else # Download the CUDA keyring package wget "https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb" @@ -34,8 +34,8 @@ else apt-get update # Install CUDA - apt-get install -y cuda-toolkit - apt-get install -y nvidia-gds + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cuda-toolkit-12 + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nvidia-gds # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb From a2c177933c9b73e2320741232c775361fd840dd9 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 11:38:48 +1300 Subject: [PATCH 04/65] update workflows --- .github/workflows/build-options.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index b9fa9bb..3fb564b 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -3,7 +3,7 @@ name: Build non-CUDA options on: [push] env: - option_path: options\options_opencv4.9.0_contrib_vc16.txt + option_path: options/options_opencv4.9.0_contrib_vc16.txt jobs: build-windows: @@ -13,11 +13,11 @@ jobs: - name: Download OpenCV repo/s working-directory: scripts/windows shell: cmd - run: .\download.bat $option_path + run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt - name: Build OpenCV working-directory: scripts/windows shell: cmd - run: .\build.bat $option_path + run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt - name: Upload build artifacts uses: actions/upload-artifact@v2 with: From 994c1fb56d61c3f4b94a0e6704d84f2fedf0cf5e Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 11:45:09 +1300 Subject: [PATCH 05/65] disable cudnn in build for now --- .github/workflows/build-cuda-options.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 6ffa09d..7c98f59 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -3,7 +3,7 @@ name: Build CUDA options on: [push] env: - option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt + option_path: options/options_opencv4.9.0_contrib_cuda_vc15.txt jobs: build-linux: runs-on: ${{ matrix.os }} From 4855c579a8726831b065ffef72f02f48eb70281a Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 11:55:03 +1300 Subject: [PATCH 06/65] use gcc 10 for cuda --- scripts/linux/build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index dcedc70..c19cd94 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -259,13 +259,15 @@ if [ "$custom_build_options" == "NA" ]; then $cmake_addition_build_options ../.. fi - if [ "$with_cuda" == "true" ]; then - export CUDNN_LIBRARY=/usr/local/cuda-12/lib64 + if "$with_cuda" == "true" ]; then + export CUDNN_LIBRARY=/usr/local/cuda-12/lib64 + export CC=gcc-10 + export CXX=g++-10 fi # install opencv release cd $build_release_folder - make -j$((`nproc`+1)) + make -j$((`nproc`+1)) make install if [ "$with_debug" == "true" ]; then From 6207483fb7199fc4c39619e46b32b7a77a3b5eb4 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 12:21:06 +1300 Subject: [PATCH 07/65] attempt to patch stdlib --- .github/workflows/build-cuda-options.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 7c98f59..039266d 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -23,6 +23,9 @@ jobs: - name: Download OpenCV repo/s run: | scripts/linux/download.sh $option_path + - name: Patch stdlib + run: | + sudo sed -i '/_S_nothrow_init<.*>/ s/^/ \/\/ /' /usr/include/c++/*/bits/std_function.h - name: Build OpenCV run: | scripts/linux/build.sh $option_path From 3d2d4e7384b71b4110463637e00666bac60ff1bf Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 12:24:26 +1300 Subject: [PATCH 08/65] only use main apt repo for 2300 --- scripts/linux/download_cuda.sh | 2 +- scripts/linux/download_cudnn.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index b80e2cb..85089b3 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -21,7 +21,7 @@ fi # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) -if [ $ubuntu_version -ge 2200 ]; then +if [ $ubuntu_version -ge 2300 ]; then DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nvidia-cuda-toolkit else # Download the CUDA keyring package diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index 043712f..b2744ea 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -21,7 +21,7 @@ fi # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) -if [ $ubuntu_version -ge 2200 ]; then +if [ $ubuntu_version -ge 2300 ]; then apt-get -y install nvidia-cudnn else # Download the CUDA keyring package @@ -32,7 +32,7 @@ else # Update the package lists apt-get update - + # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb From db3db2669879aced5ad3b54b0af4794ee1e194d3 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 12:44:31 +1300 Subject: [PATCH 09/65] let's try cudnn again --- .github/workflows/build-cuda-options.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 039266d..4aeb7b1 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -3,7 +3,7 @@ name: Build CUDA options on: [push] env: - option_path: options/options_opencv4.9.0_contrib_cuda_vc15.txt + option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt jobs: build-linux: runs-on: ${{ matrix.os }} From fb3aa5d8cea02f0a5c88e24430a87998b412854a Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 12:44:41 +1300 Subject: [PATCH 10/65] simplify deps and remove jasper --- scripts/linux/build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index c19cd94..090f6fc 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -211,7 +211,7 @@ if [ "$custom_build_options" == "NA" ]; then fi # install deps - sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev + sudo apt-get install libjpeg-dev libtiff-dev libpng-dev sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get install libxvidcore-dev libx264-dev sudo apt-get install libgtk-3-dev @@ -261,8 +261,6 @@ if [ "$custom_build_options" == "NA" ]; then if "$with_cuda" == "true" ]; then export CUDNN_LIBRARY=/usr/local/cuda-12/lib64 - export CC=gcc-10 - export CXX=g++-10 fi # install opencv release From 75131d117fabe0723e50373b4fc3fedc68f9b48f Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sat, 17 Feb 2024 23:52:28 +1300 Subject: [PATCH 11/65] attempt rollback cudnn to 8 --- scripts/linux/download_cudnn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index b2744ea..4e07140 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -36,5 +36,5 @@ else # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb - apt-get install -y cudnn9-cuda-12 + apt-get install -y libcudnn8 libcudnn8-dev fi \ No newline at end of file From c3718a5ef732654cadb2274f210ed421770adfbf Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sun, 18 Feb 2024 02:12:05 +1300 Subject: [PATCH 12/65] Try to free up space on runner --- .github/workflows/build-cuda-options.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 4aeb7b1..ebddee4 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -11,6 +11,16 @@ jobs: matrix: os: [ubuntu-20.04, ubuntu-22.04, ubuntu-23.04] steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true - uses: actions/checkout@v2 - name: Download CUDA working-directory: scripts/linux From fdcb53d69dccfd6adb9d2c986d37c068778691ec Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sun, 18 Feb 2024 10:44:57 +1300 Subject: [PATCH 13/65] add badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b9b1c8a..ae41e4a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Build OpenCV +[![Build Ubuntu/CUDA](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-cuda-options.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-cuda-options.yml) +[![Build Ubuntu](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-options.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-options.yml) + Easy build OpenCV. ## Releases From 240343c40952a6720d9467961bd372d4d61b15de Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 05:43:15 +1300 Subject: [PATCH 14/65] add release task --- .github/workflows/build-cuda-options.yml | 31 ++++++++++++++++++++++-- .github/workflows/build-options.yml | 16 +++++++++++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index ebddee4..c9ba670 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -1,6 +1,6 @@ name: Build CUDA options -on: [push] +on: push env: option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt @@ -22,25 +22,52 @@ jobs: docker-images: true swap-storage: true - uses: actions/checkout@v2 + - name: Download CUDA working-directory: scripts/linux run: | sudo ./download_cuda.sh - - name: Download CUDNN + + - name: Download CUDNN8 working-directory: scripts/linux run: | sudo ./download_cudnn.sh + - name: Download OpenCV repo/s run: | scripts/linux/download.sh $option_path + + - name: Determine CUDA and cuDNN Versions + run: | + echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV + echo "CUDNN_VERSION=$(cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2 | sed 's/#define CUDNN_MAJOR //' | tr '\n' '.' | sed 's/\.$//')" >> $GITHUB_ENV + echo $CUDNN_VERSION + echo $CUDA_VERSION + - name: Patch stdlib run: | sudo sed -i '/_S_nothrow_init<.*>/ s/^/ \/\/ /' /usr/include/c++/*/bits/std_function.h + - name: Build OpenCV run: | scripts/linux/build.sh $option_path + - name: Upload build artifacts uses: actions/upload-artifact@v2 with: name: Build artifact path: install + + - name: Create Tarball + if: startsWith(github.ref, 'refs/tags/') + run: | + asset_name=opencv-${{github.ref.name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz + tar -czvf ${asset_name} -C install + echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.ASSET_NAME }} + diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 3fb564b..9986702 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -1,6 +1,6 @@ name: Build non-CUDA options -on: [push] +on: push env: option_path: options/options_opencv4.9.0_contrib_vc16.txt @@ -42,3 +42,17 @@ jobs: with: name: Build artifact path: install + + - name: Create Tarball + if: startsWith(github.ref, 'refs/tags/') + run: | + asset_name=opencv-${{github.ref.name}}-${{ matrix.os }}.tar.gz + tar -czvf ${asset_name} -C install + echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.ASSET_NAME }} + From c1496686535eb34ba95dc8d5756337173523f550 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 05:43:27 +1300 Subject: [PATCH 15/65] tidy up build/download scripts --- scripts/linux/build.sh | 16 ++++++++-------- scripts/linux/download.sh | 3 +++ scripts/linux/download_cuda.sh | 8 +++++--- scripts/linux/download_cudnn.sh | 6 +++--- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 090f6fc..aaf8930 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -1,6 +1,5 @@ #!/bin/bash -# DO NOT USE -# WORK IN PROGRESS +# Seems to work! SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" cd $SCRIPTPATH/../.. @@ -211,12 +210,13 @@ if [ "$custom_build_options" == "NA" ]; then fi # install deps - sudo apt-get install libjpeg-dev libtiff-dev libpng-dev - sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev - sudo apt-get install libxvidcore-dev libx264-dev - sudo apt-get install libgtk-3-dev - sudo apt-get install build-essential cmake pkg-config - sudo apt-get install libatlas-base-dev gfortran + export DEBIAN_FRONTEND=noninteractive + sudo apt-get install -y --no-install-recommends libjpeg-dev libtiff-dev libpng-dev + sudo apt-get install -y --no-install-recommends libavcodec-dev libavformat-dev libswscale-dev libv4l-dev + sudo apt-get install -y --no-install-recommends libxvidcore-dev libx264-dev + sudo apt-get install -y --no-install-recommends libgtk-3-dev + sudo apt-get install -y --no-install-recommends build-essential cmake pkg-config + sudo apt-get install -y --no-install-recommends libatlas-base-dev gfortran # build opencv release cd $build_release_folder diff --git a/scripts/linux/download.sh b/scripts/linux/download.sh index e049432..73ba8b9 100755 --- a/scripts/linux/download.sh +++ b/scripts/linux/download.sh @@ -103,6 +103,9 @@ echo "custom_build_options:$custom_build_options" echo "================" +# If in a container, sometimes this is not installed +apt-get install -y --no-install-recommends git + # download opencv repo git clone https://github.com/opencv/opencv.git --depth 1 -b $opencv_version if [ "$with_contrib" = "true" ]; then diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 85089b3..3b788c0 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -19,10 +19,12 @@ else arch=$raw_arch fi +export DEBIAN_FRONTEND=noninteractive + # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) if [ $ubuntu_version -ge 2300 ]; then - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nvidia-cuda-toolkit + apt-get install -y --no-install-recommends nvidia-cuda-toolkit else # Download the CUDA keyring package wget "https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb" @@ -34,8 +36,8 @@ else apt-get update # Install CUDA - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cuda-toolkit-12 - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nvidia-gds + apt-get install -y --no-install-recommends cuda-toolkit-12 + apt-get install -y --no-install-recommends nvidia-gds # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index 4e07140..c502079 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -8,7 +8,7 @@ fi # Tested inside Docker with very sparse images, where wget etc may not be installed apt-get update -apt-get install -y lsb-release wget linux-headers-generic +apt-get install -y --no-install-recommends lsb-release wget linux-headers-generic # Automatically detect the distribution and architecture distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]')$(lsb_release -sr | tr -d '.') @@ -22,7 +22,7 @@ fi # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) if [ $ubuntu_version -ge 2300 ]; then - apt-get -y install nvidia-cudnn + apt-get install --no-install-recommends -y nvidia-cudnn else # Download the CUDA keyring package wget "https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb" @@ -36,5 +36,5 @@ else # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb - apt-get install -y libcudnn8 libcudnn8-dev + apt-get install --no-install-recommends -y libcudnn8 libcudnn8-dev fi \ No newline at end of file From 7d081c8db4adc180b9e9ddc42b771ab7e692ae16 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 05:53:08 +1300 Subject: [PATCH 16/65] use containers for build --- .github/workflows/build-cuda-options.yml | 11 +++++++++-- .github/workflows/build-options.yml | 12 ++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index c9ba670..7ddeae3 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -6,10 +6,12 @@ env: option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt jobs: build-linux: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-20.04, ubuntu-22.04, ubuntu-23.04] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04"] + container: + image: ${{matrix.os}} steps: - name: Free Disk Space (Ubuntu) uses: jlumbroso/free-disk-space@main @@ -22,6 +24,11 @@ jobs: docker-images: true swap-storage: true - uses: actions/checkout@v2 + + - name: Setup things in container + run: | + apt update + apt install -y sudo wget git build-essential - name: Download CUDA working-directory: scripts/linux diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 9986702..9ab9bb4 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -25,11 +25,19 @@ jobs: path: install build-linux: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-20.04, ubuntu-22.04, ubuntu-23.04] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04"] + container: + image: ${{matrix.os}} + options: --privileged steps: + - name: Setup things in container + run: | + apt update + apt install -y sudo wget git build-essential + - uses: actions/checkout@v2 - name: Download OpenCV repo/s run: | From 321741624ce57e021b5ca2c53601339db6309d30 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 06:12:42 +1300 Subject: [PATCH 17/65] non-interactive for cudnn --- scripts/linux/download_cudnn.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index c502079..5d90baa 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -8,7 +8,7 @@ fi # Tested inside Docker with very sparse images, where wget etc may not be installed apt-get update -apt-get install -y --no-install-recommends lsb-release wget linux-headers-generic +apt-get install -y --no-install-recommends lsb-release wget linux-headers-generic debconf-utils # Automatically detect the distribution and architecture distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]')$(lsb_release -sr | tr -d '.') @@ -19,9 +19,14 @@ else arch=$raw_arch fi +export DEBIAN_FRONTEND=noninteractive + # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) if [ $ubuntu_version -ge 2300 ]; then + #echo "nvidia-cudnn nvidia-cudnn/license note" | sudo debconf-set-selections + #echo "nvidia-cudnn nvidia-cudnn/question select I Agree" | sudo debconf-set-selections + apt-get install --no-install-recommends -y nvidia-cudnn else # Download the CUDA keyring package From fbdfc280c49f1a39cfa32dc9568ba952c0c48428 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 06:26:19 +1300 Subject: [PATCH 18/65] manually specify CUDA compute targets --- scripts/linux/build.sh | 6 +++++- scripts/linux/download_cudnn.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index aaf8930..2e73425 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -227,7 +227,9 @@ if [ "$custom_build_options" == "NA" ]; then -D BUILD_opencv_world=$cmake_build_world \ -D WITH_CUDA=$cmake_with_cuda \ -D ENABLE_FAST_MATH=$cmake_enable_fast_math \ - -D CUDA_FAST_MATH=$cmake_cuda_fast_math \ + -D CUDA_FAST_MATH=$cmake_cuda_fast_math \\ + -D CUDA_ARCH_BIN="5.0 5.2 6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0" \ + -D CUDA_ARCH_PTX="9.0" \ -D WITH_CUBLAS=$cmake_with_cublas \ -D WITH_FFMPEG=1 \ -D INSTALL_PYTHON_EXAMPLES=$cmake_build_python_release_examples \ @@ -249,6 +251,8 @@ if [ "$custom_build_options" == "NA" ]; then -D ENABLE_FAST_MATH=$cmake_enable_fast_math \ -D CUDA_FAST_MATH=$cmake_cuda_fast_math \ -D WITH_CUBLAS=$cmake_with_cublas \ + -D CUDA_ARCH_BIN="5.0 5.2 6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0" \ + -D CUDA_ARCH_PTX="9.0" \ -D WITH_FFMPEG=1 \ -D INSTALL_PYTHON_EXAMPLES=$cmake_build_python_debug_examples \ -D OPENCV_EXTRA_MODULES_PATH=$cmake_extra_modules_path \ diff --git a/scripts/linux/download_cudnn.sh b/scripts/linux/download_cudnn.sh index 5d90baa..02bd36c 100755 --- a/scripts/linux/download_cudnn.sh +++ b/scripts/linux/download_cudnn.sh @@ -24,8 +24,8 @@ export DEBIAN_FRONTEND=noninteractive # From Lunar onwards, CUDA is present in the main package repo ubuntu_version=$(echo $distro | sed s/ubuntu//g) if [ $ubuntu_version -ge 2300 ]; then - #echo "nvidia-cudnn nvidia-cudnn/license note" | sudo debconf-set-selections - #echo "nvidia-cudnn nvidia-cudnn/question select I Agree" | sudo debconf-set-selections + echo "nvidia-cudnn nvidia-cudnn/license note" | sudo debconf-set-selections + echo "nvidia-cudnn nvidia-cudnn/question select I Agree" | sudo debconf-set-selections apt-get install --no-install-recommends -y nvidia-cudnn else From 32df1f61270d2898e104d4236b7de49ed0cba0e4 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 06:31:08 +1300 Subject: [PATCH 19/65] add 23.10 --- .github/workflows/build-cuda-options.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 7ddeae3..49ec99a 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04"] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04", "ubuntu:23.10"] container: image: ${{matrix.os}} steps: From e7aea85e207f2f3ba1459810b8e0decc8786398f Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 06:38:20 +1300 Subject: [PATCH 20/65] use gcc-11 --- scripts/linux/build.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 2e73425..6edeb18 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -216,11 +216,13 @@ if [ "$custom_build_options" == "NA" ]; then sudo apt-get install -y --no-install-recommends libxvidcore-dev libx264-dev sudo apt-get install -y --no-install-recommends libgtk-3-dev sudo apt-get install -y --no-install-recommends build-essential cmake pkg-config - sudo apt-get install -y --no-install-recommends libatlas-base-dev gfortran + sudo apt-get install -y --no-install-recommends libatlas-base-dev gfortran gcc-11 g++-11 # build opencv release cd $build_release_folder - + + export CC=gcc-11 + export CXX=g++-11 cmake \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=$install_release_folder \ From 08b212f49df0b102e64d6191d41ccf1b2c9a1b97 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 06:56:42 +1300 Subject: [PATCH 21/65] update windows --- .github/workflows/build-cuda-options.yml | 27 ++++++++++++++++++++++-- .github/workflows/build-options.yml | 5 ++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 49ec99a..28f9dac 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -4,7 +4,30 @@ on: push env: option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt -jobs: +jobs: + build-windows: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - uses: Jimver/cuda-toolkit@v0.2.14 + id: cuda-toolkit + with: + cuda: '12.3.2' + - uses: ilammy/msvc-dev-cmd@v1.4.1 + with: + toolset: 16.0 + + - name: Download OpenCV repo/s + working-directory: scripts/windows + shell: cmd + run: .\download.bat options\options_opencv4.9.0_contrib_cuda_vc16.txt + + - name: Build OpenCV + working-directory: scripts/windows + shell: cmd + run: .\build.bat options\options_opencv4.9.0_contrib_cuda_vc16.txt + + build-linux: runs-on: ubuntu-latest strategy: @@ -47,7 +70,7 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV - echo "CUDNN_VERSION=$(cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2 | sed 's/#define CUDNN_MAJOR //' | tr '\n' '.' | sed 's/\.$//')" >> $GITHUB_ENV + echo "CUDNN_VERSION=$(cat /usr/include/x86_64-linux-gnu/cudnn_version.h | grep CUDNN_MAJOR -A 2 | sed 's/#define CUDNN_MAJOR //' | tr '\n' '.' | sed 's/\.$//')" >> $GITHUB_ENV echo $CUDNN_VERSION echo $CUDA_VERSION diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 9ab9bb4..6f45009 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -9,6 +9,9 @@ jobs: build-windows: runs-on: windows-latest steps: + - uses: ilammy/msvc-dev-cmd@v1.4.1 + with: + toolset: 16.0 - uses: actions/checkout@v2 - name: Download OpenCV repo/s working-directory: scripts/windows @@ -28,7 +31,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04"] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04", "ubuntu:23.10"] container: image: ${{matrix.os}} options: --privileged From 5bbb7f5ac982188d3d5de49846c98c06c13450bf Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 08:36:45 +1300 Subject: [PATCH 22/65] remove windows cuda for now --- .github/workflows/build-cuda-options.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 28f9dac..37556ab 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -5,29 +5,6 @@ on: push env: option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt jobs: - build-windows: - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - uses: Jimver/cuda-toolkit@v0.2.14 - id: cuda-toolkit - with: - cuda: '12.3.2' - - uses: ilammy/msvc-dev-cmd@v1.4.1 - with: - toolset: 16.0 - - - name: Download OpenCV repo/s - working-directory: scripts/windows - shell: cmd - run: .\download.bat options\options_opencv4.9.0_contrib_cuda_vc16.txt - - - name: Build OpenCV - working-directory: scripts/windows - shell: cmd - run: .\build.bat options\options_opencv4.9.0_contrib_cuda_vc16.txt - - build-linux: runs-on: ubuntu-latest strategy: From 08d5c8875826cbd1696249a29f61ae253c7ee3de Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 08:38:19 +1300 Subject: [PATCH 23/65] update readme --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ae41e4a..2f6c17d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ Easy build OpenCV. ## Releases To save you some time checkout if the pre-built opencv binaries in releases of this repo for the configuration you are looking for first! [Releases](https://github.com/i3drobotics/build_opencv/releases) +These releases are built via Github's CI for various operating systems (currently Ubuntu with CUDA support). + ## About Scripts are provided in this repository to make building opencv from source simple and pain free. While a lot of the options provided here are the same as running cmake this approach helps to avoid missing to tick an important box or getting a path wrong by providing options in an easy to read text file. Also each option is documented in this readme along with some notes on possible issues associated with it. @@ -17,7 +19,7 @@ While a lot of the options provided here are the same as running cmake this appr - visual studio ## Run -Use the 'run.bat' script to download and build opencv. One script does everything!. This will use the options defined in 'options.txt' to define what to download and build. Once complete a folder named 'install' will have the full opencv install. +Use the 'run.bat' script to download and build opencv. One script does everything!. This will use the options defined in 'options.txt' to define what to download and build. Once complete a folder named 'install' will have the full opencv install. ## Download Use the 'download.bat' script to download opencv. This will use the options defined in 'options.txt' to define what to download. Once complete opencv (and opencv_contrib if required) will be downloaded and ready to build. @@ -79,6 +81,9 @@ As python does not include debug dlls by default when installed a debug build of The python version will automatically be selected from whatever is installed. This is handelled internally by the opencv cmake. ### What version of CUDA is used in opencv builds CUDA version is selected automically based on whatever is installed. This is handelled insternally by the opencv cmake. + +For CI builds with Ubuntu, we choose CUDA builds that are available through package managers. On recent versions of Ubuntu (e.g. 23.04+), CUDA 12 is directly available through apt. CUDNN 8 is currently selected for compatibility. + ### Can this be used with other OS All the scripts in the repository are currently Windows batch files. This will be extended to other languages soon. Work has been started on linux scripts however they are not currently ready to use. (Checkout scripts/linux to see the current progress) ### Where is java From afc15c8970db98db48ea4ff552c824822b6f01f7 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 08:38:49 +1300 Subject: [PATCH 24/65] add fix for tzdata if needed --- .github/workflows/build-cuda-options.yml | 9 ++++++--- .github/workflows/build-options.yml | 9 ++++++--- scripts/linux/build.sh | 13 ++++++++++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 37556ab..85f9725 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -27,9 +27,12 @@ jobs: - name: Setup things in container run: | - apt update - apt install -y sudo wget git build-essential - + apt-get update + apt-get install -y --no-install-recommends sudo wget git build-essential debconf-utils apt-utils dialog + echo 'tzdata tzdata/Areas select Etc' | sudo debconf-set-selections + echo 'tzdata tzdata/Zones/Etc select UTC' | sudo debconf-set-selections + DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata + - name: Download CUDA working-directory: scripts/linux run: | diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 6f45009..f372aef 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -7,7 +7,7 @@ env: jobs: build-windows: - runs-on: windows-latest + runs-on: windows-2019 steps: - uses: ilammy/msvc-dev-cmd@v1.4.1 with: @@ -38,8 +38,11 @@ jobs: steps: - name: Setup things in container run: | - apt update - apt install -y sudo wget git build-essential + apt-get update + apt-get install -y --no-install-recommends sudo wget git build-essential debconf-utils apt-utils dialog ca-certificates + echo 'tzdata tzdata/Areas select Etc' | sudo debconf-set-selections + echo 'tzdata tzdata/Zones/Etc select UTC' | sudo debconf-set-selections + DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata - uses: actions/checkout@v2 - name: Download OpenCV repo/s diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 6edeb18..c31f243 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -211,18 +211,25 @@ if [ "$custom_build_options" == "NA" ]; then # install deps export DEBIAN_FRONTEND=noninteractive + sudo apt-get install -y --no-install-recommends libjpeg-dev libtiff-dev libpng-dev sudo apt-get install -y --no-install-recommends libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get install -y --no-install-recommends libxvidcore-dev libx264-dev sudo apt-get install -y --no-install-recommends libgtk-3-dev sudo apt-get install -y --no-install-recommends build-essential cmake pkg-config - sudo apt-get install -y --no-install-recommends libatlas-base-dev gfortran gcc-11 g++-11 + sudo apt-get install -y --no-install-recommends libatlas-base-dev gfortran # build opencv release cd $build_release_folder - export CC=gcc-11 - export CXX=g++-11 + GCC_VERSION=$(gcc -dumpversion | cut -d. -f1) + if [[ "$GCC_VERSION" -gt 11 ]]; then + sudo apt-get install -y --no-install-recommends gcc-11 g++-11 + echo "Setting GCC to version 11" + export CC=gcc-11 + export CXX=g++-11 + fi + cmake \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=$install_release_folder \ From 8031e2fff9a578faad854888de617f811dd90b7a Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 19 Feb 2024 09:20:13 +1300 Subject: [PATCH 25/65] try windows again with 2019 --- .github/workflows/build-cuda-options.yml | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 85f9725..fc0cd9c 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -5,6 +5,29 @@ on: push env: option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt jobs: + build-windows: + runs-on: windows-2019 + steps: + - uses: ilammy/msvc-dev-cmd@v1.4.1 + with: + toolset: 16.0 + - uses: Jimver/cuda-toolkit@v0.2.14 + id: cuda-toolkit + - uses: actions/checkout@v2 + - name: Download OpenCV repo/s + working-directory: scripts/windows + shell: cmd + run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt + - name: Build OpenCV + working-directory: scripts/windows + shell: cmd + run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt + - name: Upload build artifacts + uses: actions/upload-artifact@v2 + with: + name: Build artifact + path: install + build-linux: runs-on: ubuntu-latest strategy: @@ -28,7 +51,7 @@ jobs: - name: Setup things in container run: | apt-get update - apt-get install -y --no-install-recommends sudo wget git build-essential debconf-utils apt-utils dialog + apt-get install -y --no-install-recommends sudo wget git build-essential debconf-utils apt-utils dialog ca-certificates echo 'tzdata tzdata/Areas select Etc' | sudo debconf-set-selections echo 'tzdata tzdata/Zones/Etc select UTC' | sudo debconf-set-selections DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata From 0a6db24c382a9b9d46e3955ea6b975f22f39c790 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Tue, 20 Feb 2024 05:39:59 +1300 Subject: [PATCH 26/65] remove upload tarball as runner runs out of space --- .github/workflows/build-cuda-options.yml | 23 ++++++++++------------- .github/workflows/build-options.yml | 11 +---------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index fc0cd9c..605d212 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -8,11 +8,13 @@ jobs: build-windows: runs-on: windows-2019 steps: - - uses: ilammy/msvc-dev-cmd@v1.4.1 - with: - toolset: 16.0 + - name: Set up MSBuild path + uses: microsoft/setup-msbuild@v1.0.2 - uses: Jimver/cuda-toolkit@v0.2.14 id: cuda-toolkit + with: + sub-packages: '["nvcc"]' + non-cuda-sub-packages: '["libcublas"]' - uses: actions/checkout@v2 - name: Download OpenCV repo/s working-directory: scripts/windows @@ -22,11 +24,12 @@ jobs: working-directory: scripts/windows shell: cmd run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt - - name: Upload build artifacts - uses: actions/upload-artifact@v2 + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 with: - name: Build artifact - path: install + files: install build-linux: runs-on: ubuntu-latest @@ -85,12 +88,6 @@ jobs: run: | scripts/linux/build.sh $option_path - - name: Upload build artifacts - uses: actions/upload-artifact@v2 - with: - name: Build artifact - path: install - - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index f372aef..161c031 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -21,11 +21,7 @@ jobs: working-directory: scripts/windows shell: cmd run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt - - name: Upload build artifacts - uses: actions/upload-artifact@v2 - with: - name: Build artifact - path: install + build-linux: runs-on: ubuntu-latest @@ -51,11 +47,6 @@ jobs: - name: Build OpenCV run: | scripts/linux/build.sh $option_path - - name: Upload build artifacts - uses: actions/upload-artifact@v2 - with: - name: Build artifact - path: install - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') From c2757480603cccbf8816b7d8c57f7afdd7341de7 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Tue, 20 Feb 2024 05:50:05 +1300 Subject: [PATCH 27/65] don't specify cuda subpackages, install everything --- .github/workflows/build-cuda-options.yml | 3 --- .github/workflows/build-options.yml | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/build-cuda-options.yml index 605d212..530a046 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/build-cuda-options.yml @@ -12,9 +12,6 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 - uses: Jimver/cuda-toolkit@v0.2.14 id: cuda-toolkit - with: - sub-packages: '["nvcc"]' - non-cuda-sub-packages: '["libcublas"]' - uses: actions/checkout@v2 - name: Download OpenCV repo/s working-directory: scripts/windows diff --git a/.github/workflows/build-options.yml b/.github/workflows/build-options.yml index 161c031..aa2a6ce 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/build-options.yml @@ -9,9 +9,8 @@ jobs: build-windows: runs-on: windows-2019 steps: - - uses: ilammy/msvc-dev-cmd@v1.4.1 - with: - toolset: 16.0 + - name: Set up MSBuild path + uses: microsoft/setup-msbuild@v1.0.2 - uses: actions/checkout@v2 - name: Download OpenCV repo/s working-directory: scripts/windows From f9878accdc40307c288ca0e7516304dc7c42caf6 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Tue, 20 Feb 2024 06:27:58 +1300 Subject: [PATCH 28/65] split out linux and windows --- ...{build-cuda-options.yml => linux-cuda.yml} | 27 +-------- .../{build-options.yml => linux.yml} | 20 +------ .github/workflows/windows-cuda.yml | 57 +++++++++++++++++++ .github/workflows/windows.yml | 22 +++++++ 4 files changed, 83 insertions(+), 43 deletions(-) rename .github/workflows/{build-cuda-options.yml => linux-cuda.yml} (74%) rename .github/workflows/{build-options.yml => linux.yml} (72%) create mode 100644 .github/workflows/windows-cuda.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/build-cuda-options.yml b/.github/workflows/linux-cuda.yml similarity index 74% rename from .github/workflows/build-cuda-options.yml rename to .github/workflows/linux-cuda.yml index 530a046..e133821 100644 --- a/.github/workflows/build-cuda-options.yml +++ b/.github/workflows/linux-cuda.yml @@ -1,38 +1,15 @@ -name: Build CUDA options +name: Build Linux CUDA/Cudnn on: push env: option_path: options/options_opencv4.9.0_contrib_cuda_cudnn_vc15.txt jobs: - build-windows: - runs-on: windows-2019 - steps: - - name: Set up MSBuild path - uses: microsoft/setup-msbuild@v1.0.2 - - uses: Jimver/cuda-toolkit@v0.2.14 - id: cuda-toolkit - - uses: actions/checkout@v2 - - name: Download OpenCV repo/s - working-directory: scripts/windows - shell: cmd - run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt - - name: Build OpenCV - working-directory: scripts/windows - shell: cmd - run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt - - - name: Upload Release Asset - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: install - build-linux: runs-on: ubuntu-latest strategy: matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04", "ubuntu:23.10"] + os: ["ubuntu:20.04","ubuntu:22.04", "ubuntu:23.04", "ubuntu:23.10"] container: image: ${{matrix.os}} steps: diff --git a/.github/workflows/build-options.yml b/.github/workflows/linux.yml similarity index 72% rename from .github/workflows/build-options.yml rename to .github/workflows/linux.yml index aa2a6ce..09729fd 100644 --- a/.github/workflows/build-options.yml +++ b/.github/workflows/linux.yml @@ -1,27 +1,11 @@ -name: Build non-CUDA options +name: Build Linux on: push env: option_path: options/options_opencv4.9.0_contrib_vc16.txt -jobs: - build-windows: - runs-on: windows-2019 - steps: - - name: Set up MSBuild path - uses: microsoft/setup-msbuild@v1.0.2 - - uses: actions/checkout@v2 - - name: Download OpenCV repo/s - working-directory: scripts/windows - shell: cmd - run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt - - name: Build OpenCV - working-directory: scripts/windows - shell: cmd - run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt - - +jobs: build-linux: runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml new file mode 100644 index 0000000..90d65be --- /dev/null +++ b/.github/workflows/windows-cuda.yml @@ -0,0 +1,57 @@ +name: Build Windows CUDA + +on: push + +jobs: + build-windows: + runs-on: windows-2019 + env: + CUDNN_URL: https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.7/local_installers/12.x/cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip + steps: + + - name: Set up MSBuild path + uses: microsoft/setup-msbuild@v1.0.2 + + - uses: Jimver/cuda-toolkit@v0.2.14 + id: cuda-toolkit + + - name: Download cuDNN Archive + shell: powershell + run: | + curl -L "${{ env.CUDNN_URL }}" -o cudnn.zip + + - name: Extract cuDNN Archive + shell: powershell + run: | + Expand-Archive -Path cudnn.zip -DestinationPath .\cudnn + + - name: Copy cuDNN files + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path "C:\Program Files\NVIDIA\CUDNN\v8.x" + Copy-Item -Path .\cudnn\bin\* -Destination "C:\Program Files\NVIDIA\CUDNN\v8.x\bin" -Recurse -Force + Copy-Item -Path .\cudnn\include\* -Destination "C:\Program Files\NVIDIA\CUDNN\v8.x\include" -Recurse -Force + Copy-Item -Path .\cudnn\lib\x64\* -Destination "C:\Program Files\NVIDIA\CUDNN\v8.x\lib\x64" -Recurse -Force + + - name: Set PATH Environment Variable + run: | + echo "C:\Program Files\NVIDIA\CUDNN\v8.x\bin" | Out-File -Append -FilePath $env:GITHUB_PATH + echo "C:\Program Files\NVIDIA\CUDNN\v8.x\lib\x64" | Out-File -Append -FilePath $env:GITHUB_PATH + + - uses: actions/checkout@v2 + + - name: Download OpenCV repo/s + working-directory: scripts/windows + shell: cmd + run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt + + - name: Build OpenCV + working-directory: scripts/windows + shell: cmd + run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: install \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..3ec7b15 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,22 @@ +name: Build Windows + +on: push + +jobs: + build-windows: + runs-on: "windows-2019" + steps: + - name: Set up MSBuild path + uses: microsoft/setup-msbuild@v1.0.2 + + - uses: actions/checkout@v2 + + - name: Download OpenCV repo/s + working-directory: scripts/windows + shell: cmd + run: .\download.bat options\options_opencv4.9.0_contrib_vc16.txt + + - name: Build OpenCV + working-directory: scripts/windows + shell: cmd + run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt From 2335ee4ed5eeb8545d8501ce48aa25a242dcc63f Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Tue, 20 Feb 2024 06:55:21 +1300 Subject: [PATCH 29/65] attempt to use local cudnn installer --- .github/workflows/windows-cuda.yml | 32 ++++++++---------------------- README.md | 11 ++++++---- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 90d65be..55ecc56 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -6,37 +6,21 @@ jobs: build-windows: runs-on: windows-2019 env: - CUDNN_URL: https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.7/local_installers/12.x/cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip + CUDNN_URL: https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn_8.8.0.121_windows.exe steps: - name: Set up MSBuild path uses: microsoft/setup-msbuild@v1.0.2 - - uses: Jimver/cuda-toolkit@v0.2.14 - id: cuda-toolkit + - name: Download cuDNN installer + run: Invoke-WebRequest -Uri "${{ env.CUDNN_URL }}" -OutFile "cudnn_installer.exe" - - name: Download cuDNN Archive - shell: powershell - run: | - curl -L "${{ env.CUDNN_URL }}" -o cudnn.zip + - name: Install cuDNN + run: Start-Process -FilePath "cudnn_installer.exe" -ArgumentList '/S' -Wait - - name: Extract cuDNN Archive - shell: powershell - run: | - Expand-Archive -Path cudnn.zip -DestinationPath .\cudnn - - - name: Copy cuDNN files - shell: powershell - run: | - New-Item -ItemType Directory -Force -Path "C:\Program Files\NVIDIA\CUDNN\v8.x" - Copy-Item -Path .\cudnn\bin\* -Destination "C:\Program Files\NVIDIA\CUDNN\v8.x\bin" -Recurse -Force - Copy-Item -Path .\cudnn\include\* -Destination "C:\Program Files\NVIDIA\CUDNN\v8.x\include" -Recurse -Force - Copy-Item -Path .\cudnn\lib\x64\* -Destination "C:\Program Files\NVIDIA\CUDNN\v8.x\lib\x64" -Recurse -Force - - - name: Set PATH Environment Variable - run: | - echo "C:\Program Files\NVIDIA\CUDNN\v8.x\bin" | Out-File -Append -FilePath $env:GITHUB_PATH - echo "C:\Program Files\NVIDIA\CUDNN\v8.x\lib\x64" | Out-File -Append -FilePath $env:GITHUB_PATH + - name: Install CUDA + uses: Jimver/cuda-toolkit@v0.2.14 + id: cuda-toolkit - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 2f6c17d..0b155c5 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,16 @@ # Build OpenCV -[![Build Ubuntu/CUDA](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-cuda-options.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-cuda-options.yml) -[![Build Ubuntu](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-options.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/build-options.yml) +[![Build Linux](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/linux.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/linux.yml) +[![Build Linux CUDA/Cudnn](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/linux-cuda.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/linux-cuda.yml) -Easy build OpenCV. +[![Build Windows](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/windows.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/windows.yml) +[![Build Windows CUDA](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/windows-cuda.yml/badge.svg?branch=auto_release)](https://github.com/jveitchmichaelis/build_opencv/actions/workflows/windows-cuda.yml) + +Easy-build OpenCV. ## Releases To save you some time checkout if the pre-built opencv binaries in releases of this repo for the configuration you are looking for first! [Releases](https://github.com/i3drobotics/build_opencv/releases) -These releases are built via Github's CI for various operating systems (currently Ubuntu with CUDA support). +These releases are built via Github's CI for various operating systems (currently Ubuntu and Windows with CUDA and Cudnn support). Mac builds are not currently provided as Homebrew generally provides a good install experience, and CUDA support is generaly not relevant on OS X. ## About Scripts are provided in this repository to make building opencv from source simple and pain free. From 02ea2745a67b2cca66a9432a2a821a3dcc00a8ff Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Tue, 20 Feb 2024 07:02:28 +1300 Subject: [PATCH 30/65] drop cudnn on windows until we can figure out how to do it headless --- .github/workflows/windows-cuda.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 55ecc56..7bbece6 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -12,11 +12,11 @@ jobs: - name: Set up MSBuild path uses: microsoft/setup-msbuild@v1.0.2 - - name: Download cuDNN installer - run: Invoke-WebRequest -Uri "${{ env.CUDNN_URL }}" -OutFile "cudnn_installer.exe" + #- name: Download cuDNN installer + # run: Invoke-WebRequest -Uri "${{ env.CUDNN_URL }}" -OutFile "cudnn_installer.exe" - - name: Install cuDNN - run: Start-Process -FilePath "cudnn_installer.exe" -ArgumentList '/S' -Wait + #- name: Install cuDNN + # run: Start-Process -FilePath "cudnn_installer.exe" -ArgumentList '/S' -Wait - name: Install CUDA uses: Jimver/cuda-toolkit@v0.2.14 From f86f7c58c4b6b93ad99892fe690dedd2215fa936 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Tue, 20 Feb 2024 16:04:01 +0000 Subject: [PATCH 31/65] Update CUDA compute targets in build.bat --- scripts/windows/build.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/windows/build.bat b/scripts/windows/build.bat index e34f67d..69ffdf4 100644 --- a/scripts/windows/build.bat +++ b/scripts/windows/build.bat @@ -233,6 +233,7 @@ if "%custom_build_options%" == "NA" ( -D ENABLE_FAST_MATH=!cmake_enable_fast_math! ^ -D CUDA_FAST_MATH=!cmake_cuda_fast_math! ^ -D WITH_CUBLAS=!cmake_with_cublas! ^ + -D CUDA_ARCH_BIN="6.1 7.0 7.5 8.0 8.6" ^ -D INSTALL_PYTHON_EXAMPLES=!cmake_build_python_release_examples! ^ -D OPENCV_EXTRA_MODULES_PATH=!cmake_extra_modules_path! ^ -D BUILD_opencv_python=!cmake_python_release! ^ @@ -252,6 +253,7 @@ if "%custom_build_options%" == "NA" ( -D ENABLE_FAST_MATH=!cmake_enable_fast_math! ^ -D CUDA_FAST_MATH=!cmake_cuda_fast_math! ^ -D WITH_CUBLAS=!cmake_with_cublas! ^ + -D CUDA_ARCH_BIN="6.1 7.0 7.5 8.0 8.6" ^ -D INSTALL_PYTHON_EXAMPLES=!cmake_build_python_debug_examples! ^ -D OPENCV_EXTRA_MODULES_PATH=!cmake_extra_modules_path! ^ -D BUILD_opencv_python=!cmake_python_debug! ^ @@ -280,4 +282,4 @@ if "%custom_build_options%" == "NA" ( :: reset working directory cd %initcwd% -endlocal \ No newline at end of file +endlocal From c8068c128da2a1031c98c997198be800fe2f9cd0 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Wed, 21 Feb 2024 10:09:13 +1300 Subject: [PATCH 32/65] test archiving --- .github/workflows/linux-cuda.yml | 14 ++++++++++++-- .github/workflows/linux.yml | 14 ++++++++++++-- .github/workflows/windows-cuda.yml | 23 ++++++++++++++++++++++- .github/workflows/windows.yml | 20 ++++++++++++++++++++ 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index e133821..7b4122b 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -62,11 +62,16 @@ jobs: run: | scripts/linux/build.sh $option_path + - name: Remove build folder + uses: JesseTG/rm@v1.0.3 + with: + path: build + - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref.name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz - tar -czvf ${asset_name} -C install + tar -czvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV - name: Upload Release Asset @@ -74,4 +79,9 @@ jobs: uses: softprops/action-gh-release@v1 with: files: ${{ env.ASSET_NAME }} - + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 09729fd..0ae5d03 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -31,11 +31,16 @@ jobs: run: | scripts/linux/build.sh $option_path + - name: Remove build folder + uses: JesseTG/rm@v1.0.3 + with: + path: build + - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref.name}}-${{ matrix.os }}.tar.gz - tar -czvf ${asset_name} -C install + tar -czvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV - name: Upload Release Asset @@ -43,4 +48,9 @@ jobs: uses: softprops/action-gh-release@v1 with: files: ${{ env.ASSET_NAME }} - + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 7bbece6..21181ad 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -34,8 +34,29 @@ jobs: shell: cmd run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt + - name: Remove build folder + uses: JesseTG/rm@v1.0.3 + with: + path: build + + - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref.name}}-windows-cuda12.zip + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: install + - name: Upload Release Asset if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: - files: install \ No newline at end of file + files: opencv-${{github.ref.name}}-windows-cuda12.zip + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3ec7b15..d6b1405 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,3 +20,23 @@ jobs: working-directory: scripts/windows shell: cmd run: .\build.bat options\options_opencv4.9.0_contrib_vc16.txt + + - name: Remove build folder + uses: JesseTG/rm@v1.0.3 + with: + path: build + + - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref.name}}-windows.zip + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: opencv-${{github.ref.name}}-windows.zip + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From 91904848e90aeeb35b6d70d8f8283bf837f92ec4 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Wed, 21 Feb 2024 11:21:20 +1300 Subject: [PATCH 33/65] fix ref name --- .github/workflows/linux-cuda.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/windows-cuda.yml | 4 ++-- .github/workflows/windows.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 7b4122b..cca3276 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -70,7 +70,7 @@ jobs: - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | - asset_name=opencv-${{github.ref.name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz + asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz tar -czvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0ae5d03..8c2d3a3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -39,7 +39,7 @@ jobs: - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | - asset_name=opencv-${{github.ref.name}}-${{ matrix.os }}.tar.gz + asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}.tar.gz tar -czvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 21181ad..f311624 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -39,7 +39,7 @@ jobs: with: path: build - - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref.name}}-windows-cuda12.zip + - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref_name}}-windows-cuda12.zip - name: Upload Release Asset if: startsWith(github.ref, 'refs/tags/') @@ -51,7 +51,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: - files: opencv-${{github.ref.name}}-windows-cuda12.zip + files: opencv-${{github.ref_name}}-windows-cuda12.zip tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} draft: false diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d6b1405..5d9283c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -32,7 +32,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: - files: opencv-${{github.ref.name}}-windows.zip + files: opencv-${{github.ref_name}}-windows.zip tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} draft: false From a9d61674c17819748f10a04737deb73314435360 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Wed, 21 Feb 2024 23:16:10 +1300 Subject: [PATCH 34/65] update archiving --- .github/workflows/linux-cuda.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/windows-cuda.yml | 6 ------ .github/workflows/windows.yml | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index cca3276..036b66a 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -71,7 +71,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz - tar -czvf ${asset_name} install + tar -cvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV - name: Upload Release Asset diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8c2d3a3..5f39443 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -40,7 +40,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}.tar.gz - tar -czvf ${asset_name} install + tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV - name: Upload Release Asset diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index f311624..7449aeb 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -41,12 +41,6 @@ jobs: - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref_name}}-windows-cuda12.zip - - name: Upload Release Asset - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: install - - name: Upload Release Asset if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5d9283c..f0680fc 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -26,7 +26,7 @@ jobs: with: path: build - - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref.name}}-windows.zip + - run: Compress-Archive -Path install/* -Destination opencv-${{github.ref_name}}-windows.zip - name: Upload Release Asset if: startsWith(github.ref, 'refs/tags/') From 7ffca92cea48d56a2b3dea3be8043ceb959e02f5 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Wed, 21 Feb 2024 23:39:27 +1300 Subject: [PATCH 35/65] fix colons in tar path --- .github/workflows/linux-cuda.yml | 1 + .github/workflows/linux.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 036b66a..a1b6077 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -71,6 +71,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz + asset_name=${asset_name//:/-} # Replace colons with dashes tar -cvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5f39443..2bdbfc9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -40,6 +40,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}.tar.gz + asset_name=${asset_name//:/-} # Replace colons with dashes tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV From f033e19fdec6047946f25907b0a2767e59f3e8e2 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 22 Feb 2024 00:08:23 +1300 Subject: [PATCH 36/65] fix colon replace --- .github/workflows/linux-cuda.yml | 2 +- .github/workflows/linux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index a1b6077..f4e16da 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -71,7 +71,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz - asset_name=${asset_name//:/-} # Replace colons with dashes + asset_name=$(echo $asset_name | sed 's/:/-/g') tar -cvf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 2bdbfc9..4ae30f9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -40,7 +40,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}.tar.gz - asset_name=${asset_name//:/-} # Replace colons with dashes + asset_name=$(echo $asset_name | sed 's/:/-/g') tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV From 3c84b9c8fa47d9d662420c979e43ae3998f740c6 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 22 Feb 2024 10:39:30 +1300 Subject: [PATCH 37/65] fix tar tags --- .github/workflows/linux-cuda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index f4e16da..13b04da 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -72,7 +72,7 @@ jobs: run: | asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz asset_name=$(echo $asset_name | sed 's/:/-/g') - tar -cvf ${asset_name} install + tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV - name: Upload Release Asset From ef6bcec5b31625c6960448fbf5c035d871b3a9d2 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 22 Feb 2024 10:11:41 +0000 Subject: [PATCH 38/65] update cudnn version extraction --- .github/workflows/linux-cuda.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 13b04da..b36ba8b 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -50,9 +50,7 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV - echo "CUDNN_VERSION=$(cat /usr/include/x86_64-linux-gnu/cudnn_version.h | grep CUDNN_MAJOR -A 2 | sed 's/#define CUDNN_MAJOR //' | tr '\n' '.' | sed 's/\.$//')" >> $GITHUB_ENV - echo $CUDNN_VERSION - echo $CUDA_VERSION + echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | cut -d- -f1)" >> $GITHUB_ENV - name: Patch stdlib run: | From bad07940e9a7076d75d96690c054f776bd459dc7 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 22 Feb 2024 23:28:33 +1300 Subject: [PATCH 39/65] add check for nvcc after CUDA install --- scripts/linux/download_cuda.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 3b788c0..17a3cc1 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -41,4 +41,12 @@ else # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb -fi \ No newline at end of file +fi + +nvcc --version +if [ $? -ne 0 ]; then + echo "NVCC is not installed or not found in PATH." + exit 1 +else + echo "NVCC is installed." +fi From fbb1952d0f451609e7f0b77b9373d71d1b9972d1 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 22 Feb 2024 23:43:20 +1300 Subject: [PATCH 40/65] move cuda check to actions --- .github/workflows/linux-cuda.yml | 12 +++++++++++- scripts/linux/download_cuda.sh | 10 +--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index b36ba8b..b29a5a8 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -37,7 +37,17 @@ jobs: working-directory: scripts/linux run: | sudo ./download_cuda.sh - + + - name: Check CUDA + run: | + nvcc --version + if [ $? -ne 0 ]; then + echo "NVCC is not installed or not found in PATH." + exit 1 + else + echo "NVCC is installed." + fi + - name: Download CUDNN8 working-directory: scripts/linux run: | diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 17a3cc1..3b788c0 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -41,12 +41,4 @@ else # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb -fi - -nvcc --version -if [ $? -ne 0 ]; then - echo "NVCC is not installed or not found in PATH." - exit 1 -else - echo "NVCC is installed." -fi +fi \ No newline at end of file From 68a5c0fc1458fef33c6ed3ce0e0772a1359b6f33 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 22 Feb 2024 23:56:38 +1300 Subject: [PATCH 41/65] add cuda-12 to path to check nvcc --- .github/workflows/linux-cuda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index b29a5a8..a94df4f 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -40,6 +40,7 @@ jobs: - name: Check CUDA run: | + export PATH=/usr/local/cuda-12*/bin${PATH:+:${PATH}} nvcc --version if [ $? -ne 0 ]; then echo "NVCC is not installed or not found in PATH." From 13b60c0942793f25f291f3b53b44ea97511cfc62 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 00:07:47 +1300 Subject: [PATCH 42/65] check paths --- .github/workflows/linux-cuda.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index a94df4f..a6e6dbb 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -40,7 +40,8 @@ jobs: - name: Check CUDA run: | - export PATH=/usr/local/cuda-12*/bin${PATH:+:${PATH}} + export PATH=/usr/local/cuda*/bin${PATH:+:${PATH}} + echo $PATH nvcc --version if [ $? -ne 0 ]; then echo "NVCC is not installed or not found in PATH." From f0704fb0da1b52ffff369d44793ff9c5e988c1a6 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 00:09:17 +1300 Subject: [PATCH 43/65] locate nvcc --- .github/workflows/linux-cuda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index a6e6dbb..006e3d7 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -42,6 +42,7 @@ jobs: run: | export PATH=/usr/local/cuda*/bin${PATH:+:${PATH}} echo $PATH + echo $(locate bin/nvcc) nvcc --version if [ $? -ne 0 ]; then echo "NVCC is not installed or not found in PATH." From 9193016df1bce7fd757e1065348b46ddd7cf971d Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 00:19:14 +1300 Subject: [PATCH 44/65] install locate --- .github/workflows/linux-cuda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 006e3d7..feda575 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -40,6 +40,7 @@ jobs: - name: Check CUDA run: | + apt-get install -y --no-install-recommmends locate export PATH=/usr/local/cuda*/bin${PATH:+:${PATH}} echo $PATH echo $(locate bin/nvcc) From 734ef0e96d7af2c34ae02e42297df0c72a20061d Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 00:19:14 +1300 Subject: [PATCH 45/65] install locate --- .github/workflows/linux-cuda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 006e3d7..f1cc8c7 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -40,6 +40,7 @@ jobs: - name: Check CUDA run: | + apt-get install -y --no-install-recommends locate export PATH=/usr/local/cuda*/bin${PATH:+:${PATH}} echo $PATH echo $(locate bin/nvcc) From bd1ed5d532064d8c3c9a2eb56fe6dc13b8296440 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 00:41:21 +1300 Subject: [PATCH 46/65] update locate --- .github/workflows/linux-cuda.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index f1cc8c7..95c7557 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -41,16 +41,7 @@ jobs: - name: Check CUDA run: | apt-get install -y --no-install-recommends locate - export PATH=/usr/local/cuda*/bin${PATH:+:${PATH}} - echo $PATH - echo $(locate bin/nvcc) - nvcc --version - if [ $? -ne 0 ]; then - echo "NVCC is not installed or not found in PATH." - exit 1 - else - echo "NVCC is installed." - fi + echo "NVCC: " $(locate nvcc) - name: Download CUDNN8 working-directory: scripts/linux @@ -63,7 +54,7 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | - echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV + #echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | cut -d- -f1)" >> $GITHUB_ENV - name: Patch stdlib @@ -82,7 +73,7 @@ jobs: - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | - asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}.tar.gz + asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda12-cudnn${CUDNN_VERSION}.tar.gz asset_name=$(echo $asset_name | sed 's/:/-/g') tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV From 242bc4b9062c0d0e38a26454291ca196ee971e0c Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 00:47:25 +1300 Subject: [PATCH 47/65] dpkg to find install location? --- .github/workflows/linux-cuda.yml | 5 ----- scripts/linux/download_cuda.sh | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 95c7557..3d46c03 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -38,11 +38,6 @@ jobs: run: | sudo ./download_cuda.sh - - name: Check CUDA - run: | - apt-get install -y --no-install-recommends locate - echo "NVCC: " $(locate nvcc) - - name: Download CUDNN8 working-directory: scripts/linux run: | diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 3b788c0..6b73f57 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -41,4 +41,6 @@ else # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb + + echo $(dpkg -L cuda-toolkit-12) fi \ No newline at end of file From 5e451561bb65a1f21470075c26bafc457fdf6e48 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 01:04:28 +1300 Subject: [PATCH 48/65] try replacing periods in env variable --- .github/workflows/linux-cuda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 3d46c03..375b7d0 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -50,7 +50,7 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | #echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV - echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | cut -d- -f1)" >> $GITHUB_ENV + echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | cut -d- -f1 | tr '.' '_')" >> $GITHUB_ENV - name: Patch stdlib run: | From 6faae02b712bd34694e01b996130927c93a24162 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 01:14:11 +1300 Subject: [PATCH 49/65] just ignore the check and hardcode cuda/cudnn versions for now --- .github/workflows/linux-cuda.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 375b7d0..28cf4f5 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -47,11 +47,6 @@ jobs: run: | scripts/linux/download.sh $option_path - - name: Determine CUDA and cuDNN Versions - run: | - #echo "CUDA_VERSION=$(nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')" >> $GITHUB_ENV - echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | cut -d- -f1 | tr '.' '_')" >> $GITHUB_ENV - - name: Patch stdlib run: | sudo sed -i '/_S_nothrow_init<.*>/ s/^/ \/\/ /' /usr/include/c++/*/bits/std_function.h @@ -68,7 +63,7 @@ jobs: - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | - asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda12-cudnn${CUDNN_VERSION}.tar.gz + asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda12-cudnn8.tar.gz asset_name=$(echo $asset_name | sed 's/:/-/g') tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV From 3f1f94b34a43406b03964c9df25c66fb4daea325 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Fri, 23 Feb 2024 01:22:24 +1300 Subject: [PATCH 50/65] try again --- .github/workflows/linux-cuda.yml | 9 +++++++-- scripts/linux/download_cuda.sh | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 28cf4f5..c1ce2a6 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -42,7 +42,12 @@ jobs: working-directory: scripts/linux run: | sudo ./download_cudnn.sh - + + - name: Determine CUDA and cuDNN Versions + run: | + echo "CUDA_VERSION=$(dpkg -l | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u)" >> $GITHUB_ENV + echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u)" >> $GITHUB_ENV + - name: Download OpenCV repo/s run: | scripts/linux/download.sh $option_path @@ -63,7 +68,7 @@ jobs: - name: Create Tarball if: startsWith(github.ref, 'refs/tags/') run: | - asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda12-cudnn8.tar.gz + asset_name=opencv-${{github.ref_name}}-${{ matrix.os }}-cuda$CUDA_VERSION-cudnn$CUDNN_VERSION.tar.gz asset_name=$(echo $asset_name | sed 's/:/-/g') tar -czf ${asset_name} install echo "ASSET_NAME=${asset_name}" >> $GITHUB_ENV diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 6b73f57..3b788c0 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -41,6 +41,4 @@ else # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb - - echo $(dpkg -L cuda-toolkit-12) fi \ No newline at end of file From 3771d04a06e641af1b78bab18904b88dd5c79613 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sun, 7 Apr 2024 22:43:28 +1200 Subject: [PATCH 51/65] compute sha hashes for release files --- .github/workflows/linux-cuda.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index c1ce2a6..0f51a80 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -84,3 +84,6 @@ jobs: prerelease: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Compute checksums + uses: wangzuo/action-release-checksums@v1 From 07e145ae1ed4d5aa93a865c41d6a7f883211cb21 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sun, 7 Apr 2024 23:06:43 +1200 Subject: [PATCH 52/65] fix cuda version to 12-0 --- .github/workflows/linux-cuda.yml | 3 --- .github/workflows/linux.yml | 2 +- .github/workflows/windows-cuda.yml | 2 +- .github/workflows/windows.yml | 2 +- scripts/linux/download_cuda.sh | 2 +- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 0f51a80..c1ce2a6 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -84,6 +84,3 @@ jobs: prerelease: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Compute checksums - uses: wangzuo/action-release-checksums@v1 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4ae30f9..dff30fa 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -52,6 +52,6 @@ jobs: tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} draft: false - prerelease: true + prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 7449aeb..1897695 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -49,7 +49,7 @@ jobs: tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} draft: false - prerelease: true + prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f0680fc..9ba3049 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -36,7 +36,7 @@ jobs: tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} draft: false - prerelease: true + prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 3b788c0..a9bf65d 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -36,7 +36,7 @@ else apt-get update # Install CUDA - apt-get install -y --no-install-recommends cuda-toolkit-12 + apt-get install -y --no-install-recommends cuda-toolkit-12-0 apt-get install -y --no-install-recommends nvidia-gds # Clean up the downloaded package From 29215d15cabfddc37369aed346cb1225bf2bb0c7 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Sun, 7 Apr 2024 23:08:19 +1200 Subject: [PATCH 53/65] compute checksums as workflow item --- .github/workflows/checksums.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/checksums.yml diff --git a/.github/workflows/checksums.yml b/.github/workflows/checksums.yml new file mode 100644 index 0000000..f03f11c --- /dev/null +++ b/.github/workflows/checksums.yml @@ -0,0 +1,14 @@ +name: Checksums + +# run after validate workflow has completed and the current branch is 'beta' +on: + workflow_run: + workflows: ['linux-cuda', 'linux', 'windows'] + types: [completed] + +jobs: + compute_checksums: + runs-on: ubuntu-latest + steps: + - name: Compute checksums + uses: wangzuo/action-release-checksums@v1 From 13416a0345f6f59b5f811e35ad6a6968f1bb60f9 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 00:35:10 +1200 Subject: [PATCH 54/65] bump gds version --- scripts/.DS_Store | Bin 0 -> 6148 bytes scripts/linux/download_cuda.sh | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 scripts/.DS_Store diff --git a/scripts/.DS_Store b/scripts/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d249cdb2528c6a8ddc9486f22134a87c56eaf0d4 GIT binary patch literal 6148 zcmeHKu};H447E#vAeL@0-Y@hIjw*Zr>c~=+NPv`(N~nS{pTG_qf)()#NGvS;63=I= zGz}FSLX|D~-oW}Dw};^ek#*6I^voiQoc6da&xhl)x|(%- z-S9sdkY~3|C0)`L&1vQNoxHSHt2)o8Wj%#8d%b`9czk<5TJ9 z=ND9CcHMr5;%C=mIgitwgNJ9$V`ZPJ{?28+S394H`r1jA_9C}IV|8Vb} Date: Mon, 8 Apr 2024 01:22:45 +1200 Subject: [PATCH 55/65] try cuda 12.2 --- scripts/linux/download_cuda.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/linux/download_cuda.sh b/scripts/linux/download_cuda.sh index 2b5f78e..3223f56 100755 --- a/scripts/linux/download_cuda.sh +++ b/scripts/linux/download_cuda.sh @@ -36,8 +36,8 @@ else apt-get update # Install CUDA - apt-get install -y --no-install-recommends cuda-toolkit-12-0 - apt-get install -y --no-install-recommends nvidia-gds-12-0 + apt-get install -y --no-install-recommends cuda-toolkit-12-2 + apt-get install -y --no-install-recommends nvidia-gds-12-2 # Clean up the downloaded package rm cuda-keyring_1.1-1_all.deb From bad4456453cd1a2bc31c2cb788ab5d605378ee17 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 01:27:36 +1200 Subject: [PATCH 56/65] add checksums at end of each workflow --- .github/workflows/checksums.yml | 14 -------------- .github/workflows/linux-cuda.yml | 19 +++++++++++++++++++ .github/workflows/linux.yml | 19 +++++++++++++++++++ .github/workflows/windows-cuda.yml | 18 ++++++++++++++++++ .github/workflows/windows.yml | 18 ++++++++++++++++++ 5 files changed, 74 insertions(+), 14 deletions(-) delete mode 100644 .github/workflows/checksums.yml diff --git a/.github/workflows/checksums.yml b/.github/workflows/checksums.yml deleted file mode 100644 index f03f11c..0000000 --- a/.github/workflows/checksums.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Checksums - -# run after validate workflow has completed and the current branch is 'beta' -on: - workflow_run: - workflows: ['linux-cuda', 'linux', 'windows'] - types: [completed] - -jobs: - compute_checksums: - runs-on: ubuntu-latest - steps: - - name: Compute checksums - uses: wangzuo/action-release-checksums@v1 diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index c1ce2a6..ef07ffb 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -84,3 +84,22 @@ jobs: prerelease: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Calculate SHA256 Checksum + - name: Calculate SHA256 Checksum + run: | + echo "Calculating SHA256 for ${{ env.ASSET_NAME }}" + sha256sum ${{ env.ASSET_NAME }} > ${{ env.ASSET_NAME }}.sha256 + shell: bash + + - name: Upload SHA256 Checksum File + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.ASSET_NAME }}.sha256 + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} SHA256 Checksum + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index dff30fa..6889d36 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -53,5 +53,24 @@ jobs: name: ${{ github.ref_name }} draft: false prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Calculate SHA256 Checksum + - name: Calculate SHA256 Checksum + run: | + echo "Calculating SHA256 for ${{ env.ASSET_NAME }}" + sha256sum ${{ env.ASSET_NAME }} > ${{ env.ASSET_NAME }}.sha256 + shell: bash + + - name: Upload SHA256 Checksum File + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.ASSET_NAME }}.sha256 + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} SHA256 Checksum + draft: false + prerelease: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 1897695..6b2f4ab 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -53,4 +53,22 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Calculate SHA256 Checksum + - name: Calculate SHA256 Checksum + run: | + echo "Calculating SHA256 for ${{ env.ASSET_NAME }}" + sha256sum ${{ env.ASSET_NAME }} > ${{ env.ASSET_NAME }}.sha256 + shell: bash + + - name: Upload SHA256 Checksum File + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.ASSET_NAME }}.sha256 + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} SHA256 Checksum + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9ba3049..b4a6e8e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -40,3 +40,21 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Calculate SHA256 Checksum + - name: Calculate SHA256 Checksum + run: | + echo "Calculating SHA256 for ${{ env.ASSET_NAME }}" + sha256sum ${{ env.ASSET_NAME }} > ${{ env.ASSET_NAME }}.sha256 + shell: bash + + - name: Upload SHA256 Checksum File + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.ASSET_NAME }}.sha256 + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} SHA256 Checksum + draft: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 37ed291cccb1895789b0a0d75f4be9d828e374bc Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 01:30:39 +1200 Subject: [PATCH 57/65] check cuda versions in script --- .github/workflows/linux-cuda.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index ef07ffb..987a099 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -45,9 +45,19 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | - echo "CUDA_VERSION=$(dpkg -l | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u)" >> $GITHUB_ENV - echo "CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u)" >> $GITHUB_ENV - + # Extract CUDA version + CUDA_VERSION=$(dpkg -l | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) + echo "Extracted CUDA Version: $CUDA_VERSION" + + # Extract cuDNN version + CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) + echo "Extracted CUDNN Version: $CUDNN_VERSION" + + # Set environment variables properly + echo "CUDA_VERSION=$CUDA_VERSION" >> $GITHUB_ENV + echo "CUDNN_VERSION=$CUDNN_VERSION" >> $GITHUB_ENV + shell: bash + - name: Download OpenCV repo/s run: | scripts/linux/download.sh $option_path From a4eeff82e0d44d66128fbda4b3c2d371a583a409 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 01:39:47 +1200 Subject: [PATCH 58/65] try using grep ii to identify installed packages --- .github/workflows/linux-cuda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 987a099..4d91a81 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -46,11 +46,11 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | # Extract CUDA version - CUDA_VERSION=$(dpkg -l | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) + CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) echo "Extracted CUDA Version: $CUDA_VERSION" # Extract cuDNN version - CUDNN_VERSION=$(dpkg -l | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) + CUDNN_VERSION=$(dpkg -l | grep '^ii' | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) echo "Extracted CUDNN Version: $CUDNN_VERSION" # Set environment variables properly From 0e53427b1e90d065d021cd01d5d152efea85ca1e Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 02:07:43 +1200 Subject: [PATCH 59/65] take lowest installed cuda version --- .github/workflows/linux-cuda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 4d91a81..6a04f4d 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -46,11 +46,11 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | # Extract CUDA version - CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) + CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u | head -n 1) echo "Extracted CUDA Version: $CUDA_VERSION" # Extract cuDNN version - CUDNN_VERSION=$(dpkg -l | grep '^ii' | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u) + CUDNN_VERSION=$(dpkg -l | grep '^ii' | grep -E 'libcudnn|nvidia-cudnn' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u | head -n 1) echo "Extracted CUDNN Version: $CUDNN_VERSION" # Set environment variables properly From 1217f76100378b1330332da705b1a07845b15efc Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 03:09:37 +1200 Subject: [PATCH 60/65] fix naming for windows release --- .github/workflows/linux-cuda.yml | 2 +- .github/workflows/windows-cuda.yml | 6 +++--- .github/workflows/windows.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 6a04f4d..16a0683 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -46,7 +46,7 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | # Extract CUDA version - CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u | head -n 1) + CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'cuda-toolkit-[0-9]*-[0-9]*|nvidia-cuda-toolkit-[0-9]*-[0-9]*' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u | head -n 1) echo "Extracted CUDA Version: $CUDA_VERSION" # Extract cuDNN version diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 6b2f4ab..40456ad 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -56,15 +56,15 @@ jobs: # Calculate SHA256 Checksum - name: Calculate SHA256 Checksum run: | - echo "Calculating SHA256 for ${{ env.ASSET_NAME }}" - sha256sum ${{ env.ASSET_NAME }} > ${{ env.ASSET_NAME }}.sha256 + echo "Calculating SHA256 foropencv-${{github.ref_name}}-windows-cuda12.zip" + sha256sum opencv-${{github.ref_name}}-windows-cuda12.zip > opencv-${{github.ref_name}}-windows-cuda12.zip.sha256 shell: bash - name: Upload SHA256 Checksum File if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: - files: ${{ env.ASSET_NAME }}.sha256 + files: opencv-${{github.ref_name}}-windows-cuda12.zip.sha256 tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} SHA256 Checksum draft: false diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b4a6e8e..74c3515 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,15 +43,15 @@ jobs: # Calculate SHA256 Checksum - name: Calculate SHA256 Checksum run: | - echo "Calculating SHA256 for ${{ env.ASSET_NAME }}" - sha256sum ${{ env.ASSET_NAME }} > ${{ env.ASSET_NAME }}.sha256 + echo "Calculating SHA256 for opencv-${{github.ref_name}}-windows.zip" + sha256sum opencv-${{github.ref_name}}-windows.zip > opencv-${{github.ref_name}}-windows.zip.sha256 shell: bash - name: Upload SHA256 Checksum File if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: - files: ${{ env.ASSET_NAME }}.sha256 + files: opencv-${{github.ref_name}}-windows.zip.sha256 tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} SHA256 Checksum draft: false From 6cf9bf35a2be559e8166373aa16cdaa611c42f09 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 03:16:16 +1200 Subject: [PATCH 61/65] fix release name --- .github/workflows/linux-cuda.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/windows-cuda.yml | 2 +- .github/workflows/windows.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 16a0683..94aa131 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -108,7 +108,7 @@ jobs: with: files: ${{ env.ASSET_NAME }}.sha256 tag_name: ${{ github.ref_name }} - name: ${{ github.ref_name }} SHA256 Checksum + name: ${{ github.ref_name }} draft: false prerelease: true env: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6889d36..070b774 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -69,7 +69,7 @@ jobs: with: files: ${{ env.ASSET_NAME }}.sha256 tag_name: ${{ github.ref_name }} - name: ${{ github.ref_name }} SHA256 Checksum + name: ${{ github.ref_name }} draft: false prerelease: true env: diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index 40456ad..44b323f 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -66,7 +66,7 @@ jobs: with: files: opencv-${{github.ref_name}}-windows-cuda12.zip.sha256 tag_name: ${{ github.ref_name }} - name: ${{ github.ref_name }} SHA256 Checksum + name: ${{ github.ref_name }} draft: false prerelease: true env: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 74c3515..f2f2542 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -53,7 +53,7 @@ jobs: with: files: opencv-${{github.ref_name}}-windows.zip.sha256 tag_name: ${{ github.ref_name }} - name: ${{ github.ref_name }} SHA256 Checksum + name: ${{ github.ref_name }} draft: false prerelease: true env: From e7973cafb3016a681d42ecb339247744819a683b Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Mon, 8 Apr 2024 03:19:20 +1200 Subject: [PATCH 62/65] update cuda version check (again) --- .github/workflows/linux-cuda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-cuda.yml b/.github/workflows/linux-cuda.yml index 94aa131..fc5959f 100644 --- a/.github/workflows/linux-cuda.yml +++ b/.github/workflows/linux-cuda.yml @@ -46,7 +46,7 @@ jobs: - name: Determine CUDA and cuDNN Versions run: | # Extract CUDA version - CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'cuda-toolkit-[0-9]*-[0-9]*|nvidia-cuda-toolkit-[0-9]*-[0-9]*' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u | head -n 1) + CUDA_VERSION=$(dpkg -l | grep '^ii' | grep -E 'nvidia-cuda-toolkit|cuda-toolkit' | awk '{print $3}' | awk -F'[.~+]' '{print $1 "." $2}' | sort -u | head -n 1) echo "Extracted CUDA Version: $CUDA_VERSION" # Extract cuDNN version From cd36c40a2da3091877b39d4ac39ddaa77d704b49 Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Wed, 10 Apr 2024 21:31:41 +1200 Subject: [PATCH 63/65] add tests when building --- options/options_no_cuda.txt | 2 +- options/options_opencv4.9.0_contrib_vc16.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options/options_no_cuda.txt b/options/options_no_cuda.txt index 2490126..525bc7a 100644 --- a/options/options_no_cuda.txt +++ b/options/options_no_cuda.txt @@ -8,5 +8,5 @@ build_world$=true with_debug$=true with_python_release$=false with_python_debug$=false -additional_build_options$=-D OPENCV_DNN_CUDA=OFF -D WITH_CUDNN=OFF -D WITH_CUBLAS=OFF -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON +additional_build_options$=-D OPENCV_DNN_CUDA=OFF -D WITH_CUDNN=OFF -D WITH_CUBLAS=OFF -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=ON -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON custom_build_options$=NA \ No newline at end of file diff --git a/options/options_opencv4.9.0_contrib_vc16.txt b/options/options_opencv4.9.0_contrib_vc16.txt index ca1e326..b69eef8 100644 --- a/options/options_opencv4.9.0_contrib_vc16.txt +++ b/options/options_opencv4.9.0_contrib_vc16.txt @@ -8,5 +8,5 @@ build_world$=true with_debug$=true with_python_release$=false with_python_debug$=false -additional_build_options$=-D WITH_CUBLAS=ON -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=ON -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON +additional_build_options$=-D WITH_CUBLAS=ON -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D WITH_NVCUVID=ON -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=ON -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON custom_build_options$=NA \ No newline at end of file From a5115d1bb28b9cf3ab2f1d02cf08af5879ada9aa Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Wed, 10 Apr 2024 21:31:59 +1200 Subject: [PATCH 64/65] todo: fix release not being build correctly --- scripts/linux/build.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index c31f243..139e28d 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -121,12 +121,10 @@ if [ "$custom_build_options" == "NA" ]; then fi # define build folders - build_release_folder=$build_folder - if [ "$with_debug" == "true" ]; then - build_release_folder=$build_folder/release + build_debug_folder=$build_folder/debug fi - build_debug_folder=$build_folder/debug + build_release_folder=$build_folder/release if [ "$with_debug" == "true" ]; then # create release and debug folders @@ -138,9 +136,9 @@ if [ "$custom_build_options" == "NA" ]; then install_folder=$PWD/install install_release_folder=$install_folder if [ "$with_debug" == "true" ]; then - install_release_folder=$install_folder/release + install_release_folder=$install_folder/debug fi - install_debug_folder=$install_folder/debug + install_debug_folder=$install_folder/release # clean install folder if [ "$clean_on_build" == "true" ]; then From ff8816cb4c792b2c09af1d7640640d863fbf3ebd Mon Sep 17 00:00:00 2001 From: Josh Veitch-Michaelis Date: Thu, 11 Apr 2024 00:42:28 +1200 Subject: [PATCH 65/65] fix minor typo that caused release to not build --- scripts/linux/build.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 139e28d..d3738ce 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -136,9 +136,9 @@ if [ "$custom_build_options" == "NA" ]; then install_folder=$PWD/install install_release_folder=$install_folder if [ "$with_debug" == "true" ]; then - install_release_folder=$install_folder/debug + install_debug_folder=$install_folder/debug fi - install_debug_folder=$install_folder/release + install_release_folder=$install_folder/release # clean install folder if [ "$clean_on_build" == "true" ]; then @@ -218,8 +218,6 @@ if [ "$custom_build_options" == "NA" ]; then sudo apt-get install -y --no-install-recommends libatlas-base-dev gfortran # build opencv release - cd $build_release_folder - GCC_VERSION=$(gcc -dumpversion | cut -d. -f1) if [[ "$GCC_VERSION" -gt 11 ]]; then sudo apt-get install -y --no-install-recommends gcc-11 g++-11 @@ -228,13 +226,19 @@ if [ "$custom_build_options" == "NA" ]; then export CXX=g++-11 fi + if "$with_cuda" == "true" ]; then + export CUDNN_LIBRARY=/usr/local/cuda-12/lib64 + fi + + cd $build_release_folder + cmake \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=$install_release_folder \ -D BUILD_opencv_world=$cmake_build_world \ -D WITH_CUDA=$cmake_with_cuda \ -D ENABLE_FAST_MATH=$cmake_enable_fast_math \ - -D CUDA_FAST_MATH=$cmake_cuda_fast_math \\ + -D CUDA_FAST_MATH=$cmake_cuda_fast_math \ -D CUDA_ARCH_BIN="5.0 5.2 6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0" \ -D CUDA_ARCH_PTX="9.0" \ -D WITH_CUBLAS=$cmake_with_cublas \ @@ -247,6 +251,10 @@ if [ "$custom_build_options" == "NA" ]; then -D BUILD_EXAMPLES=$cmake_build_examples \ $cmake_addition_build_options ../.. + # install opencv release + make -j$((`nproc`+1)) + make install + if [ "$with_debug" == "true" ]; then # build opencv debug cd $build_debug_folder @@ -268,23 +276,11 @@ if [ "$custom_build_options" == "NA" ]; then -D BUILD_opencv_python2=$cmake_python_debug \ -D BUILD_EXAMPLES=$cmake_build_examples \ $cmake_addition_build_options ../.. - fi - if "$with_cuda" == "true" ]; then - export CUDNN_LIBRARY=/usr/local/cuda-12/lib64 - fi - - # install opencv release - cd $build_release_folder - make -j$((`nproc`+1)) - make install - - if [ "$with_debug" == "true" ]; then - # install opencv debug - cd $build_debug_folder make -j$((`nproc`+1)) make install fi + else # build opencv with custom build options cmake $custom_build_options% ../..