====== Instalando o driver de vĂdeo da Nvidia + Cuda + Gromacs ======
* Se tiver instalando dentro de uma maquina virtual
* Siga estes passos para adicionar a placa PCI da GPU + HDMI audio no hardware da VM
* https://linuxcapable.com/how-to-install-nvidia-drivers-on-rocky-linux/
* Se a maquina virtual for no ProxMOX
* Ao criar a VM utilize o seguinte Processador: "Host", Chipset Q35 e PCIe
====== Rocky 9 ======
echo adicionando os repositorios necessarios, temporariamente
#sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo
sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo
sudo dnf config-manager --set-enabled crb
sudo yum install epel-release
echo instalando os kernels necessarios no rocky 9
#sudo dnf update
#sudo dnf install kernel-headers-$(uname -r) kernel-devel-$(uname -r)
wget https://yum.oracle.com/repo/OracleLinux/OL9/appstream/x86_64/getPackage/kernel-devel-5.14.0-362.8.1.el9_3.x86_64.rpm
wget https://yum.oracle.com/repo/OracleLinux/OL9/appstream/x86_64/getPackage/kernel-headers-5.14.0-362.8.1.el9_3.x86_64.rpm
dnf install ./kernel-devel-5.14.0-362.8.1.el9_3.x86_64.rpm ./kernel-headers-5.14.0-362.8.1.el9_3.x86_64.rpm
echo procurando o driver (module) nvidia disponivel para instalacao
sudo dnf module list
echo instalando o driver nvidia
#sudo dnf module install nvidia-driver:latest-dkms
sudo dnf module install nvidia-driver:550-dkms
echo instalando o cuda
sudo dnf install cuda-toolkit
echo removendo o repositorio epel
yum remove epel-release
echo reinstalando o openssh-server (bug estranho que nao identifiquei o motivo)
dnf remove openssh-server
dnf install openssh-server
systemctl restart sshd.service
echo reiniciando
reboot
echo testando o driver nvidia
nvidia-smi
echo instalacao do gromacs no rocky 9
dnf install gcc-toolset-12 cmake
wget https://ftp.gromacs.org/gromacs/gromacs-2024.3.tar.gz
tar xfz gromacs-2024.3.tar.gz
cd gromacs-2024.3
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -DGMX_MPI=OFF -DGMX_USE_RDTSCP=OFF -DCMAKE_CUDA_COMPILER:PATH=/usr/local/cuda/bin/nvcc
make
make check
sudo make install
====== Ubuntu 24 ======
echo instalando o driver nvidia no ubuntu 24
#sudo ubuntu-drivers install --gpgpu
sudo apt install nvidia-driver-550-server
sudo reboot
echo Remove Outdated Signing Key:
sudo apt-key del 7fa2af80
echo Install the new cuda-keyring package
#wget https://developer.download.nvidia.com/compute/cuda/repos///cuda-keyring_1.1-1_all.deb
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
echo Update the Apt repository cache:
sudo apt-get update
echo Install CUDA SDK:
sudo apt-get install cuda-toolkit
#echo To include all GDS packages:
#sudo apt-get install nvidia-gds
echo instalacao do gromacs no ubuntu24
sudo apt install cmake
wget https://ftp.gromacs.org/gromacs/gromacs-2024.4.tar.gz
tar xfz gromacs-2024.4.tar.gz
cd gromacs-2024.4
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -DGMX_MPI=OFF -DGMX_USE_RDTSCP=OFF -DCMAKE_CUDA_COMPILER:PATH=/usr/local/cuda/bin/nvcc
make
make check
sudo make install