[Wien] Compiling Wien2k 21.1 on Ubuntu 20.04 with gfortran

Pavel Ondračka pavel.ondracka at email.cz
Wed Nov 24 08:27:32 CET 2021


Hi David,

as you said it works for you, so feel free to ignore, but I have some
further tips if you are interested. Ubuntu switches between the
different blas and lapack using the "alternatives", so its difficult to
say if you actually link with the correct one.

"ldd lapw1" in WIENROOT should show which one is actually linked, what
you want to have is the openmp openblas
/usr/lib/x86_64-linux-gnu/openblas-openmp/libblas.so
/usr/lib/x86_64-linux-gnu/openblas-openmp/liblapack.so
or alternatively
/usr/lib/x86_64-linux-gnu/openblas-openmp/libopenblas.so
It looks like you linked with the pthread one. This is not a problem
when running at single thread but at higher thread number this might
lead to oversubscription and slowdowns as the pthreaded openblas
doesn't respect the OMP_NUM_THREADS set by Wien2k. So I would recommend
to relink with the openmp OpenBLAS. BTW it is usually safer to link
with OpenBLAS explicitly using the -lopenblas instead of the -llapack -
lblas to be sure you don't accidentally link the netlib one
(libopenblas is just the libblas and libblapack provided by OpenBLAS
merged together).

In general easy way how to check performance is to run the serial
test_case from http://www.wien2k.at/reg_user/benchmark/ On modern CPUs
(at least avx2) the runtime should be around 15-25 seconds at single
thread.

I see total runtime of ~18seconds on Fedora 35 with gfortran 11.2.1
OpenBLAS and AMD Ryzen 9 3900X 12-Core Processor.
Also look for the following line in test_case.output1, this is what I
have:
TIME HAMILT (WALL) =     2.2, HNS =     1.7, HORB =     0.0, DIAG =   
14.0, SYNC =     0.0
The time in HAMILT mostly depends on you compiler and vectorizing
settings, while the DIAG is 99% lapack/blas related, so this can help
with the diagnostics if things are slow.

You might also get extra speedup of the HAMILT part by adding "-
DHAVE_LIBMVEC" to the Compiler options.

Best regards
Pavel

On Tue, 2021-11-23 at 11:07 +0100, David Holec wrote:
> Dear all,
> 
> I have just spent some time making Wien2k run on my single machine
> running Ubuntu 20.04 with gfortran/gcc. Since I am not an expert, it
> was a trial and error, but it seems that I found a working combination
> (sadly, the default parameters didn't work for me). Maybe this will
> help someone. Here are the settings that did the job for me:
> 
>   M   OpenMP switch:           -fopenmp
>   O   Compiler options:        -ffree-form -O2 -ftree-vectorize -
> march=native -ffree-line-length-none -ffpe-summary=none
>   L   Linker Flags:            $(FOPT) -L/usr/lib/x86_64-linux-gnu
>   P   Preprocessor flags       '-DParallel'
>   R   R_LIBS (LAPACK+BLAS):    -lblas -llapack -lpthread
>   F   FFTW options:            -DFFTW3 -DFFTW_OMP -I/usr/include
>       FFTW-LIBS:               -L/usr/lib/x86_64-linux-gnu -lfftw3 -
> lfftw3_omp
> 
> where the FFTW options were:
> 
>   R  FFTWROOT:          /usr/
>    V  FFTW_VERSION:      FFTW3
>    L  FFTW_LIB:          lib/x86_64-linux-gnu
>    N  FFTW_LIBNAME:      fftw3
> 
> Compiler versions:
> $ gcc --version
> gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
> gfortran --version
> GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
> 
> And I used the generic lapack and openblas packages provides by Ubuntu
> repos:
> liblapack-dev/focal,now 3.9.0-1build1 amd64 [installed]
> liblapack3/focal,now 3.9.0-1build1 amd64 [installed,automatic]
> 
> liblapack64-3/focal,now 3.9.0-1build1 amd64 [installed,automatic]
> liblapack64-dev/focal,now 3.9.0-1build1 amd64 [installed]
> 
> libblas-dev/focal,now 3.9.0-1build1 amd64 [installed]
> libblas3/focal,now 3.9.0-1build1 amd64 [installed,automatic]
> libblas64-3/focal,now 3.9.0-1build1 amd64 [installed,automatic]
> libblas64-dev/focal,now 3.9.0-1build1 amd64 [installed,automatic]
> 
> libopenblas64-0/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1 amd64
> [installed]
> libopenblas64-0-openmp/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1
> amd64 [installed]
> libopenblas64-0-pthread/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1
> amd64 [installed,automatic]
> 
> (I am not totally sure if I need all the libraries above, but
> certainly, with these, the compilation seems to work and I am able to
> run SCF cycles & Telnes calculations without errors :-)
> 
> All the best,
> David
> ---
> Dr David Holec
> Computational Materials Science group
> Department of Materials Science
> Montanuniversität Leoben
> 
> 
> 
> Franz-Josef-Strasse 18, A-8700 Leoben, Austria
> tel. +43-(0)3842-4024211
> fax. +43-(0)3842-4024202
> materials.unileoben.ac.at
> cms.unileoben.ac.at
> ________________________________
> WHERE RESEARCH MEETS FUTURE
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> SEARCH the MAILING-LIST at: 
> http://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/index.html



More information about the Wien mailing list