Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issues  [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
davydden
Posts: 17
Joined: Fri Feb 15, 2013 6:50 pm

Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issues

Post by davydden » Sat Jan 24, 2015 1:20 pm

Dear all,

I would like to add Abinit to Homebrew (a package manager similar to MacPorts).
The current attempt is in this pull request: https://github.com/Homebrew/homebrew-science/pull/1757
The file is human readable so if there are any suggestions/advices regarding the way Abinit is built, please, let me know.

The configure for which no fast test fail is:

Code: Select all

./configure
CC=/usr/local/bin/mpicc
CXX=/usr/local/bin/mpicxx
F77=/usr/local/bin/mpif77
FC=/usr/local/bin/mpif90
--prefix=/usr/local/Cellar/abinit/7.10.2
--enable-mpi=yes
--with-mpi-prefix=/usr/local/opt/open-mpi
--enable-optim=safe
--enable-openmp=no
--enable-gw-dpc
--with-linalg-flavor=custom
--with-linalg-libs=-L/usr/local/opt/veclibfort/lib -lveclibfort
--with-math-flavor=gsl
--with-math-incs=-I/usr/local/opt/gsl/include
--with-math-libs=-L/usr/local/opt/gsl/lib -lgsl
--with-fft-flavor=fftw3
--with-fft-incs=-I/usr/local/opt/fftw/include
--with-fft-libs=-L/usr/local/opt/fftw/lib -lfftw3 -lfftw3f -lfftw3_mpi -lfftw3f_mpi


While configuring / compiling / running tests, I faced two issues :

1) Abinit does not want to pick up Libxc 2.2.0. Configure complains that 2.0 is requested. Is it done deliberately, or shall it also be ok to use 2.2.0?

2) If I build with NetCDF 4.3.2 by adding

Code: Select all

--with-trio-flavor=netcdf
--with-netcdf-incs=-I/usr/local/opt/netcdf/include
--with-netcdf-libs=-L/usr/local/opt/netcdf/lib -lnetcdff -lnetcdf

to the configure script above, all fast tests fail because the number of lines is different, i.e.

Code: Select all

 returned exit_code: 14

[fast][t00][np=1]: fldiff.pl fatal error:
The diff analysis cannot be done: the number of lines to be analysed differ.
File /Users/davydden/Downloads/abinit-7.10.2/tests/fast/Refs/t00.out: 110 lines, 35 ignored
File /Users/davydden/Downloads/abinit-7.10.2/tests/Test_suite/fast_t00/t00.out: 109 lines, 35 ignored
[fast][t00][np=1]Test was not expected to fail but subrocesses returned 14
#0  0x1115bf4f2
#1  0x10ccc3663
#2  0x10c786035
#3  0x10bea4a8a
#4  0x10cd06e4e


when I compare the two, the "blessed" output has "chkinp: Checking input parameters for consistency." whereas
current output does not have this. It seems to have everything to do with NetCDF...

p.s. Here is the result of otool for the case without netcdf

Code: Select all

otool -L /usr/local/Cellar/abinit/7.10.2/bin/abinit
/usr/local/Cellar/abinit/7.10.2/bin/abinit:
   /usr/local/lib/libfftw3.3.dylib (compatibility version 8.0.0, current version 8.4.0)
   /usr/local/lib/libfftw3f.3.dylib (compatibility version 8.0.0, current version 8.4.0)
   /usr/local/lib/libfftw3_mpi.3.dylib (compatibility version 8.0.0, current version 8.4.0)
   /usr/local/lib/libfftw3f_mpi.3.dylib (compatibility version 8.0.0, current version 8.4.0)
   /usr/local/lib/libgsl.0.dylib (compatibility version 18.0.0, current version 18.0.0)
   /usr/local/lib/libvecLibFort.dylib (compatibility version 0.0.0, current version 0.0.0)
   /usr/local/lib/libmpi_usempif08.0.dylib (compatibility version 7.0.0, current version 7.0.0)
   /usr/local/lib/libmpi_mpifh.2.dylib (compatibility version 8.0.0, current version 8.0.0)
   /usr/local/lib/libmpi.1.dylib (compatibility version 8.0.0, current version 8.0.0)
   /usr/local/lib/gcc/4.9/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
   /usr/local/lib/gcc/4.9/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
   /usr/local/lib/gcc/4.9/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)

so at least it did not link against osx blas/lapack :-)

Jordan
Posts: 282
Joined: Tue May 07, 2013 9:47 am

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by Jordan » Mon Jan 26, 2015 10:25 am

I cannot help much because I am not a user of homebrew (nor OSX) but for your libxc problem, you should indeed use 2.2 (I use 2.2.1) and set the variable as

Code: Select all

with_dft_flavor="libxc"
with_libxc_incs="-I/SOMETHING/libxc-2.2.1/include"
with_libxc_libs="-L/SOMETHING/libxc-2.2.1/lib -lxcf90 -lxc"

At least on Linux system this how the new libxc can be linked with abinit

For NetCDF, the test should all pass. The missing line is printed using standard fortran IO (write statement) and does not involve any NetCDF function.
Are you sure the result are the same ? Have you checked the fast00.stdout files ? and compared them ?

Cheers

Jordan

davydden
Posts: 17
Joined: Fri Feb 15, 2013 6:50 pm

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by davydden » Mon Jan 26, 2015 3:16 pm

Hi Jordan.

Jordan wrote:I cannot help much because I am not a user of homebrew (nor OSX) but for your libxc problem, you should indeed use 2.2 (I use 2.2.1) and set the variable as

Code: Select all

with_dft_flavor="libxc"
with_libxc_incs="-I/SOMETHING/libxc-2.2.1/include"
with_libxc_libs="-L/SOMETHING/libxc-2.2.1/lib -lxcf90 -lxc"

At least on Linux system this how the new libxc can be linked with abinit


That's exactly how I use it,
yet there is configure failure:

Code: Select all

checking for the requested DFT support... libxc
checking whether to select a fallback for libxc... no
checking xc.h usability... yes
checking xc.h presence... yes
checking for xc.h... yes
checking xc_funcs.h usability... yes
checking xc_funcs.h presence... yes
checking for xc_funcs.h... yes
checking for Fortran module includes... none required
checking whether LibXC has Fortran support... yes
checking whether this is LibXC version 2.0... no
configure: error: external libxc support does not work

The libxc is `2.2.0`. I can also see it in "xc_version.h" in its include folder:

Code: Select all

#define XC_VERSION "2.2.0"
#define XC_MAJOR_VERSION 2
#define XC_MINOR_VERSION 2

Shall work, as far as I can see...

Jordan wrote:For NetCDF, the test should all pass. The missing line is printed using standard fortran IO (write statement) and does not involve any NetCDF function.
Are you sure the result are the same ? Have you checked the fast00.stdout files ? and compared them ?


I had another look at the output file and it is indeed NetCDF related:

Code: Select all

--- !ERROR
message: |
    Netcdf Error while closing the OUT.nc file: NetCDF: Not a valid ID
src_file: outvars.F90
src_line: 359
...


p.s. I was trying to upload an .stdout file but neither .txt nor .zip are allowed for upload.

User avatar
pouillon
Posts: 651
Joined: Wed Aug 19, 2009 10:08 am
Location: Spain
Contact:

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu  [SOLVED]

Post by pouillon » Mon Jan 26, 2015 5:19 pm

Abinit 7.10.2 still depends on LibXC 2.0. LibXC 2.2 will be used with Abinit 8.0.

You may get some issues with NetCDF if you build with GCC 4.8 on Mac, but I haven't understood yet what exaclty is occurring (I don't have any Mac around to test). It could be a good idea to discuss directly with the developers of NetCDF and report back here if they provide you with a solution.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

davydden
Posts: 17
Joined: Fri Feb 15, 2013 6:50 pm

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by davydden » Mon Jan 26, 2015 5:51 pm

I see... Thanks for making it clear.
I actually build with clang + gfortran 4.9.
I guess for a moment i will just avoid building with NetCDF as I do not need really need.

davydden
Posts: 17
Joined: Fri Feb 15, 2013 6:50 pm

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by davydden » Mon Jan 26, 2015 6:53 pm

Just a small follow-up question: is it possible to move `tests` folder from the build directory and run them via the same python script externally (given that abinit is in PATH)?

Perhaps one could consider this option for future releases?

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

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by jbeuken » Mon Jan 26, 2015 7:45 pm

Hi,

only for information :

there is hope to succeed to compile netcdf with gcc48 : MacPorts does ! :lol:
I use MacPorts on our MacOS X bot on our test farm :

Code: Select all

port list | grep netcdf
netcdf                         @4.3.2          science/netcdf
netcdf-cxx                     @4.2            science/netcdf-cxx
netcdf-cxx4                    @4.2.1          science/netcdf-cxx4
netcdf-fortran                 @4.2            science/netcdf-fortran


we can see on the MacPorts website than there are some patch files…

https://trac.macports.org/browser/trunk/dports/science/netcdf-fortran/Portfile
https://trac.macports.org/browser/trunk ... tran/files


my 5¢

jmb
------
Jean-Michel Beuken
Computer Scientist

davydden
Posts: 17
Joined: Fri Feb 15, 2013 6:50 pm

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by davydden » Tue Jan 27, 2015 10:35 am

Another related question:

On installation there is `abinit-tests` in `share` folder. However, it does not seem that the python scripts are runnable:

Code: Select all

$ python runtests.py fast
Traceback (most recent call last):
  File "runtests.py", line 32, in <module>
    import tests
ImportError: No module named tests

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

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by torrent » Mon Mar 09, 2015 2:33 am

Hi,

Thanks for having initiated this homebrew formula for ABINIT...

I have just submitted a few additions to your formula in homebrew-science (waiting for acceptance):
1- use of scalapack
2- simple patch to make libXC 2.2 useable
3- patch to corect the netCDF bug (occurs only when netCDF is activated and ETSF_IO is not); I have committed the changes upstream.

I also have added a user's guide in ABINIT package and on the wiki; it includes homebrew installation (also macports and manual install).

Marc
Marc Torrent
CEA - Bruyères-le-Chatel
France

davydden
Posts: 17
Joined: Fri Feb 15, 2013 6:50 pm

Re: Abinit 7.10.2 in Homebrew (OS-X) : libxc and netcdf issu

Post by davydden » Fri Mar 13, 2015 1:56 pm

Hi Marc,

Thanks for contributing an update to the formula.
Hope it will be merged soon.

Kind regards,
Denis.

Locked