Skip to content

Commit

Permalink
MIVisionX Setup Script Fix (#6)
Browse files Browse the repository at this point in the history
* MIVisionX Setup Script updates

*  MIVisionX-setup.py Readme updates
  • Loading branch information
kiritigowda authored Jan 3, 2019
1 parent c522946 commit 2c92f15
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 112 deletions.
185 changes: 84 additions & 101 deletions MIVisionX-setup.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,32 @@
__author__ = "Kiriti Nagesh Gowda"
__copyright__ = "Copyright 2018, AMD Radeon MIVisionX setup"
__license__ = "MIT"
__version__ = "0.9.9"
__version__ = "0.9.91"
__maintainer__ = "Kiriti Nagesh Gowda"
__email__ = "Kiriti.NageshGowda@amd.com"
__status__ = "beta"

import argparse
import os
import getopt
import sys
import subprocess
from subprocess import call


opts, args = getopt.getopt(sys.argv[1:], 's:d:l:m:')
sudoPassword = ''
setupDir = ''
MIOpenVersion = ''
linuxSystemInstall = ''
# 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='1.7.0', help='MIOpen Version - optional (default:1.7.0)')
args = parser.parse_args()

for opt, arg in opts:
if opt == '-s':
sudoPassword = arg
elif opt =='-d':
setupDir = arg
elif opt =='-m':
MIOpenVersion = arg
elif opt =='-l':
linuxSystemInstall = arg

if sudoPassword == '':
print('Invalid command line arguments.\n \t\t\t\t-s [sudo password - required]\n '\
'\t\t\t\t-d [setup directory - optional]\n '\
'\t\t\t\t-l [Linux system install - optional (default:apt-get options:apt-get/yum)]\n '\
'\t\t\t\t-m [MIOpen Version - optional (default:1.6.0)]\n')
exit()
setupDir = args.directory
linuxSystemInstall = args.installer
MIOpenVersion = args.miopen

if setupDir == '':
setupDir_deps = '~/deps'
else:
setupDir_deps = setupDir+'/deps'

if MIOpenVersion == '':
MIOpenVersion = '1.6.0'

# setup for CentOS or Ubuntu
linuxSystemInstall_check = '--nogpgcheck'
linuxCMake = 'cmake3'
linuxFlag = ''
Expand All @@ -54,82 +36,83 @@
linuxCMake = 'cmake'
linuxFlag = '-S'
else:
cmd='sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install cmake3 boost boost-thread boost-devel openssl-devel'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install cmake3 boost boost-thread boost-devel openssl-devel')

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

# MIVisionX setup
if(os.path.exists(deps_dir)):
print("\nMIVisionX Dependencies Installed\n")
else:
print("\nMIVisionX Dependencies Installation\n")
cmd='sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install cmake git wget unzip'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
os.system('(cd '+setupDir+'; mkdir deps)');
os.system('(cd '+deps_dir+'; git clone https://github.com/RadeonOpenCompute/rocm-cmake.git )');
os.system('(cd '+deps_dir+'; git clone https://github.com/ROCmSoftwarePlatform/MIOpenGEMM.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/v3.5.2.zip )');
os.system('(cd '+deps_dir+'; unzip v3.5.2.zip )');
os.system('(cd '+deps_dir+'; wget https://github.com/opencv/opencv/archive/3.3.0.zip )');
os.system('(cd '+deps_dir+'; unzip 3.3.0.zip )');
os.system('(cd '+deps_dir+'; mkdir build )');
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 )');
cmd='(cd '+deps_dir+'/build/rocm-cmake; sudo '+linuxFlag+' make install )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; '+linuxCMake+' ../../MIOpenGEMM )');
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; make -j8 )');
cmd='(cd '+deps_dir+'/build/MIOpenGEMM; sudo '+linuxFlag+' make install )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/MIOpen-'+MIOpenVersion+'; sudo '+linuxFlag+' '+linuxCMake+' -P install_deps.cmake )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install libssl-dev libboost-dev libboost-system-dev libboost-filesystem-dev )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
os.system('(cd '+deps_dir+'/build/MIOpen; '+linuxCMake+' -DMIOPEN_BACKEND=OpenCL ../../MIOpen-'+MIOpenVersion+' )');
os.system('(cd '+deps_dir+'/build/MIOpen; make -j8 )');
os.system('(cd '+deps_dir+'/build/MIOpen; make MIOpenDriver )');
cmd='(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' make install )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/build/MIOpen; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install autoconf automake libtool curl make g++ unzip )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
os.system('(cd '+deps_dir+'/protobuf-3.5.2; git submodule update --init --recursive )');
os.system('(cd '+deps_dir+'/protobuf-3.5.2; ./autogen.sh )');
os.system('(cd '+deps_dir+'/protobuf-3.5.2; ./configure )');
os.system('(cd '+deps_dir+'/protobuf-3.5.2; make -j16 )');
os.system('(cd '+deps_dir+'/protobuf-3.5.2; make check -j16 )');
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' make install )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' ldconfig )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-pip )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' yes | pip install protobuf )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' yes | pip install pytz )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' yes | pip install numpy )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='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'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
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.3.0 )');
os.system('(cd '+deps_dir+'/build/OpenCV; make -j8 )');
cmd='(cd '+deps_dir+'/build/OpenCV; sudo '+linuxFlag+' make install )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='(cd '+deps_dir+'/build/OpenCV; sudo '+linuxFlag+' ldconfig )'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install inxi aha libboost-python-dev build-essential'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-matplotlib python-numpy python-pil python-scipy python-skimage cython'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
cmd='sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install qt5-default qtcreator'
call('echo {} | {}'.format(sudoPassword, cmd), shell=True)
os.system('sudo -v')
os.system('sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install cmake git wget unzip')
os.system('(cd '+setupDir+'; mkdir deps)')
os.system('(cd '+setupDir+'; mkdir deps)')
os.system('(cd '+deps_dir+'; git clone https://github.com/RadeonOpenCompute/rocm-cmake.git )')
os.system('(cd '+deps_dir+'; git clone https://github.com/ROCmSoftwarePlatform/MIOpenGEMM.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/v3.5.2.zip )')
os.system('(cd '+deps_dir+'; unzip v3.5.2.zip )')
os.system('(cd '+deps_dir+'; wget https://github.com/opencv/opencv/archive/3.3.0.zip )')
os.system('(cd '+deps_dir+'; unzip 3.3.0.zip )')
os.system('(cd '+deps_dir+'; mkdir build )')
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 )')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; '+linuxCMake+' ../../MIOpenGEMM )')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; make -j8 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/build/MIOpenGEMM; sudo '+linuxFlag+' make install )')
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 ../../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 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install autoconf automake libtool curl make g++ unzip )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' '+linuxSystemInstall+' autoremove )')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; ./autogen.sh )')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; ./configure )')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; make -j16 )')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; make check -j16 )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' make install )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' ldconfig )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' '+linuxSystemInstall+' -y '+linuxSystemInstall_check+' install python-pip )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' yes | pip install protobuf )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' yes | pip install pytz )')
os.system('sudo -v')
os.system('(cd '+deps_dir+'/protobuf-3.5.2; sudo '+linuxFlag+' yes | pip install numpy )')
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.3.0 )')
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')
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,16 @@ For convenience of the developer, we here provide the setup script which will in
2. [ROCm supported hardware](https://rocm.github.io/hardware.html)
3. [ROCm](https://github.com/RadeonOpenCompute/ROCm#installing-from-amd-rocm-repositories)

**MIVisionX-setup.py** - This scipts builds all the prerequisites required by MIVisionX. The setup script creates a deps folder and installs all the prerequisites, this script only needs to be executed once. If -d option for directory is not given the script will install deps folder in '~/' directory by default, else in the user specified folder.
**MIVisionX-setup.py** - This scipts builds all the prerequisites required by MIVisionX. The setup script creates a deps folder and installs all the prerequisites, this script only needs to be executed once. If --directory option is not given the script will install deps folder in '~/' directory by default, else in the user specified folder.

usage:

````
python MIVisionX-setup.py -s [sudo password - required]
-d [setup directory - optional]
-l [Linux system install - optional (default:apt-get options:apt-get/yum)]
-m [MIOpen Version - optional (default:1.6.0)]
python MIVisionX-setup.py --directory [setup directory - optional]
--installer [Package management tool - optional (default:apt-get) [options: Ubuntu:apt-get;CentOS:yum]]
--miopen [MIOpen Version - optional (default:1.7.0)]
````
*Note:* use `-l yum` for CentOS
*Note:* use `--installer yum` for CentOS

##### Refer to [Wiki](https://github.com/GPUOpen-ProfessionalCompute-Libraries/amdovx-modules/wiki) page for developer instructions.

Expand Down Expand Up @@ -125,12 +124,11 @@ git clone --recursive https://github.com/GPUOpen-ProfessionalCompute-Libraries/M
cd MIVisionX
````
````
python MIVisionX-setup.py -s [sudo password - required]
-d [setup directory - optional]
-l [Linux system install - optional (default:apt-get options:apt-get/yum)]
-m [MIOpen Version - optional (default:1.6.0)]
python MIVisionX-setup.py --directory [setup directory - optional]
--installer [Package management tool - optional (default:apt-get) [options: Ubuntu:apt-get;CentOS:yum]]
--miopen [MIOpen Version - optional (default:1.7.0)]
````
*Note:* Use `-l yum` for CentOS
*Note:* Use `--installer yum` for CentOS
````
mkdir build
cd build
Expand Down

0 comments on commit 2c92f15

Please sign in to comment.