Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists & Setup Update #355

Merged
merged 8 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

cmake_minimum_required(VERSION 2.8)
project(MIVisionX)
set(VERSION "1.9.1")
set(VERSION "1.9.2")

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand Down Expand Up @@ -48,11 +48,19 @@ if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif()

option(NEURAL_NET "Build MIVisionX with Neural Net Support" ON)
option(RALI "Build MIVisionX with RALI Support" ON)
option(LOOM "Build MIVisionX with LOOM Support" ON)

add_subdirectory(amd_openvx)
add_subdirectory(amd_openvx_extensions)
add_subdirectory(apps)
add_subdirectory(utilities)
add_subdirectory(rali)
if(RALI)
add_subdirectory(rali)
else()
message("-- ${BoldBlue}RALI Module turned OFF by user option -DRALI=OFF ${ColourReset}")
endif()

install(DIRECTORY docs DESTINATION .)

Expand Down
213 changes: 115 additions & 98 deletions MIVisionX-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
__author__ = "Kiriti Nagesh Gowda"
__copyright__ = "Copyright 2018 - 2020, AMD Radeon MIVisionX setup"
__license__ = "MIT"
__version__ = "1.7.13"
__version__ = "1.8.0"
__maintainer__ = "Kiriti Nagesh Gowda"
__email__ = "Kiriti.NageshGowda@amd.com"
__status__ = "Shipping"
Expand All @@ -36,25 +36,29 @@

# Import arguments
parser = argparse.ArgumentParser()
parser.add_argument('--directory', type=str, default='', help='Setup home directory - optional (default:~/)')
parser.add_argument('--installer', type=str, default='apt-get', help='Linux system installer - optional (default:apt-get) [options: Ubuntu - apt-get; CentOS - yum]')
parser.add_argument('--miopen', type=str, default='2.5.0', help='MIOpen Version - optional (default:2.5.0)')
parser.add_argument('--miopengemm',type=str, default='1.1.5', help='MIOpenGEMM Version - optional (default:1.1.5)')
parser.add_argument('--protobuf', type=str, default='3.12.0', help='ProtoBuf Version - optional (default:3.12.0)')
parser.add_argument('--ffmpeg', type=str, default='no', help='FFMPEG Installation - optional (default:no) [options:yes/no]')
parser.add_argument('--rpp', type=str, default='yes', help='Radeon Performance Primitives (RPP) Installation - optional (default:yes) [options:yes/no]')
parser.add_argument('--rpp_ver', type=str, default='0.4', help='RPP Version - optional (default:0.4)')
parser.add_argument('--reinstall', type=str, default='no', help='Remove previous setup and reinstall - optional (default:no) [options:yes/no]')
parser.add_argument('--directory', type=str, default='~/mivisionx-deps', help='Setup home directory - optional (default:~/)')
parser.add_argument('--installer', type=str, default='apt-get', help='Linux system installer - optional (default:apt-get) [options: Ubuntu - apt-get; CentOS - yum]')
parser.add_argument('--opencv', type=str, default='3.4.0', help='OpenCV Version - optional (default:3.4.0)')
parser.add_argument('--miopen', type=str, default='2.5.0', help='MIOpen Version - optional (default:2.5.0)')
parser.add_argument('--miopengemm', type=str, default='1.1.5', help='MIOpenGEMM Version - optional (default:1.1.5)')
parser.add_argument('--protobuf', type=str, default='3.12.0', help='ProtoBuf Version - optional (default:3.12.0)')
parser.add_argument('--rpp', type=str, default='0.4', help='RPP Version - optional (default:0.4)')
parser.add_argument('--ffmpeg', type=str, default='no', help='FFMPEG 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('--rali', type=str, default='yes', help='MIVisionX RALI 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]')
args = parser.parse_args()

setupDir = args.directory
linuxSystemInstall = args.installer
opencvVersion = args.opencv
MIOpenVersion = args.miopen
MIOpenGEMMVersion = args.miopengemm
ProtoBufVersion = args.protobuf
rppVersion = args.rpp
ffmpegInstall = args.ffmpeg
rppInstall = args.rpp
rppVersion = args.rpp_ver
neuralNetInstall = args.neural_net
raliInstall = args.rali
reinstall = args.reinstall

# sudo requirement check
Expand All @@ -69,12 +73,15 @@
if sudoLocation != '/usr/bin/sudo':
status, userName = subprocess.getstatusoutput("whoami")


if setupDir == '':
setupDir_deps = '~/mivisionx-deps'
# Setup Directory for Deps
if setupDir == '~/mivisionx-deps':
setupDir_deps = setupDir
else:
setupDir_deps = setupDir+'/mivisionx-deps'

# setup directory
deps_dir = os.path.expanduser(setupDir_deps)

# setup for CentOS or Ubuntu
linuxSystemInstall_check = '--nogpgcheck'
linuxCMake = 'cmake3'
Expand All @@ -96,29 +103,28 @@
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install cmake3 boost boost-thread boost-devel')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install openssl-devel hg autoconf automake')

# setup directory
deps_dir = os.path.expanduser(setupDir_deps)

# Delete previous install
if(os.path.exists(deps_dir) and reinstall == 'yes'):
os.system('sudo -v')
os.system('sudo rm -rf '+deps_dir)

# MIVisionX setup
if(os.path.exists(deps_dir)):
os.system('sudo -v')
os.system('(cd '+deps_dir+'; sudo cp half-files/include/half.hpp /usr/local/include/ )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/rocm-cmake; sudo '+linuxFlag+' make install -j8)')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; sudo '+linuxFlag+' make install -j8)')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' make install -j8)')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' make install -j8)')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/OpenCV; sudo '+linuxFlag+' make install -j8)')
if rppInstall == 'yes':
if neuralNetInstall == 'yes':
kiritigowda marked this conversation as resolved.
Show resolved Hide resolved
os.system('sudo -v')
os.system('(cd '+deps_dir+'; sudo cp half-files/include/half.hpp /usr/local/include/ )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/rocm-cmake; sudo '+linuxFlag+' make install -j8)')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; sudo '+linuxFlag+' make install -j8)')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' make install -j8)')
if raliInstall == 'yes' or neuralNetInstall == 'yes':
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' make install -j8)')
kiritigowda marked this conversation as resolved.
Show resolved Hide resolved
if raliInstall == 'yes':
os.system('sudo -v')
os.system('(cd '+deps_dir+'/rpp/build; sudo '+linuxFlag+' make install -j8)')
if ffmpegInstall == 'yes':
Expand All @@ -127,90 +133,101 @@
print("\nMIVisionX Dependencies Installed with MIVisionX-setup.py V-"+__version__+"\n")
else:
print("\nMIVisionX Dependencies Installation with MIVisionX-setup.py V-"+__version__+"\n")
os.system('mkdir '+deps_dir)
# Create Build folder
os.system('(cd '+deps_dir+'; mkdir build )')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install cmake git wget unzip')
os.system('(cd '+setupDir+'; mkdir mivisionx-deps)')
# Get Installation Source
os.system('(cd '+deps_dir+'; git clone https://github.com/RadeonOpenCompute/rocm-cmake.git )')
os.system('(cd '+deps_dir+'; wget https://github.com/ROCmSoftwarePlatform/MIOpenGEMM/archive/'+MIOpenGEMMVersion+'.zip )')
os.system('(cd '+deps_dir+'; unzip '+MIOpenGEMMVersion+'.zip )')
os.system('(cd '+deps_dir+'; wget https://github.com/opencv/opencv/archive/'+opencvVersion+'.zip )')
os.system('(cd '+deps_dir+'; unzip '+opencvVersion+'.zip )')
if neuralNetInstall == 'yes':
os.system('(cd '+deps_dir+'; git clone https://github.com/RadeonOpenCompute/rocm-cmake.git )')
os.system('(cd '+deps_dir+'; wget https://github.com/ROCmSoftwarePlatform/MIOpenGEMM/archive/'+MIOpenGEMMVersion+'.zip )')
os.system('(cd '+deps_dir+'; unzip '+MIOpenGEMMVersion+'.zip )')
os.system('(cd '+deps_dir+'; wget https://github.com/ROCmSoftwarePlatform/MIOpen/archive/'+MIOpenVersion+'.zip )')
os.system('(cd '+deps_dir+'; unzip '+MIOpenVersion+'.zip )')
if raliInstall == 'yes' or neuralNetInstall == 'yes':
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':
os.system('(cd '+deps_dir+'; git clone --recursive -b n4.0.4 https://git.ffmpeg.org/ffmpeg.git )')
os.system('(cd '+deps_dir+'; wget https://github.com/ROCmSoftwarePlatform/MIOpen/archive/'+MIOpenVersion+'.zip )')
os.system('(cd '+deps_dir+'; unzip '+MIOpenVersion+'.zip )')
os.system('(cd '+deps_dir+'; wget https://github.com/protocolbuffers/protobuf/archive/v'+ProtoBufVersion+'.zip )')
os.system('(cd '+deps_dir+'; unzip v'+ProtoBufVersion+'.zip )')
os.system('(cd '+deps_dir+'; wget https://github.com/opencv/opencv/archive/3.4.0.zip )')
os.system('(cd '+deps_dir+'; unzip 3.4.0.zip )')
os.system('(cd '+deps_dir+'; mkdir build )')
# Install half.hpp
os.system('(cd '+deps_dir+'; wget https://sourceforge.net/projects/half/files/half/1.12.0/half-1.12.0.zip )')
os.system('(cd '+deps_dir+'; unzip half-1.12.0.zip -d half-files )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'; sudo cp half-files/include/half.hpp /usr/local/include/ )')
# Install ROCm-CMake
os.system('(cd '+deps_dir+'/build; mkdir rocm-cmake MIOpenGEMM MIOpen OpenCV )')
os.system('(cd '+deps_dir+'/build/rocm-cmake; '+linuxCMake+' ../../rocm-cmake )')
os.system('(cd '+deps_dir+'/build/rocm-cmake; make -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/rocm-cmake; sudo '+linuxFlag+' make install )')
# Install MIOpenGEMM
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; '+linuxCMake+' ../../MIOpenGEMM-'+MIOpenGEMMVersion+' )')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; make -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; sudo '+linuxFlag+' make install )')
# Install MIOpen
os.system('sudo -v')
os.system('(cd '+deps_dir+'/MIOpen-'+MIOpenVersion+'; sudo '+linuxFlag+' '+linuxCMake+' -P install_deps.cmake )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install libssl-dev libboost-dev libboost-system-dev libboost-filesystem-dev )')
os.system('(cd '+deps_dir+'/build/MIOpen; '+linuxCMake+' -DMIOPEN_BACKEND=OpenCL -DMIOPEN_USE_MIOPENGEMM=On ../../MIOpen-'+MIOpenVersion+' )')
os.system('(cd '+deps_dir+'/build/MIOpen; make -j8 )')
os.system('(cd '+deps_dir+'/build/MIOpen; make MIOpenDriver )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' make install )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )')
# Install ProtoBuf
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install autoconf automake libtool curl make g++ unzip )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; ./autogen.sh )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; ./configure )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; make -j8 )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; make check -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' make install )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' ldconfig )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-pip )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' yes | pip install protobuf )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' yes | pip install pytz )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' yes | pip install numpy )')
# Install
if neuralNetInstall == 'yes':
os.system('(cd '+deps_dir+'/build; mkdir rocm-cmake MIOpenGEMM MIOpen)')
# Install half.hpp
os.system('(cd '+deps_dir+'; wget https://sourceforge.net/projects/half/files/half/1.12.0/half-1.12.0.zip )')
os.system('(cd '+deps_dir+'; unzip half-1.12.0.zip -d half-files )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'; sudo cp half-files/include/half.hpp /usr/local/include/ )')
# Install ROCm-CMake
os.system('(cd '+deps_dir+'/build/rocm-cmake; '+linuxCMake+' ../../rocm-cmake )')
os.system('(cd '+deps_dir+'/build/rocm-cmake; make -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/rocm-cmake; sudo '+linuxFlag+' make install )')
# Install MIOpenGEMM
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; '+linuxCMake+' ../../MIOpenGEMM-'+MIOpenGEMMVersion+' )')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; make -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; sudo '+linuxFlag+' make install )')
# Install MIOpen
os.system('sudo -v')
os.system('(cd '+deps_dir+'/MIOpen-'+MIOpenVersion+'; sudo '+linuxFlag+' '+linuxCMake+' -P install_deps.cmake )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install libssl-dev libboost-dev libboost-system-dev libboost-filesystem-dev )')
os.system('(cd '+deps_dir+'/build/MIOpen; '+linuxCMake+' -DMIOPEN_BACKEND=OpenCL -DMIOPEN_USE_MIOPENGEMM=On ../../MIOpen-'+MIOpenVersion+' )')
os.system('(cd '+deps_dir+'/build/MIOpen; make -j8 )')
os.system('(cd '+deps_dir+'/build/MIOpen; make MIOpenDriver )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' make install )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )')
# Install Packages for NN Apps
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install inxi aha libboost-python-dev build-essential')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-matplotlib python-numpy python-pil python-scipy python-skimage cython')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install qt5-default qtcreator')
if raliInstall == 'yes' or neuralNetInstall == 'yes':
# Install ProtoBuf
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install autoconf automake libtool curl make g++ unzip )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; ./autogen.sh )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; ./configure )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; make -j8 )')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; make check -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' make install )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' ldconfig )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-'+ProtoBufVersion+'; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-pip )')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' yes | pip install protobuf')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' yes | pip install pytz')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' yes | pip install numpy')
# Install OpenCV
os.system('(cd '+deps_dir+'/build; mkdir OpenCV )')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev')
os.system('(cd '+deps_dir+'/build/OpenCV; '+linuxCMake+' -DWITH_OPENCL=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_VA_INTEL=OFF -DWITH_OPENCL_SVM=OFF ../../opencv-3.4.0 )')
os.system('(cd '+deps_dir+'/build/OpenCV; '+linuxCMake+' -DWITH_OPENCL=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_VA_INTEL=OFF -DWITH_OPENCL_SVM=OFF ../../opencv-'+opencvVersion+' )')
os.system('(cd '+deps_dir+'/build/OpenCV; make -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/OpenCV; sudo '+linuxFlag+' make install )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/OpenCV; sudo '+linuxFlag+' ldconfig )')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install inxi aha libboost-python-dev build-essential')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-matplotlib python-numpy python-pil python-scipy python-skimage cython')
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install qt5-default qtcreator')
# Install RPP
if rppInstall == 'yes':
if raliInstall == 'yes':
# Install Packages for RALI
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install libgflags-dev libgoogle-glog-dev liblmdb-dev')
# Install RPP
#Yasm/Nasm for TurboJPEG
if linuxSystemInstall == 'apt-get':
os.system('sudo -v')
Expand Down
Loading