If you have installed the CUDA Drivers and CUDA SDK using the NVIDIA CUDA Installation Guide for Linux. Look for Section 3.3.3 for RHEL 8 / Rocky 9
If after following instruction, you are still facing issues, you may want to consider the following
1- Blacklist nouveau.conf
$ vim /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
2- Remove Nvidia driver installation
# dnf module remove --all nvidia-driver
3- Remove CUDA-Related Installation
sudo dnf remove "cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" \
"*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*"
4- Reboot
# shutdown -r now
References: