Skip to content

Commit

Permalink
6.2.4 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivamd committed Oct 18, 2024
1 parent fbab5ed commit 6275997
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 9 deletions.
17 changes: 14 additions & 3 deletions amdgpuinst.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Modified by: Sanjay Tripathi (sanjay.tripathi@amd.com)
#
# Download and install the AMDGPU DKMS for the specified ROCm version
# V1.55: fix for 6.2.4
# V1.54: fix package installation on ubuntu
# V1.53: add folder to pathname
# V1.52: fix repourl option for CI builds
Expand Down Expand Up @@ -567,8 +568,13 @@ def get_deb_pkglist(rocmurl, pkgtype, ubuntutype, ubuntudist=None):
pkgname = line[mat.start()+len("Filename: "):mat.end()]
if ("amdgpu-dkms".lower() in pkgname.lower()
or "amdgpu-core".lower() in pkgname.lower()
or "gst-omx-amdgpu".lower() in pkgname.lower()
or "libdrm2-amdgpu".lower() in pkgname.lower()
or "libllvm".lower() in pkgname.lower()
or "libwayland-amdgpu".lower() in pkgname.lower()
or "amdgpu-multimedia".lower() in pkgname.lower()
or "mesa-amdgpu".lower() in pkgname.lower()
or "mesa-va".lower() in pkgname.lower()
or "libdrm-amdgpu".lower() in pkgname.lower()):
rockset.add(pkgname)
continue
Expand All @@ -589,16 +595,21 @@ def get_pkglist(rocmurl, pkgtype):
global rocklist
urlpath = rocmurl
try:
for folders in ["a", "l"]:
for folders in ["a", "g", "l", "m"]:
urld = request.urlopen(urlpath + "/" + folders)
for line in str.splitlines(urld.read().decode('utf-8'), True):
mat = re.search(rf'".*\.{pkgtype}"', line)
if mat:
pkgname = line[mat.start()+1:mat.end()-1]
if ("amdgpu-dkms".lower() in pkgname.lower()
or "amdgpu-core".lower() in pkgname.lower()
or "gst-omx-amdgpu".lower() in pkgname.lower()
or "libdrm2-amdgpu".lower() in pkgname.lower()
or "libllvm".lower() in pkgname.lower()
or "libwayland-amdgpu".lower() in pkgname.lower()
or "amdgpu-multimedia".lower() in pkgname.lower()
or "mesa-amdgpu".lower() in pkgname.lower()
or "mesa-va".lower() in pkgname.lower()
or "libdrm-amdgpu".lower() in pkgname.lower()):
rockset.add(folders + "/" + pkgname)
continue
Expand Down Expand Up @@ -946,7 +957,7 @@ def download_install_rocm_deb(args, rocmbaseurl, ubuntutype):
# --destdir DESTDIR directory to download rpm for installation
#
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=('[V1.54]amdgpuinst.py: utility to '
parser = argparse.ArgumentParser(description=('[V1.55]amdgpuinst.py: utility to '
' download and install AMDGPU DKMS ROCm packages for specified rev'
' (dkms, kernel headers must be installed, requires sudo privilege) '),
prefix_chars='-')
Expand Down Expand Up @@ -1041,7 +1052,7 @@ def download_install_rocm_deb(args, rocmbaseurl, ubuntutype):
sys.exit(1)

# Log version and date of run
print("Running V1.54 amdgpuinst.py utility for OS: " + ostype + " on: " + str(datetime.datetime.now()))
print("Running V1.55 amdgpuinst.py utility for OS: " + ostype + " on: " + str(datetime.datetime.now()))

#
# Set pkgtype to use based on ostype
Expand Down
82 changes: 76 additions & 6 deletions rocminstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Modified by: Sid Srinivasan (sid.srinivasan@amd.com)
#
# Download and install a specific ROCm version
# V1.78: update ubuntu for rocm amdgpu repo cross dependencies
# V1.77: remove prints
# V1.76: remove miopen-hip-gfx miopenkernel
# V1.75: bug fix
Expand Down Expand Up @@ -363,7 +364,6 @@ def get_deb_pkglist(rocmurl, revstring, pkgtype, ubuntutype, ubuntudist=None):
or "MIVisionX-nvcc".lower() in pkgname.lower()
or "hip-nvcc".lower() in pkgname.lower()
or "nvidia".lower() in pkgname.lower()
or "rdc".lower() in pkgname.lower()
or "-rpath".lower() in pkgname.lower()
or "rccl-rdma-sharp".lower() in pkgname.lower()
or "rocm-gdb-tests".lower() in pkgname.lower()
Expand Down Expand Up @@ -541,7 +541,6 @@ def get_pkglist(rocmurl, revstring, pkgtype):
or "MIVisionX-nvcc".lower() in pkgname.lower()
or "hip-nvcc".lower() in pkgname.lower()
or "nvidia".lower() in pkgname.lower()
or "rdc".lower() in pkgname.lower()
or "-rpath".lower() in pkgname.lower()
or "rocm-gdb-tests".lower() in pkgname.lower()
or "rccl-rdma-sharp".lower() in pkgname.lower()
Expand Down Expand Up @@ -754,6 +753,21 @@ def setup_sles_zypp_repo(args, fetchurl):
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# amdgpu: use rev specific rocm repo
zypprepo = "[amdgpu" + args.revstring[0] + "]\nenabled=1\nautorefresh=0\nbaseurl=" + fetchurl + "\ntype=rpm-md\ngpgcheck=0"
echocmd = ECHO_CMD + " -e '" + zypprepo + "' "
repofilename = "/etc/zypp/repos.d/amdgpu" + args.revstring[0] + ".repo "
teecmd = TEE_CMD + " " + repofilename + " "
try:
ps1 = subprocess.Popen(shlex.split(echocmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(teecmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)

# zypper install ROCm dependencies - starting with ROCm 4.1.1!
zypprefresh = ZYPPER_CMD + " addrepo https://download.opensuse.org/repositories/devel:languages:perl/SLE_15/devel:languages:perl.repo"
try:
Expand Down Expand Up @@ -890,6 +904,21 @@ def setup_centos_repo(args, fetchurl):
for line in str.splitlines(err.output.decode('utf-8')):
print(line)

# amdgpu: use rev specific rocm repo
yumrepo = "[AMDGPU" + args.revstring[0] +"]\nname=AMDGPU\nbaseurl=" + fetchurl + "\nenabled=1\ngpgcheck=0"
echocmd = ECHO_CMD + " -e '" + yumrepo + "' "
repofilename = "/etc/yum.repos.d/amdgpu" + args.revstring[0] + ".repo"
teecmd = TEE_CMD + " " + repofilename + " "
try:
ps1 = subprocess.Popen(shlex.split(echocmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(teecmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)

# install ROCm dependencies - starting with ROCm 4.1.1!!
yumupdate = YUM_CMD + " install --assumeyes perl-File-Which perl-File-BaseDir perl-File-Copy-Recursive perl-URI-Encode "
try:
Expand Down Expand Up @@ -975,6 +1004,16 @@ def remove_centos_repo(args, fetchurl):
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# remove amdgpu repo for chosen rev to install
# use rev specific rocm repo
repofilename = "/etc/yum.repos.d/amdgpu" + args.revstring[0] + ".repo"
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)

# clean repo
yumupdate = YUM_CMD + " clean all "
try:
Expand All @@ -995,6 +1034,15 @@ def remove_sles_zypp_repo(args, fetchurl):
# use rev specific rocm repo
repofilename = "/etc/zypp/repos.d/rocm" + args.revstring[0] + ".repo "
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# remove amdgpu repo for chosen rev to install
# use rev specific rocm repo
repofilename = "/etc/zypp/repos.d/amdgpu" + args.revstring[0] + ".repo "
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
Expand Down Expand Up @@ -1047,6 +1095,22 @@ def setup_debian_repo(args, fetchurl, ubuntutype):
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)

# amdgpu-repo: use rev specific rocm repo
debrepo = "deb [arch=amd64] " + fetchurl + " " + ubuntutype + " main "
echocmd = ECHO_CMD + " '" + debrepo + "' "
repofilename = "/etc/apt/sources.list.d/amdgpu" + args.revstring[0] + ".list "
teecmd = TEE_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(shlex.split(echocmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(teecmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)

# apt update repo
aptupdate = APT_CMD + " clean"
try:
Expand All @@ -1071,8 +1135,6 @@ def setup_debian_repo(args, fetchurl, ubuntutype):
for line in str.splitlines(err.output.decode('utf-8')):
print(line)



def remove_debian_repo(args, fetchurl):
global pkglist
global rocklist
Expand All @@ -1085,6 +1147,14 @@ def remove_debian_repo(args, fetchurl):
# use rev specific rocm repo
repofilename = "/etc/apt/sources.list.d/rocm" + args.revstring[0] + ".list "
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# remove amdgpu-repo
repofilename = "/etc/apt/sources.list.d/amdgpu" + args.revstring[0] + ".list "
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
Expand Down Expand Up @@ -1209,7 +1279,7 @@ def download_install_rocm_deb(args, rocmbaseurl, ubuntutype, ubuntudist=None):
# --destdir DESTDIR directory to download rpm for installation
#
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=('[V1.77]rocminstall.py: utility to '
parser = argparse.ArgumentParser(description=('[V1.78]rocminstall.py: utility to '
' download and install ROCm packages for specified rev'
' (dkms, kernel headers must be installed, requires sudo privilege) '),
prefix_chars='-')
Expand Down Expand Up @@ -1338,7 +1408,7 @@ def download_install_rocm_deb(args, rocmbaseurl, ubuntutype, ubuntudist=None):
sys.exit(1)

# Log version and date of run
print("Running V1.77 rocminstall.py utility for OS: " + ostype + " on: " + str(datetime.datetime.now()))
print("Running V1.78 rocminstall.py utility for OS: " + ostype + " on: " + str(datetime.datetime.now()))

#
# Set pkgtype to use based on ostype
Expand Down

0 comments on commit 6275997

Please sign in to comment.