abinit/abipy

Parse error for abinit build options

antoine-levitt opened this issue · 5 comments

I get a parse error in abipy:

In [3]: abipy.abilab.abicheck()
AbiPy Manager:
[Qadapter 0]
ShellAdapter:localhost
Hardware:
   num_nodes: 1, sockets_per_node: 1, cores_per_socket: 2, mem_per_node 4096,
Qadapter selected: 0

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-a999053d8689> in <module>()
----> 1 abipy.abilab.abicheck()

/usr/local/lib/python3.6/dist-packages/abipy/abilab.py in abicheck(verbose)
    334     if manager is not None:
    335         cprint("AbiPy Manager:\n%s\n" % str(manager), color="green")
--> 336         build = AbinitBuild(manager=manager)
    337         if not build.has_netcdf: app("Abinit executable does not support netcdf")
    338         cprint("Abinitbuild:\n%s" % str(build), color="magenta")

/usr/local/lib/python3.6/dist-packages/abipy/flowtk/tasks.py in __init__(self, workdir, manager)
   1163                 self.has_netcdf = "netcdf" in line
   1164             if "openMP support" in line: self.has_omp = yesno2bool(line)
-> 1165             if "Parallel build" in line: self.has_mpi = yesno2bool(line)
   1166             if "Parallel I/O" in line: self.has_mpiio = yesno2bool(line)
   1167 

/usr/local/lib/python3.6/dist-packages/abipy/flowtk/tasks.py in yesno2bool(line)
   1155         def yesno2bool(line):
   1156             ans = line.split()[-1].lower()
-> 1157             return dict(yes=True, no=False, auto=True)[ans]
   1158 
   1159         # Parse info.

KeyError: ':'

I think this is because

antoine@beta ~/abipy $ abinit -b
 DATA TYPE INFORMATION: 
 REAL:      Data type name: REAL(DP) 
            Kind value:      8
            Precision:      15
            Smallest nonnegligible quantity relative to 1: 0.22204460E-015
            Smallest positive number:                      0.22250739E-307
            Largest representable number:                  0.17976931E+309
 INTEGER:   Data type name: INTEGER(default) 
            Kind value: 4
            Bit size:   32
            Largest representable number: 2147483647
 LOGICAL:   Data type name: LOGICAL 
            Kind value: 4
 CHARACTER: Data type name: CHARACTER             Kind value: 1
  MPI-IO support is OFF

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 CPP options activated during the build:

                    CC_GNU                   CXX_GNU                    FC_GNU
 
 HAVE_FC_ALLOCATABLE_DT...             HAVE_FC_ASYNC         HAVE_FC_BACKTRACE
 
  HAVE_FC_COMMAND_ARGUMENT      HAVE_FC_COMMAND_LINE        HAVE_FC_CONTIGUOUS
 
           HAVE_FC_CPUTIME              HAVE_FC_EXIT             HAVE_FC_FLUSH
 
             HAVE_FC_GAMMA            HAVE_FC_GETENV   HAVE_FC_IEEE_ARITHMETIC
 
   HAVE_FC_IEEE_EXCEPTIONS          HAVE_FC_INT_QUAD             HAVE_FC_IOMSG
 
     HAVE_FC_ISO_C_BINDING  HAVE_FC_ISO_FORTRAN_2008        HAVE_FC_LONG_LINES
 
        HAVE_FC_MOVE_ALLOC  HAVE_FC_ON_THE_FLY_SHAPE           HAVE_FC_PRIVATE
 
         HAVE_FC_PROTECTED           HAVE_FC_SHIFTLR         HAVE_FC_STREAM_IO
 
            HAVE_FC_SYSTEM                HAVE_FFTW3        HAVE_FFTW3_THREADS
 
          HAVE_FORTRAN2003                 HAVE_HDF5        HAVE_LIBPAW_ABINIT
 
      HAVE_LIBTETRA_ABINIT                HAVE_LIBXC         HAVE_LINALG_AXPBY
 
        HAVE_LINALG_GEMM3M               HAVE_NETCDF       HAVE_NETCDF_FORTRAN
 
                HAVE_NUMPY             HAVE_OS_LINUX         HAVE_TIMER_ABINIT
 
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 === Build Information === 
  Version       : 9.0.3
  Build target  : x86_64_linux_gnu7.5
  Build date    : 20200429

 === Compiler Suite === 
  C compiler       : gnu7.5
  C++ compiler     : gnu7.5
  Fortran compiler : gnu7.5
  CFLAGS           : -g -O2 -mtune=native -march=native
  CXXFLAGS         : -g -O2 -mtune=native -march=native
  FCFLAGS          : -g -ffree-line-length-none     -I/usr//include  -I/usr//include
  FC_LDFLAGS       : 

 === Optimizations === 
  Debug level        : @abi_debug_flavor@
  Optimization level : @abi_optim_flavor@
  Architecture       : unknown_unknown

 === Multicore === 
  Parallel build : 
  Parallel I/O   : 
  openMP support : 
  GPU support    : 

 === Connectors / Fallbacks === 
  LINALG flavor  : netlib+openblas
  FFT flavor     : fftw3-threads
  HDF5           : yes
  NetCDF         : yes
  NetCDF Fortran : yes
  LibXC          : yes
  Wannier90      : no

 === Experimental features === 
  Exports             : 
  GW double-precision : 

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Default optimizations:
   -O2 -mtune=native -march=native


 Optimizations for 43_ptgroups:
   -O0


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

and it's failing to parse the "multicore" section.

This is for abinit 9.0.3.

Hi Antoine,

Yes, Abinit9 has changed the format used to print the build option.

I've pushed a temporary fix in d55d8ec
(see modifications in flowtk.tasks.py)
You may want to patch your version of tasks.py with the one found in the develop branch

I haven't yet released a new version of AbiPy on pypi because Abinit9 is a beta-release and I was not expecting users to run AbiPy calculations with Abinit9.

The AbiPy post-processing tools should work both with Abinit8 and Abinit9 because we haven't changed the netcdf format but at the level of the workflows there are some new features implemented in Abinit that we plan to support in AbiPy.
All these changes will be gradually integrated when a stable Abinit9 is released.

Hi! Thanks for this, so it's my bad for going with abinit9 - I just picked the first link on the abinit website actually... I'll try with abinit8

OK for some reason I can't get abinit8 to build, so I've tried monkey patching tasks.py (adding those two lines in your commit) and now abipy complains my abinit executable doesn't have netcdf, even though abinit -b answers

 === Connectors / Fallbacks === 
  LINALG flavor  : netlib+openblas
  FFT flavor     : fftw3-threads
  HDF5           : yes
  NetCDF         : yes
  NetCDF Fortran : yes
  LibXC          : yes
  Wannier90      : no

Can you try the latest version of tasks.py available here ?
There should be a check for the presence of "Netcdf Fortran" that should work with Abinit9:

       # Parse info.
        # flavor options were used in Abinit v8
        for line in self.info.splitlines():
            if "Version" in line: self.version = line.split()[-1]
            if "TRIO flavor" in line:
                self.has_netcdf = "netcdf" in line
            if "NetCDF Fortran" in line:
                self.has_netcdf = yesno2bool(line)

yay, it works! thanks!