-
Notifications
You must be signed in to change notification settings - Fork 0
/
tumbleweed_rocm_radeon.sh
93 lines (81 loc) · 2.39 KB
/
tumbleweed_rocm_radeon.sh
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
#! /bin/bash
# Script by Farid Zellipour
# https://github.com/FaridZelli
# Last updated 2024-8-22 4:39 AM
# Check the current user
USER=$(whoami)
if [ "$USER" == "root" ]; then
# Welcome text
echo -e "
--------------------------------------------------
\033[32mYou are logged in as root.\033[0m
--------------------------------------------------"
else
# Non-root user detected
echo -e "
--------------------------------------------------
\033[31mWARNING: You do not seem to be logged in as root!\033[0m
--------------------------------------------------"
fi
# Ask whether to proceed
echo -e "
This script will install and configure ROCm OpenCL 6.2 on your \033[32mopenSUSE Tumbleweed\033[0m system.
I am not responsible for any damage or data loss that may occur.
\033[33mDo you wish to continue? (Y/N/R)\033[0m
"
# User input
read -p "Your choice:" ANSWER
# Read input
case $ANSWER in
[Yy]* )
# Proceed with the rest of the script
;;
[Rr]* )
# Proceed with the rest of the script
echo "Removing ROCm..."
zypper remove -u rocm-opencl rocm-opencl-devel rocm-opencl-icd-loader rocm-smi-lib rocminfo
zypper removerepo rocm
zypper removerepo amdgpu
echo -e "
--------------------------------------------------
\033[32mROCm has been removed from your system.\033[0m
--------------------------------------------------"
exit 1
;;
* )
# Stop the script for any other input
echo "Stopping the script..."
exit 1
;;
esac
rm -f /etc/zypp/repos.d/rocm.repo
rm -f /etc/zypp/repos.d/amdgpu.repo
tee --append /etc/zypp/repos.d/rocm.repo <<EOF
[rocm]
name=ROCm 6.2
enabled=1
autorefresh=1
baseurl=https://repo.radeon.com/amdgpu/6.2/sle/15.6/main/x86_64/
priority=50
gpgcheck=1
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
EOF
tee --append /etc/zypp/repos.d/amdgpu.repo <<EOF
[amdgpu]
name=AMDGPU 6.2
enabled=1
autorefresh=1
baseurl=https://repo.radeon.com/rocm/zyp/latest/main
priority=50
gpgcheck=1
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
EOF
zypper refresh
zypper --gpg-auto-import-keys install rocm-opencl rocm-opencl-devel rocm-opencl-icd-loader rocm-smi-lib rocminfo clinfo
# End of script
echo -e "
--------------------------------------------------
\033[32mIt's time to reboot!\033[0m
\033[32mRemember to enable ROCm for non-root users by running:\033[0m
usermod -a -G render,video \033[33mUSERNAME\033[0m
--------------------------------------------------"