-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrocminstall.py
executable file
·1630 lines (1520 loc) · 70.7 KB
/
rocminstall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
#
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
# Author: Srinivasan Subramanian ([email protected])
# Modified by: Iris (Ci) Tian ([email protected])
# Modified by: Sudharsan Thiruvengadam (Steve) ([email protected])
# Modified by: Sid Srinivasan ([email protected])
#
# Download and install a specific ROCm version
# V1.79: exclude dbgsym and -asan packages
# 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
# V1.74: add noble, fix debian repo set up
# V1.73: bug fix
# V1.72: withrocdecode check bug fix
# V1.71: Bug fix baseurl default check
# V1.70: 6.1 deprecates rocm-ocl-icd, use rocm-opencl-blah
# : add baseurl default to override for internal docker builds
# V1.69: Update 6.1 RC, exclude rocdecode pkg by default, deps on amdgpu
# V1.68: Fix repourl pkg list, include mivisionx
# V1.67: Fix ubuntutype detection,only focal, jammy
# V1.66: 5.7.1 GA
# V1.65: Added ubuntudist cmdline argument for docker use
# V1.64: Fix revstring variable reference
# V1.63: 5.6.x support
# V1.62: 5.5.x support
# V1.61: 5.4.x support
# V1.60: Fix justrdc
# V1.59: Fix 5.4 Ubuntu breakage
# V1.58: RockyL --enablerepo=crb
# V1.57: Add Rocky Linux support
# V1.55 No 5.3+ rocm support for centos fix
# V1.54: RHEL8, RHEL9 fix
# V1.53: 5.3.x release
# V1.52: 5.2.x release
# V1.51: Fix rocm gpgkey path
# V1.50: Add support for 5.1.3
# V1.49: CentOS, SLES use main/ repo from 5.1
# V1.48: Add support for 5.1.1 release
# V1.47: Fix rev pattern len, check
# V1.46: Add support for 5.0.1 release
# V1.45: Add support 5.0 release
# V1.44: Fix touch version error for 4.5.2
# V1.43: Only user packages installation ROCm 4.5 (fix dkms check)
# Use ubuntu not xenial
# V1.42: Only user packages installation ROCm 4.5 (amdgpu separated)
# V1.41: fix ubuntu repo: change xenial to ubuntu
# V1.40: add support for 4.5 (filter out nvidia pkgs)
# V1.39: add support for 4.4.1
# V1.38: add support for 4.3.1
# V1.37: for internal repo: filter out gdb-tests
# V1.36: 4.3 release fix, do not install rccl-rdma-sharp pkg
# V1.35: Fix miopenkernels name pattern
# V1.34: Add 4.1.1 dependencies extras
# V1.33: Add support for 4.1.1
# V1.32: (for internal use) suppress rocfft-client install
# V1.31: Add --nomiopenkernels to exclude pre-built miopenkernels pkgs
# V1.30: Add --justrdc to install only RDC package
# V1.29: Add support for 4.0.1 release (uses 4.0.1 in pkg name)
# V1.28: Fix touch bug cut-and-paste typo
# V1.27: Fix touch for 3.9.1 (dot releases)
# V1.26: Add support 3.9.1 (uses 3.9.1 string in pkg name!)
# V1.25: Fix justkernel install on centos
# V1.24: Fix message - hipfot3.9.0 not installed
# V1.23: Create dummy .info/version workaround for 3.9
# V1.22: support for 3.10 release
# V1.21: rocm-dkms package not required to be installed (starting 3.9)
# don't install openmp-extras - packaging bug in 3.9
# V1.20: rocm-dkms changed in 3.9 release
# V1.19: remove 3.8 migraphx bug fix
# V1.18: rocm 3.8 bug: migraphx package missing in debian repo
# V1.17: add --justkernel option
# V1.16: SLES repo handling
# V1.15: Fix Debian repo setup
# Always extract rocm-dkms
# V1.14.1: Fix message
# V1.14: Allow 3.5.1 install
# Teardown repo setup after install
# V1.13: Add baseurl option
# Install miopenkernel packages
# V1.12: Do not install rdc ROCm package (requires gRPC preinstalled)
# V1.11: Add CentOS8/RHEL8 ROCm repo support
# Setup repo. Don't install hipify-clang package in 3.6 - bug
# Update usage to not dkms, kernel-headers should be preinstalled
# V1.10: Disable 3.5.1 install: 3.5.1 breaks 3.5.0 installation
# fix nokernel flag logic on Ubuntu
# V1.9: nokernel install fixes: Always install rocm-dkms to info/version
# Workaround for packaging bug, dependency on rocm-dkms
# Ubuntu: dpkg-deb extract rocm-dkms in nokernel XXX HACK XXX
# V1.8: Fix for Ubuntu/Debian install to setup repo, use apt install
# Add check for rhel OS type
# No support for CentOS/RHEL 8
# V1.7: Add workaround for ROCm 3.5 packaging bug in CentOS
# exclude hipify-clang package install on CentOS
# V1.6: Add --nokernel to skip rock-dkms kernel in docker installtion
# Remove rocm-dkms along with rock-dkms*
# Fix repourl option: set fetchurl
# V1.5: Launch install command in interactive/unbuffered mode
# V1.4: Added support for debian/ubuntu
# SLES broken, zypper non-interactive defaults a pain
# V1.3: Use yum on SLES
# Add support for Debian/Ubuntu
# V1.2: Install with dependencies using yum
# Handle 3.1.1 as special case
# Download all RPMs then install using yum (no --force install)
# Use --skip-broken to skip broken packages
# V1.1: Initial version 4/12/2010
# No support for Debian/Ubuntu, Only supports CentOS/SLES
#
from urllib import request
from urllib.request import urlretrieve
import re
import subprocess
import sys
import argparse
import os
import shlex
import datetime
# Set ROCm Release Package Distribution repo baseURL below
# External ROCM release baseurl for rpm/yum: http://repo.radeon.com/rocm/yum
rocmcentos8_base = "http://repo.radeon.com/rocm/centos8/"
rocmcentos9_base = "http://repo.radeon.com/rocm/rhel9/"
rocmrhel8_base = "http://repo.radeon.com/rocm/rhel8/"
rocmrhel9_base = "http://repo.radeon.com/rocm/rhel9/"
rocmyum_base = "http://repo.radeon.com/rocm/yum/"
rocmapt_base = "http://repo.radeon.com/rocm/apt/"
rocmzyp_base = "http://repo.radeon.com/rocm/zyp/"
# Commands
RM_F_CMD = "/bin/rm -f "
RPM_CMD = "/usr/bin/rpm"
YUM_CMD = "/usr/bin/yum"
DNF_CMD = "/usr/bin/dnf"
DPKG_CMD = "/usr/bin/dpkg"
DPKGDEB_CMD = "/usr/bin/dpkg-deb"
APTGET_CMD = "/usr/bin/apt-get"
APT_CMD = "/usr/bin/apt"
APTKEY_CMD = "/usr/bin/apt-key"
WGET_CMD = "/usr/bin/wget"
ZYPPER_CMD = "/usr/bin/zypper"
ECHO_CMD = "/bin/echo"
TEE_CMD = "/usr/bin/tee"
SUBSCRIBE_CMD = "/usr/bin/subscription-manager"
# Package type suffixes
PKGTYPE_RPM = "rpm"
PKGTYPE_DEB = "deb"
# Supported OS types
CENTOS_TYPE = "centos" # Version 7
CENTOS8_TYPE = "centos8"
CENTOS9_TYPE = "centos9"
UBUNTU_TYPE = "ubuntu"
DEBIAN_TYPE = "debian"
SLES_TYPE = "sles"
RHEL_TYPE = "rhel" # Version 7
RHEL8_TYPE = "rhel8"
RHEL9_TYPE = "rhel9"
ROCKY_LINUX_TYPE = "rocky linux"
CENTOS_VERSION8_TYPESTRING = 'VERSION="8'
CENTOS_VERSION9_TYPESTRING = 'VERSION="9'
RHEL_VERSION8_TYPESTRING = 'VERSION_ID="8'
RHEL_VERSION9_TYPESTRING = 'VERSION_ID="9'
FOCAL_TYPE = "focal"
JAMMY_TYPE = "jammy"
NOBLE_TYPE = "noble"
# OS release info
ETC_OS_RELEASE = "/etc/os-release"
# Download destination dir: default current director
DOWNLOAD_DESTDIR = "./"
#
# Is rock-dkms already installed? True if already installed
#
def check_rock_dkms(pkgtype):
check_cmd = {
PKGTYPE_RPM : RPM_CMD + " -q rock-dkms ",
PKGTYPE_DEB : DPKG_CMD + " -l rock-dkms ",
}[pkgtype]
if pkgtype is PKGTYPE_RPM:
check_cmd = RPM_CMD + " -q rock-dkms"
try:
ps1 = subprocess.run(check_cmd.split(), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, check=True)
print(ps1.stdout.decode('utf-8'))
return True
except subprocess.CalledProcessError as err:
#return False
pass
# check for amdgpu-dkms
check_cmd = RPM_CMD + " -q amdgpu-dkms"
try:
ps1 = subprocess.run(check_cmd.split(), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, check=True)
print(ps1.stdout.decode('utf-8'))
return True
except subprocess.CalledProcessError as err:
return False
elif pkgtype is PKGTYPE_DEB:
check_cmd = DPKG_CMD + " -l rock-dkms"
try:
ps1 = subprocess.run(check_cmd.split(), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, check=True)
print(ps1.stdout.decode('utf-8'))
for line in str.splitlines(ps1.stdout.decode('utf-8')):
if re.search(r'^i.*rock-dkms.*all', line): # 'i' for installed
return True
except subprocess.CalledProcessError as err:
return False
check_cmd = DPKG_CMD + " -l amdgpu-dkms"
try:
ps1 = subprocess.run(check_cmd.split(), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, check=True)
print(ps1.stdout.decode('utf-8'))
for line in str.splitlines(ps1.stdout.decode('utf-8')):
if re.search(r'^i.*amdgpu-dkms.*all', line): # 'i' for installed
return True
return False
except subprocess.CalledProcessError as err:
return False
else:
print("Unknown package type {}. Cannot detect rock-dkms amdgpu-dkms status.".format(pkgtype))
return False
# Get the list of ROCm rpm packages from the ROCm release URL
pkglist = []
pkgset = set()
rockset = set()
rocklist = []
# debian/ubuntu
def get_deb_pkglist311(rocmurl, revstring, pkgtype):
global pkglist
global rocklist
urlpath = rocmurl + "/dists/xenial/main/binary-amd64/Packages"
try:
urld = request.urlopen(urlpath)
for line in str.splitlines(urld.read().decode('utf-8'), True):
mat = re.search(rf'Filename: pool.*\.{pkgtype}', line)
if mat:
pkgname = line[mat.start()+len("Filename: "):mat.end()]
# MIOpen-HIP conflicts with MIOpen-OpenCL from same repo
if ("MIOpen-OpenCL".lower() in pkgname.lower() # ignore, conflicts w MIOpen-HIP
or "MIVisionX".lower() in pkgname.lower()
or "hip-nvcc".lower() in pkgname.lower()
or "hip_nvcc".lower() in pkgname.lower()):
continue
#
if "rock-dkms".lower() in pkgname.lower():
rockset.add(pkgname)
continue
#
if (not re.search(rf'[a-zA-Z]+{revstring}', os.path.basename(pkgname))
and not re.search(rf'[a-zA-Z]+64{revstring}', os.path.basename(pkgname))):
pkgset.add(pkgname)
# return set as a list
if check_rock_dkms(pkgtype) is True:
# remove rock-dkms and rock-dkms-firmware from list
print(" Skipping rock-dkms: a version is already installed.")
print((" To install rock-dkms package, please remove installed rock-dkms"
" first. Reboot may be required. "))
pkglist = [ x for x in pkgset if "rock-dkms" not in x ]
# pkglist = [ x for x in pkglist if "rocm-dkms" not in x ] # BUG WORKAROUND V1.9
rocklist = []
else:
pkglist = list(pkgset)
rocklist = list(rockset)
except Exception as e:
pkglist = None
rocklist = None
print(urlpath + " : " + str(e))
# get pkglist for 3.1.1
def get_pkglist311(rocmurl, revstring, pkgtype):
global pkglist
global rocklist
urlpath = rocmurl
try:
urld = request.urlopen(urlpath)
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]
# MIOpen-HIP conflicts with MIOpen-OpenCL from same repo
if ("MIOpen-OpenCL".lower() in pkgname.lower()
or "MIVisionX".lower() in pkgname.lower()
or "hip-nvcc".lower() in pkgname.lower()
or "hip_nvcc".lower() in pkgname.lower()):
continue
#
if "rock-dkms".lower() in pkgname.lower():
rockset.add(pkgname)
continue
# TODO XXX: adjust revstring to X.Y if it is X.Y.Z
if (not re.search(rf'[a-zA-Z]+{revstring}', pkgname)
and not re.search(rf'[a-zA-Z]+64{revstring}', pkgname)):
pkgset.add(pkgname)
# return set as a list
if check_rock_dkms(pkgtype) is True:
# remove rock-dkms and rock-dkms-firmware from list
print(" Skipping rock-dkms: a version is already installed.")
print((" To install rock-dkms package, please remove installed rock-dkms"
" first. Reboot may be required. "))
pkglist = [ x for x in pkgset if "rock-dkms" not in x ]
# pkglist = [ x for x in pkglist if "rocm-dkms" not in x ] # BUG WORKAROUND V1.9
rocklist = []
else:
pkglist = list(pkgset)
rocklist = list(rockset)
except Exception as e:
pkglist = None
rocklist = None
print(urlpath + " : " + str(e))
#
# get pkglist for release 3.3 and newer
# select packages with names pkgX.Y.Z
#
# debian/ubuntu
def get_deb_pkglist(rocmurl, revstring, pkgtype, ubuntutype, ubuntudist=None):
global pkglist
global rocklist
if ubuntudist is not None:
ubuntutype = ubuntudist
if revstring >= "5.4":
urlpath = rocmurl + "/dists/" + ubuntutype + "/main/binary-amd64/Packages"
elif int(revstring[0]) >= 5 or "4.5" in revstring:
urlpath = rocmurl + "/dists/ubuntu/main/binary-amd64/Packages"
else:
urlpath = rocmurl + "/dists/xenial/main/binary-amd64/Packages"
if ("3.9.1" in revstring or "4.0.1" in revstring or "4.1.1" in revstring
or "4.3.1" in revstring or "4.4.1" in revstring
or "4.5.1" in revstring or "4.5.2" in revstring
or "5.0.1" in revstring or "5.0.2" in revstring
or "5.1.1" in revstring or "5.1.2" in revstring or "5.1.3" in revstring
or "5.2.1" in revstring or "5.2.2" in revstring or "5.2.3" in revstring
or "5.3.1" in revstring or "5.3.2" in revstring or "5.3.3" in revstring
or "5.4.1" in revstring or "5.4.2" in revstring or "5.4.3" in revstring
or "5.5.1" in revstring or "5.5.2" in revstring or "5.5.3" in revstring
or "5.6.1" in revstring or "5.6.2" in revstring or "5.6.3" in revstring):
patrevstr = revstring[0:5] # adjust search pattern to X.Y
elif len(revstring) == 5:
patrevstr = revstring[0:5] # adjust search pattern to X.Y.Z
elif len(revstring) == 3:
patrevstr = revstring[0:3] # adjust search pattern to X.Y
else:
patrevstr = revstring[0:3] # adjust search pattern to X.YY
try:
urld = request.urlopen(urlpath)
for line in str.splitlines(urld.read().decode('utf-8'), True):
mat = re.search(rf'Filename: pool.*\.{pkgtype}', line)
if mat:
pkgname = line[mat.start()+len("Filename: "):mat.end()]
# MIOpen-HIP conflicts with MIOpen-OpenCL from same repo
if ("MIOpen-OpenCL".lower() in pkgname.lower() # ignore, conflicts w MIOpen-HIP
or "MIVisionX-nvcc".lower() in pkgname.lower()
or "hip-nvcc".lower() in pkgname.lower()
or "nvidia".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()
or "hip_nvcc".lower() in pkgname.lower()):
continue
if "rock-dkms".lower() in pkgname.lower():
rockset.add(pkgname)
continue
#
# Use X.Y part of X.Y.Z revstring
#
if (re.search(rf'^[a-zA-Z\-]+[a-zA-Z]{patrevstr}', os.path.basename(pkgname))
or re.search(rf'^miopenkernel.*gfx.+db{patrevstr}', os.path.basename(pkgname))
or re.search(rf'^miopen-hip-.*gfx.+db{patrevstr}', os.path.basename(pkgname))
or re.search(rf'^[a-zA-Z\-]+lib64{patrevstr}', os.path.basename(pkgname))):
pkgset.add(pkgname)
continue
# Starting 3.9 release, only one rocm-dkms to go with rock-dkms
# and rocm-dkms is optional package
# return set as a list
if check_rock_dkms(pkgtype) is True:
# remove rock-dkms and rock-dkms-firmware from list
print(" Skipping rock-dkms: a version is already installed.")
print((" To install rock-dkms package, please remove installed rock-dkms"
" first. Reboot may be required. "))
pkglist = [ x for x in pkgset if "rock-dkms" not in x ]
# pkglist = [ x for x in pkglist if "rocm-dkms" not in x ] # BUG WORKAROUND V1.9
rocklist = []
else:
pkglist = list(pkgset)
rocklist = list(rockset)
pkgn = [ x for x in pkglist if "rocm-dkms" in x ]
if pkgn: # remove rocm-dkms from rocklist
rocklist = [x for x in rocklist if "rocm-dkms" not in x ]
except Exception as e:
pkglist = None
rocklist = None
print(urlpath + " : " + str(e))
# justrdc
def get_deb_justrdc_pkglist(rocmurl, revstring, pkgtype):
global pkglist
global rocklist
if args.revstring[0] >= "5.4":
urlpath = rocmurl + "/dists/" + ubuntutype + "/main/binary-amd64/Packages"
elif int(revstring[0]) > 4 or "4.5" in revstring:
urlpath = rocmurl + "/dists/ubuntu/main/binary-amd64/Packages"
else:
urlpath = rocmurl + "/dists/xenial/main/binary-amd64/Packages"
if ("3.9.1" in revstring or "4.0.1" in revstring or "4.1.1" in revstring
or "4.3.1" in revstring or "4.4.1" in revstring
or "4.5.1" in revstring or "4.5.2" in revstring
or "5.0.1" in revstring or "5.0.2" in revstring
or "5.1.1" in revstring or "5.1.2" in revstring or "5.1.3" in revstring
or "5.2.1" in revstring or "5.2.2" in revstring or "5.2.3" in revstring
or "5.3.1" in revstring or "5.3.2" in revstring or "5.3.3" in revstring
or "5.4.1" in revstring or "5.4.2" in revstring or "5.4.3" in revstring
or "5.5.1" in revstring or "5.5.2" in revstring or "5.5.3" in revstring
or "5.6.1" in revstring or "5.6.2" in revstring or "5.6.3" in revstring):
patrevstr = revstring[0:5] # adjust search pattern to X.Y
elif len(revstring) == 5:
patrevstr = revstring[0:5] # adjust search pattern to X.Y.Z
elif len(revstring) == 3:
patrevstr = revstring[0:3] # adjust search pattern to X.Y
else:
patrevstr = revstring[0:3] # adjust search pattern to X.YY
try:
urld = request.urlopen(urlpath)
for line in str.splitlines(urld.read().decode('utf-8'), True):
mat = re.search(rf'Filename: pool.*\.{pkgtype}', line)
if mat:
pkgname = line[mat.start()+len("Filename: "):mat.end()]
# MIOpen-HIP conflicts with MIOpen-OpenCL from same repo
if ("rdc".lower() not in pkgname.lower()):
continue
#
# Use X.Y part of X.Y.Z revstring
#
if (re.search(rf'^[a-zA-Z\-]+[a-zA-Z]{patrevstr}', os.path.basename(pkgname))
or re.search(rf'^miopenkernel.*gfx.+db{patrevstr}', os.path.basename(pkgname))
or re.search(rf'^miopen-hip-.*gfx.+db{patrevstr}', os.path.basename(pkgname))
or re.search(rf'^[a-zA-Z\-]+lib64{patrevstr}', os.path.basename(pkgname))):
pkgset.add(pkgname)
continue
# Starting 3.9 release, only one rocm-dkms to go with rock-dkms
# and rocm-dkms is optional package
# return set as a list
pkglist = list(pkgset)
rocklist = list(rockset)
except Exception as e:
pkglist = None
rocklist = None
print(urlpath + " : " + str(e))
def get_justrdc_pkglist(rocmurl, revstring, pkgtype):
global pkglist
global rocklist
urlpath = rocmurl
if ("3.9.1" in revstring or "4.0.1" in revstring or "4.1.1" in revstring
or "4.3.1" in revstring or "4.4.1" in revstring
or "4.5.1" in revstring or "4.5.2" in revstring
or "5.0.1" in revstring or "5.0.2" in revstring
or "5.1.1" in revstring or "5.1.2" in revstring or "5.1.3" in revstring
or "5.2.1" in revstring or "5.2.2" in revstring or "5.2.3" in revstring
or "5.3.1" in revstring or "5.3.2" in revstring or "5.3.3" in revstring
or "5.4.1" in revstring or "5.4.2" in revstring or "5.4.3" in revstring
or "5.5.1" in revstring or "5.5.2" in revstring or "5.5.3" in revstring
or "5.6.1" in revstring or "5.6.2" in revstring or "5.6.3" in revstring):
patrevstr = revstring[0:5] # adjust search pattern to X.Y.Z
elif len(revstring) == 5:
patrevstr = revstring[0:5] # adjust search pattern to X.Y.Z
elif len(revstring) == 3:
patrevstr = revstring[0:3] # adjust pat to X.Y
else:
patrevstr = revstring[0:3] # adjust pat to X.YY
try:
urld = request.urlopen(urlpath)
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]
# MIOpen-HIP conflicts with MIOpen-OpenCL from same repo
# default is MIOpen-HIP
if ("rdc".lower() not in pkgname.lower()):
continue
#
# Use X.Y part of X.Y.Z revstring
#
if (re.search(rf'^[a-zA-Z\-]+[a-zA-Z]{patrevstr}', pkgname)
or re.search(rf'^miopenkernel.*gfx.+db{patrevstr}', pkgname)
or re.search(rf'^miopen-hip-.*gfx.+db{patrevstr}', pkgname)
or re.search(rf'^[a-zA-Z\-]+lib64{patrevstr}', pkgname)):
pkgset.add(pkgname)
# Starting 3.9 release, only one rocm-dkms to go with rock-dkms
# and rocm-dkms is optional package
# return set as a list
pkglist = list(pkgset)
rocklist = list(rockset)
except Exception as e:
pkglist = None
rocklist = None
print(urlpath + " : " + str(e))
def get_pkglist(rocmurl, revstring, pkgtype):
global pkglist
global rocklist
urlpath = rocmurl
if ("3.9.1" in revstring or "4.0.1" in revstring or "4.1.1" in revstring
or "4.3.1" in revstring or "4.4.1" in revstring
or "4.5.1" in revstring or "4.5.2" in revstring
or "5.0.1" in revstring or "5.0.2" in revstring
or "5.1.1" in revstring or "5.1.2" in revstring or "5.1.3" in revstring
or "5.2.1" in revstring or "5.2.2" in revstring or "5.2.3" in revstring
or "5.3.1" in revstring or "5.3.2" in revstring or "5.3.3" in revstring
or "5.4.1" in revstring or "5.4.2" in revstring or "5.4.3" in revstring
or "5.5.1" in revstring or "5.5.2" in revstring or "5.5.3" in revstring
or "5.6.1" in revstring or "5.6.2" in revstring or "5.6.3" in revstring):
patrevstr = revstring[0:5] # adjust search pattern to X.Y.Z
elif len(revstring) == 5:
patrevstr = revstring[0:5] # adjust search pattern to X.Y.Z
elif len(revstring) == 3:
patrevstr = revstring[0:3] # adjust pat to X.Y
else:
patrevstr = revstring[0:3] # adjust pat to X.YY
try:
urld = request.urlopen(urlpath)
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]
# MIOpen-HIP conflicts with MIOpen-OpenCL from same repo
# default is MIOpen-HIP
if ("MIOpen-OpenCL".lower() in pkgname.lower()
or "MIVisionX-nvcc".lower() in pkgname.lower()
or "hip-nvcc".lower() in pkgname.lower()
or "nvidia".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()
or "hip_nvcc".lower() in pkgname.lower()):
continue
if "rock-dkms".lower() in pkgname.lower():
rockset.add(pkgname)
continue
#
# Use X.Y part of X.Y.Z revstring
#
if (re.search(rf'^[a-zA-Z\-]+[a-zA-Z]{patrevstr}', pkgname)
or re.search(rf'^miopen-hip-.*gfx.+db{patrevstr}', pkgname)
or re.search(rf'^[a-zA-Z\-]+lib64{patrevstr}', pkgname)):
pkgset.add(pkgname)
# Starting 3.9 release, only one rocm-dkms to go with rock-dkms
# and rocm-dkms is optional package
# return set as a list
if check_rock_dkms(pkgtype) is True:
# remove rock-dkms and rock-dkms-firmware from list
print(" Skipping rock-dkms: a version is already installed.")
print((" To install rock-dkms package, please remove installed rock-dkms"
" first. Reboot may be required. "))
pkglist = [ x for x in pkgset if "rock-dkms" not in x ]
# pkglist = [ x for x in pkglist if "rocm-dkms" not in x ] # BUG WORKAROUND V1.9
rocklist = []
else:
pkglist = list(pkgset)
rocklist = list(rockset)
pkgn = [ x for x in pkglist if "rocm-dkms" in x ]
if pkgn: # remove rocm-dkms from rocklist
rocklist = [x for x in rocklist if "rocm-dkms" not in x ]
except Exception as e:
pkglist = None
rocklist = None
print(urlpath + " : " + str(e))
# Workaround: create .info/version dummy file
def workaround_dummy_versionfile_deb(args, rocmbaseurl):
global pkglist
global rocklist
if args.justkernel is True:
return
if (args.revstring[0] == "3.9.1" or args.revstring[0] == "4.0.1" or args.revstring[0] == "4.1.1"
or args.revstring[0] == "4.3.1" or args.revstring[0] == "4.4.1"
or args.revstring[0] == "4.5.1" or args.revstring[0] == "4.5.2"
or args.revstring[0] == "5.0.1" or args.revstring[0] == "5.0.2"
or args.revstring[0] == "5.1.1" or args.revstring[0] == "5.1.2" or args.revstring[0] == "5.1.3"
or args.revstring[0] == "5.2.1" or args.revstring[0] == "5.2.2" or args.revstring[0] == "5.2.3"
or args.revstring[0] == "5.3.1" or args.revstring[0] == "5.3.2" or args.revstring[0] == "5.3.3"
or args.revstring[0] == "5.4.1" or args.revstring[0] == "5.4.2" or args.revstring[0] == "5.4.3"
or args.revstring[0] == "5.5.1" or args.revstring[0] == "5.5.2" or args.revstring[0] == "5.5.3"
or args.revstring[0] == "5.6.1" or args.revstring[0] == "5.6.2" or args.revstring[0] == "5.6.3"):
touchcmd = "touch /opt/rocm-" + args.revstring[0] + "/.info/version"
elif len(args.revstring[0]) == 5:
touchcmd = "touch /opt/rocm-" + args.revstring[0] + "/.info/version"
else:
touchcmd = "touch /opt/rocm-" + args.revstring[0] + ".0/.info/version"
try:
ps1 = subprocess.Popen(touchcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def workaround_dummy_versionfile_rpm(args, rocmbaseurl):
global pkglist
global rocklist
if args.justkernel is True:
return
if (args.revstring[0] == "3.9.1" or args.revstring[0] == "4.0.1" or args.revstring[0] == "4.1.1"
or args.revstring[0] == "4.3.1" or args.revstring[0] == "4.4.1"
or args.revstring[0] == "4.5.1" or args.revstring[0] == "4.5.2"
or args.revstring[0] == "5.0.1" or args.revstring[0] == "5.0.2"
or args.revstring[0] == "5.1.1" or args.revstring[0] == "5.1.2" or args.revstring[0] == "5.1.3"
or args.revstring[0] == "5.2.1" or args.revstring[0] == "5.2.2" or args.revstring[0] == "5.2.3"
or args.revstring[0] == "5.3.1" or args.revstring[0] == "5.3.2" or args.revstring[0] == "5.3.3"
or args.revstring[0] == "5.4.1" or args.revstring[0] == "5.4.2" or args.revstring[0] == "5.4.3"
or args.revstring[0] == "5.5.1" or args.revstring[0] == "5.5.2" or args.revstring[0] == "5.5.3"
or args.revstring[0] == "5.6.1" or args.revstring[0] == "5.6.2" or args.revstring[0] == "5.6.3"):
touchcmd = "touch /opt/rocm-" + args.revstring[0] + "/.info/version"
elif len(args.revstring[0]) == 5:
touchcmd = "touch /opt/rocm-" + args.revstring[0] + "/.info/version"
else:
touchcmd = "touch /opt/rocm-" + args.revstring[0] + ".0/.info/version"
try:
ps1 = subprocess.Popen(touchcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# Download and install packages utility functions
def download_and_install_nodeps_rpm(args, rocmbaseurl, pkgname):
global pkglist
global rocklist
if args.repourl:
fetchurl = args.repourl[0] + "/"
else:
if args.baseurl is None or args.baseurl[0] == "default":
fetchurl = rocmbaseurl + "/" + args.revstring[0] + "/"
else:
fetchurl = rocmbaseurl + "/"
rmcmd = RM_F_CMD
rpmicmd = RPM_CMD + " -ivh --nodeps "
# download destdir
urlretrieve(fetchurl + pkgname, args.destdir[0] + "/" + os.path.basename(pkgname))
execcmd = rpmicmd + args.destdir[0] + "/" + os.path.basename(pkgname) + " "
rmcmd = rmcmd + args.destdir[0] + "/" + os.path.basename(pkgname) + " "
try:
ps1 = subprocess.Popen(execcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
try:
ps2 = subprocess.Popen(rmcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
print(" Unexpected error encountered! Did you forget sudo?")
# HACK: Ubuntu doesn't like broken packages. So extract rocm-dkms
def download_and_extract_nodeps_deb(args, rocmbaseurl, pkgname):
global pkglist
global rocklist
if args.repourl:
fetchurl = args.repourl[0] + "/"
else:
if args.baseurl is None or args.baseurl[0] == "default":
fetchurl = rocmbaseurl + "/" + args.revstring[0] + "/"
else:
fetchurl = rocmbaseurl + "/"
rmcmd = RM_F_CMD
dpkggetcmd = DPKGDEB_CMD + " -xv "
# download destdir
urlretrieve(fetchurl + pkgname, args.destdir[0] + "/" + os.path.basename(pkgname))
execcmd = dpkggetcmd + args.destdir[0] + "/" + os.path.basename(pkgname) + " "
execcmd = execcmd + " / " # extract under root dir /
rmcmd = rmcmd + args.destdir[0] + "/" + os.path.basename(pkgname) + " "
try:
ps1 = subprocess.Popen(execcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
try:
ps2 = subprocess.Popen(rmcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
print(" Unexpected error encountered! Did you forget sudo?")
def download_and_install_deb(args, rocmbaseurl, pkgname):
global pkglist
global rocklist
if args.repourl:
fetchurl = args.repourl[0] + "/"
else:
if args.baseurl is None or args.baseurl[0] == "default":
fetchurl = rocmbaseurl + "/" + args.revstring[0] + "/"
else:
fetchurl = rocmbaseurl + "/"
rmcmd = RM_F_CMD
aptinstcmd = APT_CMD + " install -y "
aptgetcmd = APTGET_CMD + " -y -f install "
# download destdir
urlretrieve(fetchurl + pkgname, args.destdir[0] + "/" + os.path.basename(pkgname))
execcmd = aptinstcmd + args.destdir[0] + "/" + os.path.basename(pkgname) + " "
rmcmd = rmcmd + args.destdir[0] + "/" + os.path.basename(pkgname) + " "
try:
ps1 = subprocess.Popen(execcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
try:
ps1 = subprocess.Popen(aptgetcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
try:
ps2 = subprocess.Popen(rmcmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
print(" Unexpected error encountered! Did you forget sudo?")
def setup_sles_zypp_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# Set up rocm repo for chosen rev to install
# use rev specific rocm repo
zypprepo = "[rocm" + args.revstring[0] + "]\nenabled=1\nautorefresh=0\nbaseurl=" + fetchurl + "\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://repo.radeon.com/rocm/rocm.gpg.key"
echocmd = ECHO_CMD + " -e '" + zypprepo + "' "
repofilename = "/etc/zypp/repos.d/rocm" + 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)
# 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:
ps1 = subprocess.Popen(zypprefresh.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# apt update repo
zypprefresh = ZYPPER_CMD + " refresh "
try:
ps1 = subprocess.Popen(zypprefresh.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_rhel9_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# install ROCm dependencies - enable powertools - starting with ROCm 4.1.1!!
yumupdate = SUBSCRIBE_CMD + " repos --enable codeready-builder-for-rhel-9-x86_64-rpms "
try:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# Set up rocm repo for chosen rev to install
# use rev specific rocm repo
yumrepo = "[ROCm" + args.revstring[0] +"]\nname=ROCm\nbaseurl=" + fetchurl + "\nenabled=1\ngpgcheck=1\ngpgkey=https://repo.radeon.com/rocm/rocm.gpg.key"
echocmd = ECHO_CMD + " -e '" + yumrepo + "' "
repofilename = "/etc/yum.repos.d/rocm" + 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 perl-File-Which perl-File-BaseDir perl-File-Copy-Recursive perl-URI-Encode "
try:
ps1 = subprocess.Popen(yumupdate.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:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_rhel8_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# install ROCm dependencies - enable powertools - starting with ROCm 4.1.1!!
yumupdate = SUBSCRIBE_CMD + " repos --enable codeready-builder-for-rhel-8-x86_64-rpms "
try:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# Set up rocm repo for chosen rev to install
# use rev specific rocm repo
yumrepo = "[ROCm" + args.revstring[0] +"]\nname=ROCm\nbaseurl=" + fetchurl + "\nenabled=1\ngpgcheck=1\ngpgkey=https://repo.radeon.com/rocm/rocm.gpg.key"
echocmd = ECHO_CMD + " -e '" + yumrepo + "' "
repofilename = "/etc/yum.repos.d/rocm" + 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 perl-File-Which perl-File-BaseDir perl-File-Copy-Recursive perl-URI-Encode "
try:
ps1 = subprocess.Popen(yumupdate.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:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_centos_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# Set up rocm repo for chosen rev to install
# use rev specific rocm repo
yumrepo = "[ROCm" + args.revstring[0] +"]\nname=ROCm\nbaseurl=" + fetchurl + "\nenabled=1\ngpgcheck=1\ngpgkey=https://repo.radeon.com/rocm/rocm.gpg.key"
echocmd = ECHO_CMD + " -e '" + yumrepo + "' "
repofilename = "/etc/yum.repos.d/rocm" + 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)
# 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:
ps1 = subprocess.Popen(yumupdate.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:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_centos9_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# install ROCm dependencies - enable powertools - starting with ROCm 4.1.1!!
yumupdate = YUM_CMD + " config-manager --set-enabled powertools"
try:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# install ROCm dependencies - enable crb perl
dnfupdate = DNF_CMD + " --enablerepo=crb install perl-File-BaseDir "
try:
ps1 = subprocess.Popen(dnfupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
setup_centos_repo(args, fetchurl)
def setup_centos8_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# install ROCm dependencies - enable powertools - starting with ROCm 4.1.1!!
yumupdate = YUM_CMD + " config-manager --set-enabled powertools"
try:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# install ROCm dependencies - enable crb perl
dnfupdate = DNF_CMD + " --enablerepo=crb install perl-File-BaseDir "
try:
ps1 = subprocess.Popen(dnfupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
setup_centos_repo(args, fetchurl)
def remove_centos_repo(args, fetchurl):
global pkglist
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# remove rocm repo for chosen rev to install
# use rev specific rocm repo