diff --git a/MIVisionX-setup.py b/MIVisionX-setup.py index cb954fec1c..80421b5485 100644 --- a/MIVisionX-setup.py +++ b/MIVisionX-setup.py @@ -45,16 +45,18 @@ help='ProtoBuf Version - optional (default:3.12.4)') parser.add_argument('--rpp', type=str, default='0.99', help='RPP Version - optional (default:0.99)') -parser.add_argument('--ffmpeg', type=str, default='no', - help='FFMPEG V4.4.2 Installation - optional (default:no) [options:yes/no]') -parser.add_argument('--neural_net', type=str, default='yes', - help='MIVisionX Neural Net Dependency Install - optional (default:yes) [options:yes/no]') -parser.add_argument('--rocal', type=str, default='yes', - help='MIVisionX rocAL Dependency Install - optional (default:yes) [options:yes/no]') -parser.add_argument('--reinstall', type=str, default='no', - help='Remove previous setup and reinstall - optional (default:no) [options:yes/no]') +parser.add_argument('--ffmpeg', type=str, default='ON', + help='FFMPEG V4.4.2 Installation - optional (default:ON) [options:ON/OFF]') +parser.add_argument('--neural_net', type=str, default='ON', + help='MIVisionX Neural Net Dependency Install - optional (default:ON) [options:ON/OFF]') +parser.add_argument('--inference', type=str, default='ON', + help='MIVisionX Neural Net Inference Dependency Install - optional (default:ON) [options:ON/OFF]') +parser.add_argument('--rocal', type=str, default='ON', + help='MIVisionX rocAL Dependency Install - optional (default:ON) [options:ON/OFF]') +parser.add_argument('--reinstall', type=str, default='OFF', + help='Remove previous setup and reinstall - optional (default:OFF) [options:ON/OFF]') parser.add_argument('--backend', type=str, default='HIP', - help='MIVisionX Dependency Backend - optional (default:HIP) [options:CPU/OCL/HIP]') + help='MIVisionX Dependency Backend - optional (default:HIP) [options:HIP/OCL/CPU]') parser.add_argument('--rocm_path', type=str, default='/opt/rocm', help='ROCm Installation Path - optional (default:/opt/rocm) - ROCm Installation Required') args = parser.parse_args() @@ -65,6 +67,7 @@ rppVersion = args.rpp ffmpegInstall = args.ffmpeg neuralNetInstall = args.neural_net +inferenceInstall = args.inference rocalInstall = args.rocal reinstall = args.reinstall backend = args.backend @@ -74,21 +77,25 @@ ROCM_PATH = os.environ.get('ROCM_PATH') print("\nROCm PATH set to -- "+ROCM_PATH+"\n") -if ffmpegInstall not in ('no', 'yes'): +if ffmpegInstall not in ('OFF', 'ON'): print( - "ERROR: FFMPEG Install Option Not Supported - [Supported Options: no or yes]") + "ERROR: FFMPEG Install Option Not Supported - [Supported Options: OFF or ON]") exit() -if neuralNetInstall not in ('no', 'yes'): +if neuralNetInstall not in ('OFF', 'ON'): print( - "ERROR: Neural Net Install Option Not Supported - [Supported Options: no or yes]") + "ERROR: Neural Net Install Option Not Supported - [Supported Options: OFF or ON]") exit() -if rocalInstall not in ('no', 'yes'): +if inferenceInstall not in ('OFF', 'ON'): print( - "ERROR: Neural Net Install Option Not Supported - [Supported Options: no or yes]") + "ERROR: Inference Install Option Not Supported - [Supported Options: OFF or ON]") exit() -if reinstall not in ('no', 'yes'): +if rocalInstall not in ('OFF', 'ON'): print( - "ERROR: Re-Install Option Not Supported - [Supported Options: no or yes]") + "ERROR: Neural Net Install Option Not Supported - [Supported Options: OFF or ON]") + exit() +if reinstall not in ('OFF', 'ON'): + print( + "ERROR: Re-Install Option Not Supported - [Supported Options: OFF or ON]") exit() if backend not in ('OCL', 'HIP', 'CPU'): print( @@ -96,7 +103,7 @@ exit() # check ROCm installation -if os.path.exists(ROCM_PATH) and backend != 'CPU': +if os.path.exists(ROCM_PATH): print("\nROCm Installation Found -- "+ROCM_PATH+"\n") os.system('echo ROCm Info -- && '+ROCM_PATH+'/bin/rocminfo') else: @@ -104,12 +111,13 @@ print("\nWARNING: ROCm Not Found at -- "+ROCM_PATH+"\n") print( "WARNING: Set ROCm Path with \"--rocm_path\" option for full installation [Default:/opt/rocm]\n") - print("WARNING: Only OpenCV will be installed\n") + print("WARNING: Limited dependencies will be installed\n") else: - print("\nCPU Only Install: OpenCV will be installed\n") - ffmpegInstall = 'no' - neuralNetInstall = 'no' - rocalInstall = 'no' + print("\nCPU Only Install\n") + ffmpegInstall = 'OFF' + neuralNetInstall = 'OFF' + rocalInstall = 'OFF' + inferenceInstall = 'OFF' # get platfrom info platfromInfo = platform.platform() @@ -141,12 +149,14 @@ linuxCMake = 'cmake' linuxSystemInstall_check = '' linuxFlag = '' -if "centos" in platfromInfo or "redhat" in platfromInfo: +if "centos" in platfromInfo or "redhat" in platfromInfo or os.path.exists('/usr/bin/yum'): linuxSystemInstall = 'yum -y' linuxSystemInstall_check = '--nogpgcheck' if "centos-7" in platfromInfo or "redhat-7" in platfromInfo: linuxCMake = 'cmake3' 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'): linuxSystemInstall = 'apt-get -y' linuxSystemInstall_check = '--allow-unauthenticated' @@ -159,7 +169,7 @@ platfromInfo = platfromInfo+'-SLES' else: print("\nMIVisionX Setup on "+platfromInfo+" is unsupported\n") - print("\nMIVisionX Setup Supported on: Ubuntu 20/22; CentOS 7/8; RedHat 7/8; & SLES 15-SP2\n") + print("\nMIVisionX Setup Supported on: Ubuntu 20/22; CentOS 7/8; RedHat 7/8/9; & SLES 15-SP2\n") exit() # MIVisionX Setup @@ -170,7 +180,7 @@ os.system(linuxSystemInstall+' install sudo') # Delete previous install -if os.path.exists(deps_dir) and reinstall == 'yes': +if os.path.exists(deps_dir) and reinstall == 'ON': os.system('sudo -v') os.system('sudo rm -rf '+deps_dir) print("\nMIVisionX Setup: Removing Previous Install -- "+deps_dir+"\n") @@ -184,7 +194,7 @@ os.system('(cd '+deps_dir+'/build/OpenCV; sudo ' + linuxFlag+' make install -j8)') - if neuralNetInstall == 'yes' and backend != 'CPU': + if neuralNetInstall == 'ON' and backend != 'CPU': if backend == 'OCL': os.system('sudo -v') os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + @@ -197,21 +207,21 @@ os.system('sudo '+linuxFlag+' '+linuxSystemInstall + ' '+linuxSystemInstall_check+' install -y --reinstall rocblas rocblas-dev miopen-hip miopen-hip-dev migraphx') - if (rocalInstall == 'yes' or neuralNetInstall == 'yes') and backend != 'CPU': + if (rocalInstall == 'ON' or neuralNetInstall == 'ON') and backend != 'CPU': # ProtoBuf if os.path.exists(deps_dir+'/protobuf-'+ProtoBufVersion): os.system('sudo -v') os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion + '; sudo '+linuxFlag+' make install -j8)') - if rocalInstall == 'yes' and backend != 'CPU': + if rocalInstall == 'ON' and backend != 'CPU': # RPP if os.path.exists(deps_dir+'/rpp/build-'+backend): os.system('sudo -v') os.system('(cd '+deps_dir+'/rpp/build-'+backend+'; sudo ' + linuxFlag+' make install -j8)') - if ffmpegInstall == 'yes' and backend != 'CPU': + if ffmpegInstall == 'ON' and backend != 'CPU': # FFMPEG if os.path.exists(deps_dir+'/FFmpeg-n4.4.2'): os.system('sudo -v') @@ -235,25 +245,25 @@ os.system( '(cd '+deps_dir+'; wget https://github.com/opencv/opencv/archive/'+opencvVersion+'.zip )') os.system('(cd '+deps_dir+'; unzip '+opencvVersion+'.zip )') - if (rocalInstall == 'yes' or neuralNetInstall == 'yes') and backend != 'CPU': + if (rocalInstall == 'ON' or neuralNetInstall == 'ON') and backend != 'CPU': os.system( '(cd '+deps_dir+'; wget https://github.com/protocolbuffers/protobuf/archive/v'+ProtoBufVersion+'.zip )') os.system('(cd '+deps_dir+'; unzip v'+ProtoBufVersion+'.zip )') - if ffmpegInstall == 'yes' and backend != 'CPU': + if ffmpegInstall == 'ON' and backend != 'CPU': os.system( '(cd '+deps_dir+'; wget https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n4.4.2.zip && unzip n4.4.2.zip )') # Install - if (rocalInstall == 'yes' or neuralNetInstall == 'yes') and backend != 'CPU': + if (rocalInstall == 'ON' or neuralNetInstall == 'ON') and backend != 'CPU': # package dependencies os.system('sudo -v') if "centos" in platfromInfo or "redhat" in platfromInfo: if "centos-7" in platfromInfo or "redhat-7" in platfromInfo: os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + linuxSystemInstall_check + ' install kernel-devel libsqlite3x-devel bzip2-devel openssl-devel python3-devel autoconf automake libtool curl make g++ unzip') - elif "centos-8" in platfromInfo or "redhat-8" in platfromInfo: + elif "centos-8" in platfromInfo or "redhat" in platfromInfo: os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + linuxSystemInstall_check + - ' install kernel-devel libsqlite3x-devel bzip2-devel openssl-devel python3-devel autoconf automake libtool curl make gcc-c++ unzip') + ' install kernel-devel libsqlite3x-devel bzip2-devel openssl-devel python3-devel autoconf automake libtool make gcc-c++ unzip') elif "Ubuntu" in platfromInfo: os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + linuxSystemInstall_check+' install sqlite3 libsqlite3-dev libbz2-dev libssl-dev python3-dev autoconf automake libtool') @@ -266,12 +276,8 @@ os.system( '(cd '+deps_dir+'; wget https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2 )') os.system('(cd '+deps_dir+'; tar xjvf boost_1_72_0.tar.bz2 )') - if "centos-8" in platfromInfo or "redhat-8" in platfromInfo or "SLES" in platfromInfo: - os.system( - '(cd '+deps_dir+'/boost_1_72_0/; ./bootstrap.sh --prefix=/usr/local --with-python=python36 )') - else: - os.system( - '(cd '+deps_dir+'/boost_1_72_0/; ./bootstrap.sh --prefix=/usr/local --with-python=python3 )') + os.system( + '(cd '+deps_dir+'/boost_1_72_0/; ./bootstrap.sh --prefix=/usr/local --with-python=python3 )') os.system( '(cd '+deps_dir+'/boost_1_72_0/; ./b2 stage -j16 threading=multi link=shared cxxflags="-std=c++11" )') os.system( @@ -302,7 +308,7 @@ os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion + '; sudo '+linuxFlag+' ldconfig )') - if neuralNetInstall == 'yes' and backend != 'CPU': + if neuralNetInstall == 'ON' and backend != 'CPU': # Remove Previous Install - MIOpen os.system('sudo -v') if os.path.exists(ROCM_PATH+'/miopen'): @@ -310,16 +316,24 @@ if backend == 'OCL': os.system('sudo -v') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + - linuxSystemInstall_check+' autoremove -y rocblas rocblas-dev miopen-hip miopen-hip-dev migraphx') + if "Ubuntu" in platfromInfo: + os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + + linuxSystemInstall_check+' autoremove -y rocblas rocblas-dev miopen-hip miopen-hip-dev migraphx-devel') + else: + os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + + linuxSystemInstall_check+' autoremove -y rocblas rocblas-devel miopen-hip miopen-hip-devel migraphx-devel') os.system('sudo '+linuxFlag+' '+linuxSystemInstall + ' '+linuxSystemInstall_check+' install -y miopen-opencl') else: os.system('sudo -v') os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + linuxSystemInstall_check+' autoremove -y miopengemm miopen-opencl') - os.system('sudo '+linuxFlag+' '+linuxSystemInstall + - ' '+linuxSystemInstall_check+' install -y miopen-hip migraphx') + if "Ubuntu" in platfromInfo: + os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install -y rocblas-dev miopen-hip-dev migraphx-dev') + else: + os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install -y rocblas-devel miopen-hip-devel migraphx-devel') # Install OpenCV os.system('(cd '+deps_dir+'/build; mkdir OpenCV )') @@ -354,7 +368,7 @@ os.system('sudo -v') os.system('(cd '+deps_dir+'/build/OpenCV; sudo '+linuxFlag+' ldconfig )') - if rocalInstall == 'yes' and backend != 'CPU': + if rocalInstall == 'ON' and backend != 'CPU': # Install RPP if "Ubuntu" in platfromInfo: # Install Packages for rocAL @@ -369,45 +383,35 @@ os.system('sudo -v') os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + linuxSystemInstall_check+' install clang') - # turbo-JPEG - https://github.com/rrawther/libjpeg-turbo.git -- 2.0.6.2 - os.system( - '(cd '+deps_dir+'; git clone -b 2.0.6.2 https://github.com/rrawther/libjpeg-turbo.git )') - os.system('(cd '+deps_dir+'/libjpeg-turbo; mkdir build; cd build; '+linuxCMake + - ' -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_STATIC=FALSE -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib ..; make -j 4; sudo make install )') - # RPP - # Remove Previous Install - RPP + elif "redhat" in platfromInfo: + # Nasm & Yasm os.system('sudo -v') - os.system('(cd '+deps_dir+'; git clone -b '+rppVersion+' https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp.git; cd rpp; mkdir build-'+backend+'; cd build-'+backend+'; ' + - linuxCMake+' -DBACKEND='+backend+' ../; make -j4; sudo make install)') - # Turn off for CentOS - TBD: TURN ON when RPP is supported on CentOS - # else: - # Nasm - # os.system('(cd '+deps_dir+'; curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2 )') - # os.system('(cd '+deps_dir+'; tar xjvf nasm-2.14.02.tar.bz2 )') - # os.system('(cd '+deps_dir+'/nasm-2.14.02; ./autogen.sh; ./configure; make -j8 )') - # os.system('sudo -v') - # os.system('(cd '+deps_dir+'/nasm-2.14.02; sudo '+linuxFlag+' make install )') - # Yasm - # os.system('(cd '+deps_dir+'; curl -O -L https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz )') - # os.system('(cd '+deps_dir+'; tar xzvf yasm-1.3.0.tar.gz )') - # os.system('(cd '+deps_dir+'/yasm-1.3.0; ./configure; make -j8 )') - # os.system('sudo -v') - # os.system('(cd '+deps_dir+'/yasm-1.3.0; sudo '+linuxFlag+' make install )') + os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + ' '+linuxSystemInstall_check+' install nasm yasm') # JSON-cpp - # os.system('sudo -v') - # os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check+' install jsoncpp') + os.system('sudo -v') + os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + + linuxSystemInstall_check+' install jsoncpp') # clang+boost - # os.system('sudo -v') - # os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check+' install boost-devel clang') - # turbo-JPEG - # os.system('(cd '+deps_dir+'; wget https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-2.0.3.tar.gz )') - # os.system('(cd '+deps_dir+'; tar xf libjpeg-turbo-2.0.3.tar.gz )') - # os.system('(cd '+deps_dir+'/libjpeg-turbo-2.0.3; mkdir build; cd build; '+linuxCMake+' -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_STATIC=FALSE -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/libjpeg-turbo-2.0.3 -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib ..; make -j 4; sudo make install )') - # RPP - # os.system('(cd '+deps_dir+'; git clone -b '+rppVersion+' https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp.git; cd rpp; mkdir build; cd build; '+linuxCMake+' -DBACKEND=OCL ../; make -j4; sudo make install)') + os.system('sudo -v') + os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + + linuxSystemInstall_check+' install boost-devel clang') + # lmbd + os.system('sudo -v') + os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' ' + + linuxSystemInstall_check+' install lmdb-devel') + # turbo-JPEG - https://github.com/rrawther/libjpeg-turbo.git -- 2.0.6.2 + os.system( + '(cd '+deps_dir+'; git clone -b 2.0.6.2 https://github.com/rrawther/libjpeg-turbo.git )') + os.system('(cd '+deps_dir+'/libjpeg-turbo; mkdir build; cd build; '+linuxCMake + + ' -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_STATIC=FALSE -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib ..; make -j 4; sudo make install )') + # RPP + os.system('sudo -v') + os.system('(cd '+deps_dir+'; git clone -b '+rppVersion+' https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp.git; cd rpp; mkdir build-'+backend+'; cd build-'+backend+'; ' + + linuxCMake+' -DBACKEND='+backend+' -DCMAKE_INSTALL_PREFIX='+ROCM_PATH+' ../; make -j4; sudo make install)') # Install ffmpeg - if ffmpegInstall == 'yes' and backend != 'CPU': + if ffmpegInstall == 'ON' and backend != 'CPU': if "Ubuntu" in platfromInfo: os.system('sudo -v') os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + @@ -448,7 +452,7 @@ # libASS os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' '+linuxSystemInstall_check + ' install libass-devel') - elif "centos-8" in platfromInfo or "redhat-8" in platfromInfo: + elif "centos-8" in platfromInfo or "redhat" 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') diff --git a/README.md b/README.md index 8128691a13..a1a1f70be9 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,11 @@ For the convenience of the developer, we here provide the setup script which wil --opencv [OpenCV Version - optional (default:4.6.0)] --protobuf [ProtoBuf Version - optional (default:3.12.4)] --rpp [RPP Version - optional (default:0.99)] - --ffmpeg [FFMPEG V4.4.2 Installation - optional (default:no) [options:yes/no]] - --rocal [MIVisionX rocAL Dependency Install - optional (default:yes) [options:yes/no]] - --neural_net[MIVisionX Neural Net Dependency Install - optional (default:yes) [options:yes/no]] - --reinstall [Remove previous setup and reinstall (default:no)[options:yes/no]] - --backend [MIVisionX Dependency Backend - optional (default:HIP) [options:OCL/HIP]] + --ffmpeg [FFMPEG V4.4.2 Installation - optional (default:ON) [options:ON/OFF]] + --rocal [MIVisionX rocAL Dependency Install - optional (default:ON) [options:ON/OFF]] + --neural_net[MIVisionX Neural Net Dependency Install - optional (default:ON) [options:ON/OFF]] + --reinstall [Remove previous setup and reinstall (default:OFF)[options:ON/OFF]] + --backend [MIVisionX Dependency Backend - optional (default:HIP) [options:HIP/OCL/CPU]] --rocm_path [ROCm Installation Path - optional (default:/opt/rocm) - ROCm Installation Required] ``` **Note:** @@ -273,7 +273,7 @@ macOS [build instructions](https://github.com/GPUOpen-ProfessionalCompute-Librar + run the setup script to install all the dependencies required by the **OPENCL** GPU backend: ``` - python MIVisionX-setup.py --reinstall yes --backend OCL + python MIVisionX-setup.py --reinstall ON --backend OCL ``` + run the below commands to build MIVisionX with the **OPENCL** GPU backend: @@ -443,7 +443,7 @@ Review all notable [changes](CHANGELOG.md#changelog) with the latest release * RPP - [0.99](https://github.com/GPUOpen-ProfessionalCompute-Libraries/rpp/releases/tag/0.99) * FFMPEG - [n4.4.2](https://github.com/FFmpeg/FFmpeg/releases/tag/n4.4.2) * Dependencies for all the above packages -* MIVisionX Setup Script - `V2.3.10` +* MIVisionX Setup Script - `V2.4.0` ### Known issues diff --git a/amd_openvx/cmake/FindAMDRPP.cmake b/amd_openvx/cmake/FindAMDRPP.cmake index f2474f117f..b67c376f35 100644 --- a/amd_openvx/cmake/FindAMDRPP.cmake +++ b/amd_openvx/cmake/FindAMDRPP.cmake @@ -26,7 +26,7 @@ find_path(AMDRPP_INCLUDE_DIRS NAMES rpp.h PATHS - /usr/include + /usr/local/include/rpp ${ROCM_PATH}/include/rpp ) mark_as_advanced( AMDRPP_INCLUDE_DIRS ) @@ -34,7 +34,7 @@ mark_as_advanced( AMDRPP_INCLUDE_DIRS ) find_library( AMDRPP_LIBRARIES NAMES amd_rpp PATHS - /usr/lib + /usr/local/lib ${ROCM_PATH}/lib ) mark_as_advanced( AMDRPP_LIBRARIES_DIR ) @@ -42,7 +42,7 @@ mark_as_advanced( AMDRPP_LIBRARIES_DIR ) find_path(AMDRPP_LIBRARIES_DIR NAMES libamd_rpp.so PATHS - /usr/lib + /usr/local/lib ${ROCM_PATH}/lib )