Possible bug in 42_libpaw/m_libpaw_mpi.F90

Documentation, Web site and code modifications

Moderators: baguetl, routerov

Locked
cartoixa
Posts: 3
Joined: Sun Oct 07, 2018 8:10 pm

Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by cartoixa » Sun Oct 07, 2018 10:45 pm

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

User avatar
torrent
Posts: 127
Joined: Fri Aug 14, 2009 7:40 pm

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by torrent » Wed Oct 17, 2018 6:10 pm

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.
Marc Torrent
CEA - Bruyères-le-Chatel
France

User avatar
jbeuken
Posts: 365
Joined: Tue Aug 18, 2009 9:24 pm
Contact:

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by jbeuken » Thu Oct 18, 2018 3:31 pm

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?
------
Jean-Michel Beuken
Computer Scientist

ebousquet
Posts: 469
Joined: Tue Apr 19, 2011 11:13 am
Location: University of Liege, Belgium

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by ebousquet » Thu Oct 18, 2018 4:45 pm

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

User avatar
jbeuken
Posts: 365
Joined: Tue Aug 18, 2009 9:24 pm
Contact:

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by jbeuken » Fri Oct 19, 2018 9:25 am

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
------
Jean-Michel Beuken
Computer Scientist

cartoixa
Posts: 3
Joined: Sun Oct 07, 2018 8:10 pm

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by cartoixa » Sun Oct 21, 2018 1:20 am

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
Attachments
m_libpaw_mpi.F90.patch.in
Might want to remove .in extension.
(7.42 KiB) Downloaded 715 times

dsolonenko
Posts: 1
Joined: Wed Nov 14, 2018 9:42 am

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by dsolonenko » Wed Nov 14, 2018 9:44 am

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!

cartoixa
Posts: 3
Joined: Sun Oct 07, 2018 8:10 pm

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by cartoixa » Fri Nov 16, 2018 5:27 pm

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

tomasz.w
Posts: 4
Joined: Sun Nov 19, 2017 11:00 pm

Re: Possible bug in 42_libpaw/m_libpaw_mpi.F90

Post by tomasz.w » Fri Sep 20, 2019 1:00 pm

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

Locked