compilation problem of 4.1-b3 with MPI

Asked by Leonardo Fonseca on 2017-10-30

Dear all, I compiled 4.1-b3 using the standard arch.make without any problem. Then I added the options for NetCDF and recompiled, again without any problem. Below are the lines added to arch.make following the recommendation at the end of the NetCDF installation:

INCFLAGS += -I/home/apascon/siesta-4.1-b3/Docs/build/netcdf/
LDFLAGS += -L/home/apascon/siesta-4.1-b3/Docs/build/zlib/1.2.11/lib -Wl,-rpath=/home/apascon/siesta-4.1-b3/Docs/build/zlib/1.2.11/lib
LDFLAGS += -L/home/apascon/siesta-4.1-b3/Docs/build/hdf5/1.8.18/lib -Wl,-rpath=/home/apascon/siesta-4.1-b3/Docs/build/hdf5/1.8.18/lib
LDFLAGS += -L/home/apascon/siesta-4.1-b3/Docs/build/netcdf/ -Wl,-rpath=/home/apascon/siesta-4.1-b3/Docs/build/netcdf/
LIBS += -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
COMP_LIBS += libncdf.a libfdict.a

When I added the options for MPI I got a compilation error. Below are the only lines altered in the arch.make as suggested in the manual:

CC = mpicc
FPP = $(FC) -E -P -x c
FC = mpifort
FC_SERIAL = gfortran
FC = mpifort
FC_SERIAL = gfortran
MPI_INTERFACE = libmpi_f90.a

The error message comes at the end of the compilation and is related to several undefined variables. The end of the compilation and the beginning of the (long) error message are the following:

a.o siesta_dicts.o m_cite.o m_ts_io.o nag.o pxf.o sockets.o fsockets.o siesta.o libfdf.a libwxml.a libxmlparser.a \
               libSiestaXC.a libmpi_f90.a \
               libsiestaLAPACK.a libsiestaBLAS.a libncdf.a libfdict.a -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
m_dminim.o: In function `__m_dminim_MOD_calc_coeff':
m_dminim.F90:(.text+0x42f): undefined reference to `pdlatra_'
m_dminim.F90:(.text+0x706): undefined reference to `pdlatra_'
m_dminim.F90:(.text+0xb83): undefined reference to `pdlatra_'
m_dminim.F90:(.text+0x10f0): undefined reference to `pdtran_'
m_dminim.o: In function `__m_dminim_MOD_calc_grad':
m_dminim.F90:(.text+0x276d): undefined reference to `pdgemm_'

The end of the error message is the following:

class_Distribution.F90:(.text+0x266): undefined reference to `numroc_'
diagonalizeHk.o: In function `diagonalizehk_':
diagonalizeHk.F90:(.text+0x20d): undefined reference to `numroc_'
m_orderbands.o: In function `__m_orderbands_MOD_order_index':
m_orderbands.F:(.text+0x448): undefined reference to `indxg2p_'
collect2: error: ld returned 1 exit status
make: ** [siesta] Erro 1

I am certainly missing something simple, but can't figure it out. Any suggestions would be of great help. Thank you!

Question information

English Edit question
Siesta Edit question
No assignee Edit question
Solved by:
Nick Papior
Last query:
Last reply:
Nick Papior (nickpapior) said : #1

When using MPI to compile SIESTA you HAVE to compile with Scalapack. Please add the corresponding library to your arch.make file.

Leonardo Fonseca (fonseca65) said : #2

Thanks Nick! I get your point, however, I see that the blas and lapack libraries are included in the Obj directory under the names libsiestaBLAS and libsiestaLAPACK, while scalapack is not. The manual recommends the following addition to arch.make:

LIBS += -L/opt/scalapack/lib -lscalapack

However, by only doing so the compilation still produces an error message:

 libSiestaXC.a libmpi_f90.a \
               libsiestaLAPACK.a libsiestaBLAS.a libncdf.a libfdict.a -L/opt/scalapack/lib -lscalapack -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
/usr/bin/ld: cannot find -lscalapack
collect2: error: ld returned 1 exit status
make: ** [siesta] Erro 1

Does it mean that I have to download and install scalapack in the /opt directory or is there another simpler solution? If yes, then why doesn't scalapack come with siesta as a libsiestascalapack like lapack and blas do?

Thanks again!

Best Nick Papior (nickpapior) said : #3

You have to install scalapack.
We do not ship *all* Siesta dependencies as that makes no sense.

We are only shipping BLAS and LAPACK to make it easier for newcomers to Siesta.

You are highly recommended NOT to use the shipped BLAS and LAPACK, they really perform bad. You are encouraged to use MKL, OpenBLAS, or another performant BLAS+LAPACK library.

Leonardo Fonseca (fonseca65) said : #4

Thanks Nick Papior, that solved my question.