From 80c54d2210c210e59e09d7dca76469ed117278f7 Mon Sep 17 00:00:00 2001 From: Kiriti Gowda Date: Wed, 27 Mar 2024 21:23:53 -0700 Subject: [PATCH] Setup - updates & Fixes (#301) * Setup - Updates * Setup - Develop Install Default OFF * Developer - Default OFF [ROCm/rocdecode commit: ad7f22877409652a19e5514432b91144d271712f] --- projects/rocdecode/CHANGELOG.md | 30 +++- projects/rocdecode/CMakeLists.txt | 24 +-- projects/rocdecode/README.md | 6 +- projects/rocdecode/docs/install/install.rst | 2 +- projects/rocdecode/rocDecode-setup.py | 171 +++++++++++--------- 5 files changed, 142 insertions(+), 91 deletions(-) diff --git a/projects/rocdecode/CHANGELOG.md b/projects/rocdecode/CHANGELOG.md index 6ce70736c7..ce8413ba9b 100644 --- a/projects/rocdecode/CHANGELOG.md +++ b/projects/rocdecode/CHANGELOG.md @@ -3,7 +3,35 @@ Documentation for rocDecode is available at [https://rocm.docs.amd.com/projects/rocDecode/en/latest/](https://rocm.docs.amd.com/projects/rocDecode/en/latest/) -## (Unreleased) rocDecode 0.5.0 +## rocDecode 0.6.0 (Unreleased) + +## Additions + +* FFMPEG V5.X Support + +## Optimizations + +* Setup Script - Error Check install + +### Changes + +* Dependencies - Updates to core dependencies + +### Fixes + +* + +### Tested configurations + +* Linux distribution + * Ubuntu - `20.04` / `22.04` +* ROCm: + * rocm-core - `6.1.0.60100-28` + * amdgpu-core - `1:6.1.60100-1731559` +* FFMPEG - `4.2.7` / `4.4.2-0` +* rocDecode Setup Script - `V1.7` + +## rocDecode 0.5.0 ### Changes diff --git a/projects/rocdecode/CMakeLists.txt b/projects/rocdecode/CMakeLists.txt index 709dc17c00..1ef9fd81ac 100644 --- a/projects/rocdecode/CMakeLists.txt +++ b/projects/rocdecode/CMakeLists.txt @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 3.5) -set(VERSION "0.5.0") +set(VERSION "0.6.0") set(CMAKE_CXX_STANDARD 17) # Set Project Version and Language @@ -252,21 +252,21 @@ if(HIP_FOUND AND Libva_FOUND) set(CPACK_RPM_TEST_PACKAGE_OBSOLETES "${PROJECT_NAME}-test") if(NOT ROCM_DEP_ROCMCORE) - string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_RUNTIME_PACKAGE_REQUIRES ${CPACK_RPM_RUNTIME_PACKAGE_REQUIRES}) - string(REGEX REPLACE ",? ?rocm-core-asan," "" CPACK_RPM_ASAN_PACKAGE_REQUIRES ${CPACK_RPM_ASAN_PACKAGE_REQUIRES}) - string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_DEV_PACKAGE_REQUIRES ${CPACK_RPM_DEV_PACKAGE_REQUIRES}) - string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_TEST_PACKAGE_REQUIRES ${CPACK_RPM_TEST_PACKAGE_REQUIRES}) - string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS ${CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS}) - string(REGEX REPLACE ",? ?rocm-core-asan," "" CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS}) - string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_DEV_PACKAGE_DEPENDS ${CPACK_DEBIAN_DEV_PACKAGE_DEPENDS}) - string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_TEST_PACKAGE_DEPENDS ${CPACK_DEBIAN_TEST_PACKAGE_DEPENDS}) + string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_RUNTIME_PACKAGE_REQUIRES ${CPACK_RPM_RUNTIME_PACKAGE_REQUIRES}) + string(REGEX REPLACE ",? ?rocm-core-asan," "" CPACK_RPM_ASAN_PACKAGE_REQUIRES ${CPACK_RPM_ASAN_PACKAGE_REQUIRES}) + string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_DEV_PACKAGE_REQUIRES ${CPACK_RPM_DEV_PACKAGE_REQUIRES}) + string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_TEST_PACKAGE_REQUIRES ${CPACK_RPM_TEST_PACKAGE_REQUIRES}) + string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS ${CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS}) + string(REGEX REPLACE ",? ?rocm-core-asan," "" CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS}) + string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_DEV_PACKAGE_DEPENDS ${CPACK_DEBIAN_DEV_PACKAGE_DEPENDS}) + string(REGEX REPLACE ",? ?rocm-core," "" CPACK_DEBIAN_TEST_PACKAGE_DEPENDS ${CPACK_DEBIAN_TEST_PACKAGE_DEPENDS}) endif() if(ENABLE_ASAN_PACKAGING) - # ASAN Package requires asan component with only libraries and license file - set(CPACK_COMPONENTS_ALL asan) + # ASAN Package requires asan component with only libraries and license file + set(CPACK_COMPONENTS_ALL asan) else() - set(CPACK_COMPONENTS_ALL runtime dev test) + set(CPACK_COMPONENTS_ALL runtime dev test) endif() set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") diff --git a/projects/rocdecode/README.md b/projects/rocdecode/README.md index fdb088b89c..2265397e8f 100644 --- a/projects/rocdecode/README.md +++ b/projects/rocdecode/README.md @@ -67,8 +67,8 @@ For your convenience, we provide the setup script, which installs all required dependencies. Run this script only once. ```shell -python3 rocDecode-setup.py --rocm_path [ ROCm Installation Path - optional (default:/opt/rocm)] - --developer [ Setup Developer Options - optional (default:ON) [options:ON/OFF]] +python3 rocDecode-setup.py --rocm_path [ ROCm Installation Path - optional (default:/opt/rocm)] + --developer [ Setup Developer Options - optional (default:OFF) [options:ON/OFF]] ``` ## Installation instructions @@ -223,4 +223,4 @@ page. * rocm-core - `6.1.0.60100-28` * amdgpu-core - `1:6.1.60100-1731559` * FFmpeg - `4.2.7` / `4.4.2-0` -* rocDecode Setup Script - `V1.6` +* rocDecode Setup Script - `V1.7` diff --git a/projects/rocdecode/docs/install/install.rst b/projects/rocdecode/docs/install/install.rst index b765a5050a..6a18ed177d 100644 --- a/projects/rocdecode/docs/install/install.rst +++ b/projects/rocdecode/docs/install/install.rst @@ -25,7 +25,7 @@ Tested configurations * FFmpeg: 4.2.7/4.4.2-0 -* rocDecode Setup Script: V1.4 +* rocDecode Setup Script: V1.7 Supported codecs ======================================== diff --git a/projects/rocdecode/rocDecode-setup.py b/projects/rocdecode/rocDecode-setup.py index 1a2b3f4b1d..eef33c510f 100644 --- a/projects/rocdecode/rocDecode-setup.py +++ b/projects/rocdecode/rocDecode-setup.py @@ -28,16 +28,23 @@ else: import subprocess __copyright__ = "Copyright (c) 2023 - 2024, AMD ROCm rocDecode" -__version__ = "1.6" +__version__ = "1.7" __email__ = "mivisionx.support@amd.com" __status__ = "Shipping" +# error check calls +def ERROR_CHECK(call): + status = call + if(status != 0): + print('ERROR_CHECK failed with status:'+str(status)) + exit(status) + # Arguments parser = argparse.ArgumentParser() parser.add_argument('--rocm_path', type=str, default='/opt/rocm', help='ROCm Installation Path - optional (default:/opt/rocm) - ROCm Installation Required') -parser.add_argument('--developer', type=str, default='ON', - help='Setup Developer Options - optional (default:ON) [options:ON/OFF]') +parser.add_argument('--developer', type=str, default='OFF', + help='Setup Developer Options - optional (default:OFF) [options:ON/OFF]') args = parser.parse_args() developerInstall = args.developer.upper() @@ -51,7 +58,7 @@ print("\nROCm PATH set to -- "+ROCM_PATH+"\n") # check ROCm installation if os.path.exists(ROCM_PATH): print("\nROCm Installation Found -- "+ROCM_PATH+"\n") - os.system('echo ROCm Info -- && '+ROCM_PATH+'/bin/rocminfo') + ERROR_CHECK(os.system('echo ROCm Info -- && '+ROCM_PATH+'/bin/rocminfo')) else: print( "WARNING: If ROCm installed, set ROCm Path with \"--rocm_path\" option for full installation [Default:/opt/rocm]\n") @@ -88,7 +95,7 @@ if "centos" in platfromInfo or "redhat" in platfromInfo or os.path.exists('/usr/ linuxSystemInstall_check = '--nogpgcheck' if "centos-7" in platfromInfo or "redhat-7" in platfromInfo: linuxCMake = 'cmake3' - os.system(linuxSystemInstall+' install cmake3') + ERROR_CHECK(os.system(linuxSystemInstall+' install cmake3')) if not "centos" in platfromInfo or not "redhat" in platfromInfo: platfromInfo = platfromInfo+'-redhat' elif "Ubuntu" in platfromInfo or os.path.exists('/usr/bin/apt-get'): @@ -111,91 +118,107 @@ print("\nrocDecode Setup on: "+platfromInfo+"\n") print("\nrocDecode Dependencies Installation with rocDecode-setup.py V-"+__version__+"\n") if userName == 'root': - os.system(linuxSystemInstall+' update') - os.system(linuxSystemInstall+' install sudo') + ERROR_CHECK(os.system(linuxSystemInstall+' update')) + ERROR_CHECK(os.system(linuxSystemInstall+' install sudo')) -# install pre-reqs -os.system('sudo -v') -os.system(linuxSystemInstall+' update') -os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + - linuxSystemInstall_check+' install gcc cmake git wget unzip pkg-config inxi') +# source install - common package dependencies +commonPackages = [ + 'gcc', + 'cmake', + 'git', + 'wget', + 'unzip', + 'pkg-config', + 'inxi' +] -# rocDecode Core - VA/DRM Requirements +# Debian packages +coreDebianPackages = [ + 'libva-amdgpu-dev', + 'libdrm-amdgpu1', + 'mesa-amdgpu-va-drivers', + 'vainfo' +] +coreDebianU22Packages = [ + 'libstdc++-12-dev' +] +ffmpegDebianPackages = [ + 'ffmpeg', + 'libavcodec-dev', + 'libavformat-dev', + 'libavutil-dev' +] + +# RPM Packages +coreRPMPackages = [ + 'libva-amdgpu-devel', + 'libdrm-amdgpu', + 'mesa-amdgpu-dri-drivers', + 'libva-utils' +] + +# common packages +ERROR_CHECK(os.system('sudo -v')) +for i in range(len(commonPackages)): + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install '+ commonPackages[i])) + +# rocDecode Core - LibVA Requirements +ERROR_CHECK(os.system('sudo -v')) if "Ubuntu" in platfromInfo: - os.system('sudo -v') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install vainfo libva-amdgpu-dev libdrm-amdgpu1 mesa-amdgpu-va-drivers') + for i in range(len(coreDebianPackages)): + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install '+ coreDebianPackages[i])) if "22.04" in platform.version(): - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install libstdc++-12-dev') + for i in range(len(coreDebianU22Packages)): + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install '+ coreDebianU22Packages[i])) else: - os.system('sudo -v') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install libva-amdgpu-devel libdrm-amdgpu mesa-amdgpu-dri-drivers') + for i in range(len(coreRPMPackages)): + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install '+ coreRPMPackages[i])) # rocDecode Dev Requirements +ERROR_CHECK(os.system('sudo -v')) if developerInstall == 'ON': if "Ubuntu" in platfromInfo: - os.system('sudo -v') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install ffmpeg libavcodec-dev libavformat-dev libavutil-dev') + for i in range(len(ffmpegDebianPackages)): + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install '+ ffmpegDebianPackages[i])) else: - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install autoconf automake bzip2 bzip2-devel freetype-devel') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install gcc-c++ libtool make pkgconfig zlib-devel') - # Nasm - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install nasm') if "centos-7" in platfromInfo or "redhat-7" in platfromInfo: - # Yasm - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install http://repo.okay.com.mx/centos/7/x86_64/release/okay-release-1-1.noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' --enablerepo=extras install epel-release') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install yasm') - # libx264 & libx265 - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install libx264-devel libx265-devel') - # libfdk_aac - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install https://forensics.cert.org/cert-forensics-tools-release-el7.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' --enablerepo=forensics install fdk-aac') - # libASS - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install libass-devel') - os.system('sudo -v') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install ffmpeg') + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install epel-release')) + ERROR_CHECK(os.system('sudo localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install ffmpeg ffmpeg-devel')) elif "centos-8" in platfromInfo or "redhat-8" in platfromInfo: # el8 x86_64 packages - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/SDL2-2.0.10-2.el8.x86_64.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install ffmpeg ffmpeg-devel') + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/SDL2-2.0.10-2.el8.x86_64.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install ffmpeg ffmpeg-devel')) elif "centos-9" in platfromInfo or "redhat-9" in platfromInfo: # el8 x86_64 packages - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install install https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install ffmpeg ffmpeg-free-devel') + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install ffmpeg ffmpeg-free-devel')) elif "SLES" in platfromInfo: # FFMPEG-4 packages - os.system( - 'sudo zypper ar -cfp 90 \'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_$releasever/Essentials\' packman-essentials') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + - ' install ffmpeg-4') + ERROR_CHECK(os.system( + 'sudo zypper ar -cfp 90 \'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_$releasever/Essentials\' packman-essentials')) + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + + ' install ffmpeg-4')) print("\nrocDecode Dependencies Installed with rocDecode-setup.py V-"+__version__+"\n")