Compilling Abinit 9 on mac OS  [SOLVED]

option, parallelism,...

Moderators: fgoudreault, mcote

Forum rules
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Locked
gabriel.antonius
Posts: 58
Joined: Mon May 03, 2010 10:34 pm

Compilling Abinit 9 on mac OS

Post by gabriel.antonius » Wed May 27, 2020 2:56 am

Dear all,
I’m having trouble getting Abinit 9.0.2 to work on Mac OS 10.15 - Catalina. I can compile the code, but every test segfaults with the message

Code: Select all

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
I’m doing a minimal build with the following .ac9 file:

Code: Select all

with_mpi="no"
with_hdf5="/usr/local/"
with_netcdf="/usr/local"
with_netcdf_fortran="/usr/local"
with_libxc="/usr/local"
with_optim_flavor="none"
with_debug_flavor="paranoid"
The dependencies have all been installed with homebrew. I’m using gfortran-9, and for the C and C++ compilers I tried either gcc-9 or Apple clang version 11.0.9, with the same result. Further debugging with gdb reveals that the segfault happens in the function exit_check at line 344, but that doesn’t help much…

Edit: I tried to build the required fallbacks and use those instead of the ones from homebrew, but got the same result, which suggests that the external dependencies might not be the problem. I also tried doing everything with gcc-7 instead of gcc-9, still with the same result.

If anyone managed to run Abinit 9 on a mac, please let me know of a configuration that works.
Gabriel Antonius
Université du Québec à Trois-Rivières

User avatar
gmatteo
Posts: 291
Joined: Sun Aug 16, 2009 5:40 pm

Re: Compilling Abinit 9 on mac OS  [SOLVED]

Post by gmatteo » Wed May 27, 2020 11:11 pm

Hi Gabriel,

I think that with_debug_flavor="paranoid" activates compiler options to trap SIGFPE and the lhs of
the condition:

tsec(1tsec(1)-tcpu_last>two

may trigger an exception.

Can you try this patch?

Code: Select all

diff --git a/src/56_io_mpi/m_exit.F90 b/src/56_io_mpi/m_exit.F90
index c06b42018..8256cdec0 100644
--- a/src/56_io_mpi/m_exit.F90
+++ b/src/56_io_mpi/m_exit.F90
@@ -331,6 +331,7 @@ subroutine exit_check(cpus,filename,iexit,iout,comm,openexit)
      iexit=0

      ! Is it worth to test the cpu time ?
+     tsec = zero
      if (abs(cpus)>1.0d-5 .or. openexit==1) then
        call timein(tsec(1),tsec(2))
      end if

gabriel.antonius
Posts: 58
Joined: Mon May 03, 2010 10:34 pm

Re: Compilling Abinit 9 on mac OS

Post by gabriel.antonius » Thu May 28, 2020 6:50 pm

I did try this, but that resulted in a different segfault coming from somewhere in the linear algebra libraries. Initially I had decided that wasn't the real source of the bug. Using linalg from fallback didn't solve it either.

However, fixing exit_check AND using linalg from the fallbacks did solve the problem! So I guess that was a combination of two problems...
Gabriel Antonius
Université du Québec à Trois-Rivières

gabriel.antonius
Posts: 58
Joined: Mon May 03, 2010 10:34 pm

Re: Compilling Abinit 9 on mac OS

Post by gabriel.antonius » Thu May 28, 2020 6:52 pm

For future readers, I would summarize my configuration as follow.

My .ac9 file looks like this:

Code: Select all

# MPI support
with_mpi="/usr/local/"

# HDF5
with_hdf5="/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install/hdf5/default"

# NetCDF
with_netcdf="/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install/netcdf4/default"
with_netcdf_fortran="/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install/netcdf4_fortran/default"

# linalg
LINALG_LIBS="-L/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install/linalg/default/lib/ -llapack -lblas"

# libxc
with_libxc="/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install/libxc/default"
When compiling the fallbacks, I installed the files locally. But I needed to prevent the configure script from using hdf5 of homebrew. Thus, I did

Code: Select all

cd /Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/
mkdir install
../configure  --disable-libpsml   --disable-xmlf90    --disable-bigdft   --disable-wannier90  --disable-atompaw   --prefix=/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install --with-hdf5=/Users/Antonius/Work/Software/Abinit/abinit-gitlab/fallbacks/abinit-fallbacks-9.0.2/build5/install/hdf5/default/
Gabriel Antonius
Université du Québec à Trois-Rivières

Locked