Compile the libraries in Lumen independently

From Lumen wiki
Jump to navigationJump to search

In general Yambo requires a series of libraries: HDF5, NetCDF-c, NetCDF-f, fft, lapack, blas, iotk, libxc
plus a series of optional libreries: slepc, petsc, scalapack, elpa, chase.

Some of this libraries are included in the Yambo package, while other are downloaded from the internet.
In general Yambo configure and compile all these libraries. However on some particular computer, configure/compilation of a specific library can fail.
Here we will show you how to compile and install some of them and the use with Yambo.

Compile libraries

If you configured Yambo and the compilation is stuck at some library you can find the tar.gz file of the libraries in:

lib/archive/

Indeed, even before running the yambo configure, you can just do

make download

and the code will download all possibly needed libraries

$ls lib/archive/
chase-1.7.0.tar.gz       fftqe.tar.gz          hdf5-1.14.6.tar.gz     libxc-6.2.2.tar.gz     netcdf-fortran-4.6.2.tar.gz  scalapack-2.2.2.tar.gz
devicexlib-0.9.0.tar.gz  fftw-3.3.10.tar.gz    iotk-y1.2.2.tar.gz     magma-2.8.0.tar.gz     slepc-3.24.3.tar.gz
elpa-2025.06.002.tar.gz  lapack-3.12.0.tar.gz  petsc-3.24.1.tar.gz    yaml-0.2.2.tar.gz
etsf_io-1.0.4.tar.gz     Ldiago-0.5.1.tar.gz   netcdf-c-4.9.3.tar.gz  petsc-3.24.5.tar.gz


The file package.list contains the libraries list and the link to download them.
Now we will show some example of external compilation of these libraries using intel fortran.
First of all create a folder where you want install them, and copy there your libs:

$mkdir -p /home/pippo/mylib
$mv lib/archive/*.tar.gz /home/pippo/mylib/
$cd /home/pippo/mylib

HDF5

We start from hdf5, unpack the library and then configure it with the command:

tar -xzf hdf5-1.14.6.tar.gz
cd hdf5-1.14.6/
./configure FC=mpif90 CC=mpicc CXX=mpicc --enable-fortran --enable-build-mode=production --enable-parallel --prefix=/home/pippo/mylib/
make 
make install
cd ..

NETCDF-c

then the netcdf-c that requires the previous compiled HDF5:

tar -xzf netcdf-c-4.9.3.tar.gz
cd netcdf-c-4.9.3/
 export LD_LIBRARY_PATH="/home/pippo/mylib/lib:$LD_LIBRARY_PATH"
./configure FC=ifort CC=icc CXX=icc --prefix=/home/pippo/mylib/ LIBS="-L/home/pippo/mylib/lib" CFLAGS="-O2 -I/home/pippo/mylib/include/" 
make 
make install
cd ..

NETCDF-fortran

then the netcdf-f that requires the netcdf-c to be configured and compiled:

tar -xzf netcdf-fortran-4.6.2.tar.gz
cd netcdf-fortran-4.6.2
./configure FC=ifort F77=ifort CC=icc CXX=icc --prefix=/home/pippo/mylib/ LIBS="-L/home/pippo/mylib/lib" CFLAGS="-O2 -I/home/pippo/mylib/" 
make 
make install
cd ..

In a similar way you can configure the other libraries. In this way you can solve problems in each library individually.

Petsc

nvfortran (GPU support)

Warning: compiling petsc with GPU support works only up to version 3.22.2.
Also, if you have a too recent nvfortran compiler (like 25.11), 3.22.2 will not compile. See here for more info:
See here for more info: https://gitlab.com/petsc/petsc/-/work_items/1879

module load nvhpc/nvhpc-hpcx-cuda13/25.11

LIBS_PATH=/data/pippo/local-libs/default/nvfortran/mpifort/lib/

python3 ./configure \
   CC=mpicc \
   CXX=mpicxx \
   FC=mpifort \
   MPICXX=mpicxx \
   --PETSC_ARCH=single_complex \
   --prefix=nvfortran25.11_cuda13.0/single_complex_new \
   --with-blaslapack-lib="$LIBS_PATH/liblapack.so $LIBS_PATH/libblas.so" \
   --with-cuda=1 \
   --with-cuda-arch=120 \
   --with-debugging=no \
   --with-precision=single \
   --with-scalar-type=complex \
   --with-shared-libraries=1 \
   --with-ssl=0

Slepc

nvfortran (GPU support)

See warning on petsc compilation.

module load nvhpc/nvhpc-hpcx-cuda13/25.11
export PETSC_DIR=/data/pippo/local-libs/petsc-git/nvfortran25.11_cuda13.0/single_complex
python3 ./configure --prefix=/data/pippo/local-libs/slepc-git/nvfortran25.11_cuda13.0/single_complex
export SLEPC_DIR=/data/pippo/local-libs/slepc-git
make
make install

Scalapack

TODO

ELPA

TODO

Chase

gfortran

cmake \
	-DCMAKE_CXX_COMPILER=mpicxx \
	-DCMAKE_C_COMPILER=mpicc   \
	-DCMAKE_Fortran_COMPILER=mpif90 \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
	-DMPI_C_COMPILER=mpicc \
	-DMPI_CXX_COMPILER=mpicxx \
	-DMPI_Fortran_COMPILER=mpif90 \
	-DBLAS_VERBOSE=ON \
	-DSCALAPACK_LIBDIR=/usr/lib/x86_64-linux-gnu/ -DSCALAPACK_VERBOSE=ON \
	-DBUILD_WITH_EXAMPLES=ON \
	-DCMAKE_INSTALL_PREFIX=/data/pippo/local-libs/ChASE-github/gfortran_system/install \

nvfortran

module load nvhpc/nvhpc-hpcx-cuda13/25.11
cmake \
	-DCMAKE_CXX_COMPILER=nvc++ \
	-DCMAKE_C_COMPILER=nvc   \
	-DCMAKE_Fortran_COMPILER=nvfortran \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
 	-DCMAKE_CXX_STANDARD_REQUIRED=ON \
	-DCMAKE_CXX_STANDARD=17 \
	-DCMAKE_CUDA_ARCHITECTURES=120 \
	-DMPI_C_COMPILER=mpicc \
	-DMPI_CXX_COMPILER=mpicxx \
	-DMPI_Fortran_COMPILER=mpifort \
	-DSCALAPACK_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/2025/comm_libs/13.0/hpcx/hpcx-2.25.1/ompi/lib -DSCALAPACK_VERBOSE=ON \
	-DCMAKE_INSTALL_PREFIX=/data/pippo/local-libs/ChASE-github/nvfortran25.11_cuda13.0_cudaf/install \

Final build

Then you can link them in Yambo with the command:

./configure \
  --with-hdf5-path=/home/pippo/mylib \
  --with-netcdf-path=/home/pippo/mylib \
  --with-netcdff-path=/home/pippo/mylib \