Page 1 of 1

Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Sun Oct 07, 2018 10:45 pm
by cartoixa
Dear developers,

When compiling abinit 8.8.4 (or 8.6.3) with gfortran 8.1.1 and several versions of OpenMPI (1.8.8, 2.1.1 or 3.1.2), I am getting several compilation errors:

Code: Select all

../../../../src/42_libpaw/m_libpaw_mpi.F90:3349:12:

  tag=MOD(nt,MPI_TAG_UB)
            1
Error: Argument ā€˜Pā€™ of MOD at (1) shall not be zero

in 42_libpaw/m_libpaw_mpi.F90 .
A previous version of gfortran (6.3.1) did not complain.

It seems to me that the error arises because MPI_TAG_UB is not a constant/parameter, but an attribute whose value should be accessed through MPI_ATTR_GET, similarly to what is done in m_xmpi.F90 .
Best regards,

Xavier

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Wed Oct 17, 2018 6:10 pm
by torrent
Dear Xavier,

Thank you for detecting this bug.
Fortunately, the concerned file is not used by Abinit (because abinit uses m_xmpi MPI module ), but only in the standalone version of the PAW library.
To compile abinit with gcc8, just comment temporarily the concerned lines.
The correction has been made and will be available in the next version.

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Thu Oct 18, 2018 3:31 pm
by jbeuken
Hi,

Our testfarm did not detect this bug ...
I would like to understand...

I have a bot under CentOS 7.5 (Silver 4110) with gcc 8.1 / OpenMPI 3.0.1 and MPICH 3.2

The compilation finishes without problems and the tests are correct.

Furthermore,

Code: Select all

mpif90 -show

gfortran -I/usr/local/openmpi-3.0.1_gcc8.1/include -pthread -I/usr/local/openmpi-3.0.1_gcc8.1/lib -Wl,-rpath -Wl,/usr/local/openmpi-3.0.1_gcc8.1/lib -Wl,--enable-new-dtags -L/usr/local/openmpi-3.0.1_gcc8.1/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpipi


Code: Select all

grep -r MPI_TAG_UB /usr/local/openmpi-3.0.1_gcc8.1/include/*

/usr/local/openmpi-3.0.1_gcc8.1/include/mpif-constants.h: integer MPI_TAG_UB
/usr/local/openmpi-3.0.1_gcc8.1/include/mpif-constants.h: parameter (MPI_TAG_UB = 0)
/usr/local/openmpi-3.0.1_gcc8.1/include/mpi.h: MPI_TAG_UB,
/usr/local/openmpi-3.0.1_gcc8.1/include/openmpi/ompi/mpi/cxx/constants.h:static const int TAG_UB = MPI_TAG_UB;


what is your environment?

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Thu Oct 18, 2018 4:45 pm
by ebousquet
Hi JM,
On Ubuntu 18.04 with default updated gfortran 7.3.0 and mpirun (open mpi) 2.1.1, this problem appears too.
Cheers,
Eric

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Fri Oct 19, 2018 9:25 am
by jbeuken
Hello Eric,

Ok... with

Code: Select all

enable_mpi="yes"
enable_mpi_io="yes"
with_mpi_prefix="/usr"
with_trio_flavor="netcdf"
with_dft_flavor="libxc"

I reproduced the problem with "standard" packages of Ubuntu 18.04 ( gnu 7.3 and OpenMpi 2.1.1 ) :o

Code: Select all

mpif90 -show
gfortran -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -I/usr/lib/x86_64-linux-gnu/openmpi/lib -L/usr//lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi



When compiling abinit 8.8.4 with gnu 8.1 and OpenMPI 3.0 but under CentOS 7.5 , compilation succeeds !?! :roll:

Code: Select all

enable_mpi="yes"
enable_mpi_io="yes"
with_mpi_prefix="/usr/local/openmpi-3.0.1_gcc8.1"
with_trio_flavor="netcdf"
with_dft_flavor="libxc"


Code: Select all

mpif90 -show
gfortran -I/usr/local/openmpi-3.0.1_gcc8.1/include -pthread -I/usr/local/openmpi-3.0.1_gcc8.1/lib -Wl,-rpath -Wl,/usr/local/openmpi-3.0.1_gcc8.1/lib -Wl,--enable-new-dtags -L/usr/local/openmpi-3.0.1_gcc8.1/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi


Then, depends on the OS and/or the compilation of OpenMPI ( the instructions of mpif90 is little different) ?!?

Any ideas/comments ?

A+

jmb

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Sun Oct 21, 2018 1:20 am
by cartoixa
Hi,

Then, depends on the OS and/or the compilation of OpenMPI ( the instructions of mpif90 is little different) ?!?

Any ideas/comments ?


I am running Fedora 28. I think that, in order for the problem to appear, two things must happen:
1) The MPI attribute MPI_TAG_UB must be coded by 0 in the MPI implementation.
2) The compiler must be set up to throw an error when it can determine at compile time that the second argument to MOD is zero.

The following program checks for 1)

Code: Select all

program mpitag
      use mpi
      implicit none
      integer :: err
      integer (KIND=MPI_ADDRESS_KIND) :: my_tag_ub
      logical flag


      call MPI_INIT(err)
      call MPI_COMM_GET_ATTR(MPI_COMM_WORLD, MPI_TAG_UB, my_tag_ub, flag, err)
      if (flag .eqv. .true.) then
         print *, "Got tag ub:", my_tag_ub
      else
         print *, "Couldn't find tag ub!"
      endif
      print *, "MPI_TAG_UB is:", MPI_TAG_UB
      call MPI_FINALIZE(err)
end program mpitag


The attached patch, though not completely up to the abinit coding standards, wants to do the job intended by the original code. It compiled successfully with my system, though, as per Marc's comment above, even if it is wrong it will not affect abinit's behavior.
Thanks,

Xavier

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Wed Nov 14, 2018 9:44 am
by dsolonenko
cartoixa wrote:
The attached patch, though not completely up to the abinit coding standards, wants to do the job intended by the original code. It compiled successfully with my system, though, as per Marc's comment above, even if it is wrong it will not affect abinit's behavior.


Hi to all,

I have also encountered the same problem on Ubuntu 18.04. Unfortunately, the patch from Xavier did not work out. Just to be sure that I exclude any stupid moves: how exactly should the patch be implemented during the installation?

Many thanks in advance!

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Fri Nov 16, 2018 5:27 pm
by cartoixa
I have also encountered the same problem on Ubuntu 18.04. Unfortunately, the patch from Xavier did not work out. Just to be sure that I exclude any stupid moves: how exactly should the patch be implemented during the installation?


Hi,
Preferably before configure , but definitely before make , you should run the following commands in the relevant 42_libpaw directory

Code: Select all

cp -a m_libpaw_mpi.F90 m_libpaw_mpi.F90.orig   [optional, to keep a backup]
patch m_libpaw_mpi.F90 m_libpaw_mpi.F90.patch

then go to your build directory, and perform a standard configure+make , or just make .

Xavier

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Posted: Fri Sep 20, 2019 1:00 pm
by tomasz.w
Dear All,

The problem still appears when compiling Abinit 8.10.3 on Ubuntu 18.04 with gfortran 7.4.0 and openmpi 3.1.0-3ubuntu1. Using Xavier's patch or commenting lines in m_libpaw_mpi.F90 did not help.
However, I succeeded to install Abinit 8.10.2 with original m_libpaw_mpi.F90

Best,
Tomasz