Install Yambo on Ubuntu/LinuxMint with NVfortran compiler

From The Yambo Project
Revision as of 14:30, 9 September 2024 by Davide (talk | contribs) (Section improved)
Jump to navigation Jump to search

The NVIDIA compiler are freely available on Linux machines. You can download Fortran,C, C++ compiler and debugger from: NVIDIA HPC Software Development Kit (SDK)
On Ubuntu, it can be easely installed via the following procedure

curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
sudo apt-get install -y nvhpc-24-7 

Once you downloaded and installed the NVIDIA compiler do not forget to set the correct PATH and LD_LIBRARY_PATH variables.

Then you can configure Yambo with the command:

./configure FC=nvfortran F77=nvfortran  CC=nvc CPP="gcc -E -P" FPP="gfortran -E -P -cpp" \
--enable-open-mp --enable-par-linalg --enable-hdf5-par-io --enable-slepc-linalg

Configure NVfortran with a CUDA graphic card

If you have an installed CUDA GPU on your machine you can compile Yambo to use it, by adding the flag

--enable-cuda="cuda-version,card-version"
  • cuda-version is the version of your cuda libraries, just look in the folder /opt/nvidia/hpc_sdk/Linux_x86_64/ and you will find a folder with the version of your NVIDIA SDK.
  • card-version refers to the compute capabilities of your card. ccXY means compute capability X.Y just have a look to the wiki webpage to see the compatibility of your card: GPUs supported.

Check that your Nvidia graphic card is properly installed

To be sure that the code will run fine on your GPU card, you need the proper driver installed on your machine. If you have the nvidia drivers, just run

$nvidia-smi
Mon Sep  9 16:20:02 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03              Driver Version: 560.35.03      CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0  On |                  N/A |
| 20%   39C    P8              8W /   75W |     280MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

CUDA Version: V.S should be greater or equal to what you set in your cuda-version in the configure. In this case we are running with driver 560, which supports up to cuda version 12.6

More info on Yambo on NVIDIA graphic cards can be found here: Materials Design Toward the Exascale: Porting Electronic Structure Community Codes to GPUs

Nota bene 1: cc20 and cc30 are not support anymore in the last version of the nvidia compiler
Nota bene 2: if you want to use a CUDA graphic card you need to compile openmpi or mpich with the cuda support