-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathamdgpuinst.py
executable file
·1197 lines (1129 loc) · 54.6 KB
/
amdgpuinst.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 (srinivasan.subramanian@amd.com)
# Modified by: Sanjay Tripathi (sanjay.tripathi@amd.com)
#
# Download and install the AMDGPU DKMS for the specified ROCm version
# V1.59: add libglapi
# V1.58: undo some changes
# V1.57: Fix baseurl logic
# V1.56: 6.3 add video acceleration va libraries
# 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
# V1.51: add default for baseurl
# V1.50: add noble
# V1.49: fix bug
# V1.48: 6.2 GA
# V1.47: Update for 6.0.2, 6.1 RC has rhel 7 dir name change
# add --ubuntudist, --nokernel options for new rocdecode deps
# V1.46: fix ubuntype to focal, jammy
# V1.45: 6.0 GA
# V1.44: 6.0 RC
# V1.43: 5.7.1 GA
# V1.42: 5.7 GA
# V1.41: 5.6.1 GA
# V1.40: 5.6
# V1.39: 5.5.1 GA
# V1.38: 5.5 GA
# V1.37: 5.5 RC
# V1.36: 5.4.3 GA
# V1.35: 5.4.3 RC
# V1.34: 5.4.2 GA
# V1.33: 5.4.2 RC
# V1.32: 5.4.1 GA
# V1.31: 5.4.1 RC
# V1.30: 5.4 GA
# V1.29: 5.3.3 GA
# V1.28: Ubuntu fix amdgpu-dkms pkgs
# V1.27: 5.3.2 GA
# V1.26: 5.4 RC
# V1.25: Rocky Linux
# V1.24: 5.3 GA, RHEL9 add, drop bionic, centos8
# V1.23: 5.3 RC
# V1.22: add rhel9 for 5.2.3 GA
# V1.21: 5.2.3 GA
# V1.20: 5.2.3 RC
# V1.19: 5.2.2 RC
# V1.18: 5.2.1 GA
# V1.17: 5.2.1 RC
# V1.16: 5.2 GA
# V1.15: fix path to rocm.gpg.key
# V1.14: include libdrm2 amdgpu-core
# V1.13: ROCm 5.2 support
# V1.12: Install libdrm-amdgpu packages
# V1.11: ROCm 5.1.x versions
# V1.10: ROCm 5.1.1 GA
# V1.9: ROCm 5.1 GA
# V1.8: ROCm 5.1 (pre)
# V1.7: ROCm 5.0.2 GA
# V1.6: ROCm 5.0.1 GA
# V1.5: ROCm 5.0 GA
# V1.4: Add support for 5.0.0
# V1.3: Add support for 4.5.1 and 4.5.2
# V1.2: Fix bug in ubuntu install, name change
# V1.0: Initial version 11/2/2021
#
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
kernurl = { "4.5" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.40/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.40/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.40/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.40/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.40/rhel/7.9/main/x86_64/"
},
"4.5.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.40.1/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.40.1/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.40.1/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.40.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.40.1/rhel/7.9/main/x86_64/"
},
"4.5.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.40.2/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.40.2/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.40.2/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.40.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.40.2/rhel/7.9/main/x86_64/"
},
"5.0.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.50/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.50/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.50/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.50/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.50/rhel/7.9/main/x86_64/"
},
"5.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.50/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.50/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.50/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.50/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.50/rhel/7.9/main/x86_64/"
},
"5.0.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.50.1/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.50.1/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.50.1/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.50.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.50.1/rhel/7.9/main/x86_64/"
},
"5.0.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/21.50.2/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/21.50.2/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/21.50.2/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/21.50.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/21.50.2/rhel/7.9/main/x86_64/"
},
"5.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.10/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.10/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.10/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.10/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.10/rhel/7.9/main/x86_64/"
},
"5.1.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.10/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.10/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.10/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.10/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.10/rhel/7.9/main/x86_64/"
},
"5.1.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.10.1/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.10.1/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.10.1/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.10.1/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.10.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.10.1/rhel/7.9/main/x86_64/"
},
"5.1.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.10.2/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.10.2/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.10.2/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.10.2/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.10.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.10.2/rhel/7.9/main/x86_64/"
},
"5.1.3" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.10.3/sle/15/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.10.3/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.10.3/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.10.3/rhel/8.4/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.10.3/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.10.3/rhel/7.9/main/x86_64/"
},
"5.2.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.20/sle/15.3/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/22.20/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.20/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.20/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.20/rhel/8.4/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/22.20/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.20/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.20/rhel/7.9/main/x86_64/"
},
"5.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.20/sle/15.3/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/22.20/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.20/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.20/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.20/rhel/8.4/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/22.20/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.20/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.20/rhel/7.9/main/x86_64/"
},
"5.2.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.20.1/sle/15.3/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/22.20.1/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.20.1/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.20.1/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.20.1/rhel/8.4/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/22.20.1/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.20.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.20.1/rhel/7.9/main/x86_64/"
},
"5.2.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/.22.20.2/sle/15.3/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/.22.20.2/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/.22.20.2/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/.22.20.2/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/.22.20.2/rhel/8.4/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/.22.20.2/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/.22.20.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/.22.20.2/rhel/7.9/main/x86_64/"
},
"5.2.3" :
{ "sles" : "https://repo.radeon.com/amdgpu/22.20.3/sle/15.3/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/22.20.3/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/22.20.3/rhel/8.6/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/22.20.3/rhel/8.5/main/x86_64/",
"centos84" : "https://repo.radeon.com/amdgpu/22.20.3/rhel/8.4/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/22.20.3/rhel/9.0/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/22.20.3/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/22.20.3/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/22.20.3/rhel/7.9/main/x86_64/"
},
"5.3.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.3/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.3/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.3/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.3/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.3/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.3/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.3/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.3/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.3/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.3/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.3/rhel/7.9/main/x86_64/"
},
"5.3.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.3.2/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.3.2/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.3.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.3.2/rhel/7.9/main/x86_64/"
},
"5.3.3" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.3.3/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.3.3/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.3.3/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.3.3/rhel/7.9/main/x86_64/"
},
"5.4.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.4/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.4/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.4/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.4/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.4/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.4/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.4/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.4/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.4/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.4/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.4/rhel/7.9/main/x86_64/"
},
"5.4.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.4.1/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.4.1/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.4.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.4.1/rhel/7.9/main/x86_64/"
},
"5.4.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.4.2/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.4.2/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.4.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.4.2/rhel/7.9/main/x86_64/"
},
"5.4.3" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.4.3/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.4.3/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.4.3/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.4.3/rhel/7.9/main/x86_64/"
},
"5.5.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.5/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.5/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.5/rhel/8.7/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.5/rhel/8.7/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.5/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.5/rhel/8.6/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.5/rhel/9.1/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.5/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.5/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.5/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.5/rhel/7.9/main/x86_64/"
},
"5.5.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.5.1/sle/15.4/main/x86_64/",
"sles153" : "https://repo.radeon.com/amdgpu/5.5.1/sle/15.3/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/8.8/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/8.8/main/x86_64/",
"centos85" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/8.5/main/x86_64/",
"centos86" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/8.6/main/x86_64/",
"centos87" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/8.7/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/9.2/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/9.2/main/x86_64/",
"rhel91" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/9.1/main/x86_64/",
"rhel90" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/9.0/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.5.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.5.1/rhel/7.9/main/x86_64/"
},
"5.6.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.6/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/5.6/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.6/rhel/8.8/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.6/rhel/8.8/main/x86_64/",
"rhel87" : "https://repo.radeon.com/amdgpu/5.6/rhel/8.7/main/x86_64/",
"centos87" : "https://repo.radeon.com/amdgpu/5.6/rhel/8.7/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.6/rhel/9.2/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.6/rhel/9.2/main/x86_64/",
"rhel91" : "https://repo.radeon.com/amdgpu/5.6/rhel/9.1/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.6/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.6/rhel/7.9/main/x86_64/"
},
"5.6.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.6.1/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/5.6.1/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/8.8/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/8.8/main/x86_64/",
"rhel87" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/8.7/main/x86_64/",
"centos87" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/8.7/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/9.2/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/9.2/main/x86_64/",
"rhel91" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/9.1/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.6.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.6.1/rhel/7.9/main/x86_64/"
},
"5.7.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.7/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/5.7/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.7/rhel/8.8/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.7/rhel/8.8/main/x86_64/",
"rhel87" : "https://repo.radeon.com/amdgpu/5.7/rhel/8.7/main/x86_64/",
"centos87" : "https://repo.radeon.com/amdgpu/5.7/rhel/8.7/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.7/rhel/9.2/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.7/rhel/9.2/main/x86_64/",
"rhel91" : "https://repo.radeon.com/amdgpu/5.7/rhel/9.1/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.7/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.7/rhel/7.9/main/x86_64/"
},
"5.7.1" :
{ "sles" : "https://repo.radeon.com/amdgpu/5.7.1/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/5.7.1/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/8.8/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/8.8/main/x86_64/",
"rhel87" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/8.7/main/x86_64/",
"centos87" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/8.7/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/9.2/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/9.2/main/x86_64/",
"rhel91" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/9.1/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/5.7.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/5.7.1/rhel/7.9/main/x86_64/"
},
"6.0.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/6.0/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/6.0/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/6.0/rhel/8.9/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/6.0/rhel/8.9/main/x86_64/",
"rhel88" : "https://repo.radeon.com/amdgpu/6.0/rhel/8.8/main/x86_64/",
"centos88" : "https://repo.radeon.com/amdgpu/6.0/rhel/8.8/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/6.0/rhel/9.3/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/6.0/rhel/9.3/main/x86_64/",
"rhel92" : "https://repo.radeon.com/amdgpu/6.0/rhel/9.2/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/6.0/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/6.0/rhel/7.9/main/x86_64/"
},
"6.0.2" :
{ "sles" : "https://repo.radeon.com/amdgpu/6.0.2/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/6.0.2/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/8.9/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/8.9/main/x86_64/",
"rhel88" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/8.8/main/x86_64/",
"centos88" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/8.8/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/9.3/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/9.3/main/x86_64/",
"rhel92" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/9.2/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/6.0.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/6.0.2/rhel/7.9/main/x86_64/"
},
"6.1.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/6.1/sle/15.5/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/6.1/sle/15.4/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/6.1/rhel/8.9/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/6.1/rhel/8.9/main/x86_64/",
"rhel88" : "https://repo.radeon.com/amdgpu/6.1/rhel/8.8/main/x86_64/",
"centos88" : "https://repo.radeon.com/amdgpu/6.1/rhel/8.8/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/6.1/rhel/9.3/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/6.1/rhel/9.3/main/x86_64/",
"rhel92" : "https://repo.radeon.com/amdgpu/6.1/rhel/9.2/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/6.1/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/6.1/rhel/7/main/x86_64/"
},
"6.2.0" :
{ "sles" : "https://repo.radeon.com/amdgpu/6.2/sle/15.6/main/x86_64/",
"sles154" : "https://repo.radeon.com/amdgpu/6.2/sle/15.4/main/x86_64/",
"sles155" : "https://repo.radeon.com/amdgpu/6.2/sle/15.5/main/x86_64/",
"centos8" : "https://repo.radeon.com/amdgpu/6.2/rhel/8.10/main/x86_64/",
"rhel8" : "https://repo.radeon.com/amdgpu/6.2/rhel/8.10/main/x86_64/",
"rhel88" : "https://repo.radeon.com/amdgpu/6.2/rhel/8.8/main/x86_64/",
"rhel89" : "https://repo.radeon.com/amdgpu/6.2/rhel/8.9/main/x86_64/",
"centos88" : "https://repo.radeon.com/amdgpu/6.2/rhel/8.8/main/x86_64/",
"centos89" : "https://repo.radeon.com/amdgpu/6.2/rhel/8.9/main/x86_64/",
"centos9" : "https://repo.radeon.com/amdgpu/6.2/rhel/9.4/main/x86_64/",
"rhel9" : "https://repo.radeon.com/amdgpu/6.2/rhel/9.4/main/x86_64/",
"rhel92" : "https://repo.radeon.com/amdgpu/6.2/rhel/9.2/main/x86_64/",
"rhel93" : "https://repo.radeon.com/amdgpu/6.2/rhel/9.3/main/x86_64/",
"ubuntu" : "https://repo.radeon.com/amdgpu/6.2/ubuntu",
"centos" : "https://repo.radeon.com/amdgpu/6.2/rhel/7/main/x86_64/"
}
}
# Commands
RM_F_CMD = "/bin/rm -f "
RPM_CMD = "/usr/bin/rpm"
YUM_CMD = "/usr/bin/yum"
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"
# 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="8'
RHEL_VERSION9_TYPESTRING = 'VERSION="9'
BIONIC_TYPE = "bionic"
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):
# if no install, just listing packages, skip check
if args.listonly is True:
return False
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:
pass
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
rockset = set()
rocklist = []
# debian/ubuntu
#
# select amdgpu-dkms and amdgpu-dkms-firmware packages
#
# debian/ubuntu
def get_deb_pkglist(rocmurl, pkgtype, ubuntutype, ubuntudist=None):
global rocklist
if ubuntudist is not None:
ubuntutype = ubuntudist
urlpath = rocmurl + "/dists/" + ubuntutype + "/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()]
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 "libglapi".lower() in pkgname.lower()
or "libllvm".lower() in pkgname.lower()
or "libva".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
# return set as a list
if check_rock_dkms(pkgtype) is True:
# remove rock-dkms and rock-dkms-firmware from list
print(" NOTE: amdgpu-dkms: a version is already installed.")
print((" To install amdgpu-dkms package, please remove installed amdgpu-dkms"
" first, reboot, and then install amdgpu-dkms packages. "))
rocklist = None
else:
rocklist = list(rockset)
except Exception as e:
rocklist = None
print(urlpath + " : " + str(e))
def get_pkglist(rocmurl, pkgtype):
global rocklist
urlpath = rocmurl
try:
for folders in ["a", "g", "l", "m"]:
try:
urld = request.urlopen(urlpath + "/" + folders)
except Exception as e:
print("Info: Ignoring: ", urlpath + "/" + folders + " : " + str(e))
pass
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 "libglapi".lower() in pkgname.lower()
or "libllvm".lower() in pkgname.lower()
or "libva".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
# return set as a list
if check_rock_dkms(pkgtype) is True:
# remove rock-dkms and rock-dkms-firmware from list
print(" NOTE: amdgpu-dkms: a version is already installed.")
print((" To install amdgpu-dkms package, please remove installed amdgpu-dkms"
" first, reboot, and then install amdgpu-dkms packages. "))
rocklist = None
else:
rocklist = list(rockset)
# remove i386 packages
rocklist = [ x for x in rocklist if "i386" not in x ]
except Exception as e:
rocklist = None
print(urlpath + " : " + str(e))
# Download and install deb package rocklist utility functions
def download_and_install_list_deb(args, rocmbaseurl):
global rocklist
if args.repourl:
fetchurl = args.repourl[0] + "/"
else:
if args.baseurl is None or args.baseurl[0] == "default":
fetchurl = rocmbaseurl + "/"
else:
fetchurl = rocmbaseurl + "/"
rmcmd = RM_F_CMD
aptinstcmd = APT_CMD + " install -y "
aptgetcmd = APTGET_CMD + " -y -f install "
execcmd = aptinstcmd
for n in rocklist:
# download destdir
print(fetchurl + n)
urlretrieve(fetchurl + n, args.destdir[0] + "/" + os.path.basename(n))
execcmd = execcmd + args.destdir[0] + "/" + os.path.basename(n) + " "
rmcmd = rmcmd + args.destdir[0] + "/" + os.path.basename(n) + " "
print('.', end='', flush=True)
# 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) + " "
print(execcmd)
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?")
# Download and install packages utility functions
def download_and_install_deb(args, rocmbaseurl, pkgname):
global rocklist
if args.repourl:
fetchurl = args.repourl[0] + "/"
else:
if args.baseurl is None or args.baseurl[0] == "default":
fetchurl = rocmbaseurl + "/"
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 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 = "[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)
# 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_centos_repo(args, fetchurl):
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 = "[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)
# 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 rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
setup_centos_repo(args, fetchurl)
def setup_centos8_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
setup_centos_repo(args, fetchurl)
def remove_centos_repo(args, fetchurl):
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
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:
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 remove_sles_zypp_repo(args, fetchurl):
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
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:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# clean repo
zyppclean = ZYPPER_CMD + " clean "
try:
ps1 = subprocess.Popen(zyppclean.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_debian_repo(args, fetchurl, ubuntutype):
global rocklist
if args.repourl:
pass
else:
# Set up rocm repo for chosen rev to install
wgetkey = WGET_CMD + " -q -O - http://repo.radeon.com/rocm/rocm.gpg.key "
aptkeycmd = APTKEY_CMD + " add -"
try:
ps1 = subprocess.Popen(wgetkey.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(aptkeycmd.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)
# 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:
ps1 = subprocess.Popen(aptupdate.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
aptupdate = APT_CMD + " update"
try:
ps1 = subprocess.Popen(aptupdate.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(aptupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def remove_debian_repo(args, fetchurl):
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
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:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# clean repo
# apt update repo
aptupdate = APT_CMD + " clean"
try:
ps1 = subprocess.Popen(aptupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# On Ubuntu, use the steps below to install downloaded deb
def download_install_rocm_deb(args, rocmbaseurl, ubuntutype):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
if args.baseurl is None or args.baseurl[0] == "default":
fetchurl = rocmbaseurl + "/"
else:
fetchurl = rocmbaseurl + "/"
# Set up rocm repo for chosen rev to install
setup_debian_repo(args, fetchurl, ubuntutype)
# Download and install from custom repo URL
rmcmd = RM_F_CMD
aptinstcmd = APT_CMD + " install -y "
aptgetcmd = APTGET_CMD + " -y -f install "
if rocklist:
# install amdgpu-dkms-firmware first
pkgn = [ x for x in rocklist if "amdgpu-dkms-firmware" in x ]
if pkgn:
# remove amdgpu-dkms-firmware from list
rocklist = [ x for x in rocklist if "amdgpu-dkms-firmware" not in x ]
# Download and Install amdgpu-dkms-firmware first (assumes only one)
download_and_install_deb(args, rocmbaseurl, pkgn[0])
if rocklist:
download_and_install_list_deb(args, rocmbaseurl)
#for pkgn in rocklist:
# download_and_install_deb(args, rocmbaseurl, pkgn)
return
#
# --rev REV is the ROCm version number string
# --destdir DESTDIR directory to download rpm for installation
#
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=('[V1.59]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='-')
parser.add_argument('--rev', nargs=1, dest='revstring', default='rpm',
help=('specifies ROCm release version '
' Example: --rev 4.5 for ROCm 4.5 or --rev 4.5.1 for ROCm 4.5.1'
)
)
parser.add_argument('--destdir', nargs=1, dest='destdir', default='.',
help=('specify directory where to download RPM'
' before installation. Default: current directory '
' --destdir /tmp to use /tmp directory')
)
parser.add_argument('--list', dest='listonly', action='store_true',
help=('just list the packages that will be installed'
' -- do not download or install ')
)
parser.add_argument('--repourl', nargs=1, dest='repourl', default=None,
help=('specify ROCm repo URL to use from where to download packages'
' as in http://repo.radeon.com/amdgpu/{apt, yum, zyp, centos8}/<REV> '
' Example: --repourl http://compute-artifactory/build/xyz')
)
parser.add_argument('--nokernel', dest='nokernel', action='store_true',
help=('do not install amdgpu kernel packages, for example, '
' used to install ROCm in docker, install amdgpu libdrm mesa libraries')
)
parser.add_argument('--baseurl', nargs=1, dest='baseurl', default=None,
help=('specify early access ROCm repo URL to use from where to download packages'