regression in abinit-6.4.2/config/m4/lang-python.m4  [SOLVED]

Moderator: pouillon

Post Reply
don.fanucci
Posts: 4
Joined: Fri Nov 26, 2010 4:27 pm

regression in abinit-6.4.2/config/m4/lang-python.m4

Post by don.fanucci » Mon Dec 06, 2010 6:48 pm

Hi!

There seems to have entered a problem in abinit-6.4.2/config/m4/lang-python.m4 which manifests itself in the configure script [1].
If I revert lang-python.m4 back to 6.4.1 and recreate configure with config/scripts/makemake (using e.g. M4 010413 - Autoconf 026500 - Automake 011101 - Libtool 020206), the configure scripts seems to come out in a better shape.

[1]
The original configure script, when trying to test for numpy include files, contains the snippet (at line 15767)
"""
int
main ()
{

int main(int argc, char** argv)
{
return 0;
}
;
return 0;
}
"""
which obviously breaks regardless of include files.

Cheers!

/Mattias

renatomiceli
Posts: 10
Joined: Sat Jul 21, 2012 4:11 pm
Location: Salvador da Bahia, Brazil
Contact:

Re: regression in abinit-6.4.2/config/m4/lang-python.m4

Post by renatomiceli » Sat Jul 21, 2012 4:36 pm

Hi,

this issue is still present in Abinit's latest release (v. 6.12.3). The code snippet has moved within the configure script file but it is still there.

Lines 15271 to 15291 in abinit-6.12.3/configure:

Code: Select all

#include <Python.h>
#include <numpy/arrayobject.h>
#ifdef FC_DUMMY_MAIN
#ifndef FC_DUMMY_MAIN_EQ_F77
#  ifdef __cplusplus
     extern "C"
#  endif
   int FC_DUMMY_MAIN() { return 1; }
#endif
#endif
int
main ()
{

int main(int argc, char** argv)
{
    return 0;
}
  ;
  return 0;
}


This code will necessarily break, regardless of Python or NumPy being or not properly installed and configured. However, removing lines 15281~15284 and 15289~15291 fixes the issue and both packages can be properly identified.

This is due to a bug in abinit-6.12.3/config/m4/lang-python.m4, whose lines 30 to 45 are below:

Code: Select all

  if test "${abi_numpy_new}" = "no"; then
    AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[
#include <Python.h>
#include <numpy/arrayobject.h>]],[[
int main(int argc, char** argv)
{
    return 0;
}]])],[abi_numpy_new="yes"])
    if test "${abi_numpy_new}" = "yes"; then
      AC_DEFINE([HAVE_NUMPY],1,[Define to 1 if you have a modern implementation
of NumPy.])
      AC_MSG_RESULT([found])
    else
      AC_MSG_RESULT([not found])
    fi
  fi


This has been causing some trouble especially to identify the NumPy headers. Can we fix this issue, please?

Kind regards,
Renato Miceli
Mr. Renato Miceli
Independent HPC & Supercomputing Consultant
http://renatomiceli.com/

renatomiceli
Posts: 10
Joined: Sat Jul 21, 2012 4:11 pm
Location: Salvador da Bahia, Brazil
Contact:

Re: regression in abinit-6.4.2/config/m4/lang-python.m4

Post by renatomiceli » Fri Nov 30, 2012 9:45 pm

Hi,

just to update that this issue is still present in Abinit 7.0.3 recently released.

However, I found out that the issue is not within Abinit but actually in the Intel compilers.
I tested the code below, used to check whether the NumPy headers exist and are accessible:

Code: Select all

#include <Python.h>
#include <numpy/arrayobject.h>
#ifdef FC_DUMMY_MAIN
#ifndef FC_DUMMY_MAIN_EQ_F77
#  ifdef __cplusplus
     extern "C"
#  endif
   int FC_DUMMY_MAIN() { return 1; }
#endif
#endif
int
main ()
{

int main(int argc, char** argv)
{
    return 0;
}
  ;
  return 0;
}

This code moved within but still exists in the "abinit-7.0.3/configure" file shipped with Abinit 7.0.3, between lines 15057 and 15077. It is generated from "abinit-7.0.3/config/m4/lang-python.m4", still in lines 30 to 45.

The code was compiled with the following compilation line:

Code: Select all

$ CC -c -O3 -m64 -I/packages/python/2.7-intel/include/python2.7 -I/packages/numpy/1.5.0-gnu/lib64/python2.6/site-packages/numpy/core/include -L/packages/python/2.7-intel/lib -L/packages/numpy/1.5.0-gnu/lib64/python2.6/site-packages/numpy/core/lib -lpython2.7 -lnpymath test.c

I tested the aforementioned code with several different compilers and the compilation results are below:
  • GCC 4.3.4: passed
  • GCC 4.5.1: passed
  • GCC 4.6.3: passed
  • Intel Compiler 9.1: failed with error code 4
  • Intel Compiler 10.1: failed with error code 4
  • Intel Compiler 11.0: failed with error code 2
  • Intel Compiler 11.1: failed with error code 2
  • Intel Compiler 12.0.0: failed with error code 2
  • Intel Compiler 12.0.5: passed
  • Intel Compiler 12.1.0: passed
  • Intel Compiler 12.1.5: passed
  • Intel Compiler 13.0.0: passed

When ICC failed with code 4, the error message was as below:

Code: Select all

/usr/include/limits.h(125): catastrophic error: could not open source file "limits.h"
  # include_next <limits.h>
                           ^

compilation aborted for test.c (code 4)

And error code 2 had ICC output the following message:

Code: Select all

test.c(15): warning #159: declaration is incompatible with previous "main" (declared at line 12)
    int main(int argc, char** argv)                       
        ^

test.c(16): error: expected a ";"
    {                                                     
    ^

test.c(19): warning #12: parsing restarts here after previous syntax error
      ;
      ^

compilation aborted for test.c (code 2)

I am currently sed'ing the "abinit-7.0.3/configure" file to remove lines 15067-15070 and 15075-15077 so to avoid the config step from crashing regardless of the compiler used.
I appreciate if this issue can be fixed in the next release, or at least that this unexpected behavior is mentioned in the "KNOWN_PROBLEMS" file.
I realize that the Intel compilers 10.1 and 11.0 are recommended in the "KNOWN_PROBLEMS" file, even though I found out they are likewise buggy.

Thank you in advance for your time and patience.
Looking forward to hearing from you soon.

Kind regards,
Renato Miceli
Mr. Renato Miceli
Independent HPC & Supercomputing Consultant
http://renatomiceli.com/

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

Re: regression in abinit-6.4.2/config/m4/lang-python.m4  [SOLVED]

Post by pouillon » Wed Dec 05, 2012 1:16 pm

The KNOWN_PROBLEMS file is outdated regarding this aspect. If you have to use Intel compilers, it's better to use the 12.1.* versions. I personally strongly advise against the use of any *.0.* version of these compilers, as Abinit will likely trigger most of their bugs, with side effects that are sometimes very difficult to identify.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

Post Reply