Menu

#233 using OpenMP only if the compiler supports it (e.g. GCC>4.2)

v1.0 (example)
closed-wont-fix
nobody
None
5
2014-07-07
2009-12-04
No

As mentioned on the forum, and noted by Alain, GDL failes to compile when OpenMP support is enabled (-fopenmp) but the compiler does not support it. In case of GCC, OpenMP is supported since 4.2, and for older versions the default setting of with-openmp=true seem to break the compilation.

In ImageMagick it is handled with the following checks:

if test "${GCC}" = "yes"; then
AC_CHECK_LIB(gomp,GOMP_parallel_start,GOMP_LIBS="-lgomp",,) # gcc
else
AC_CHECK_LIB(mtsk,sunw_mp_register_warn,GOMP_LIBS="-lmtsk",,) # solaris cc
AC_CHECK_LIB(xlsmp,_xlsmpFlush,LIB_OMP="-lxlsmp",,) # AIX xlc
fi

I'll look at it some time soon - just putting here not to forget, comments welcome.
Sylwester

Discussion

  • Sylwester Arabas

    I've replaced the previous logic for toggling the OpenMP support in the configure script with a call to the AC_OPENMP macro. The macro should detect if the compiler supports OpenMP and disable OpenMP when the --disable-openmp option is supplied. Hope that fixes the problem. Please report if you test compilation with OpenMP.

    S.

     
  • Sylwester Arabas

    • status: open --> closed
     
  • Sylwester Arabas

    I'm re-opening this item, as it is still the case after this change:
    http://gnudatalanguage.cvs.sourceforge.net/viewvc/gnudatalanguage/gdl/configure.in?r1=1.82&r2=1.83&sortby=date

    To clarify, there are now two problems:
    - configure script is not detecting GSL when using GCC without OpenMP support (when -fopenmp is used, which is the default setting)
    - there's no way of disabling OpenMP without modifying configure.in/configure

    As a result, it's not possible to compile GDL with GCC <4.2 without manually disabling OpenMP in configure.in and regenerating configure scripts.

    config.log:
    ...
    configure:14995: checking for gsl_cdf_ugaussian_P in -lgsl
    configure:15020: g++ -o conftest -g -O2 -I/opt/local/include -L/opt/local/lib -fopenmp -L/opt/local/lib -fopenmp conftes
    cc1plus: error: unrecognized command line option "-fopenmp"
    cc1plus: error: unrecognized command line option "-fopenmp"
    configure:15020: $? = 1
    configure: failed program was:
    ...

    One option is the AC_OPENMP macro, another one would be to use something like the above-mentioned check using AC_CHECK_LIB? Any comments?

    Best,
    Sylwester.

    P.S. I vote for the AM_MAINTAINER_MODE([disable]) to get rid of the problems with unneeded "autoreconf" calls by make - any comments?

     
  • Sylwester Arabas

    • status: closed --> open
     
  • Lucio

    Lucio - 2010-01-20

    A comment on --with-openmp flag: I am using a compiler which I know not supporting -fopenmp, so I passed --with-openmp=no to configure, meaning disabling it. Result:

    configure: WARNING: unrecognized options: --with-openmp

    I fixed it by adding with_openmp to the list ac_user_opts and by changing references to with-openmp with with_openmp, i.e. by changing this piece of code:

    --------------------
    if test "x$with-openmp" = "x"; then
    with-openmp=yes
    fi

    if test "x$with-openmp" != "xno"; then
    CPPFLAGS="$CPPFLAGS -fopenmp"
    LDFLAGS="$LDFLAGS -fopenmp"
    fi
    --------------------

    with this:

    --------------------
    if test "x$with_openmp" = "x"; then
    with_openmp=yes
    fi

    if test "x$with_openmp" != "xno"; then
    CPPFLAGS="$CPPFLAGS -fopenmp"
    LDFLAGS="$LDFLAGS -fopenmp"
    fi
    -------------------

     
  • Sylwester Arabas

    Thats fixed in the CVS and 0.9rc4. OpenMP is now detected by checking for omp.h header.

     
  • Sylwester Arabas

    • status: open --> closed-fixed
     
  • Sylwester Arabas

    • status: closed-fixed --> open-later
     
  • Sylwester Arabas

    The current solution does not work with the Intel C++ compiler (which compiles current GDL without problem). That is, the omp.h file is found but the -fopenmp option is unrecognised:

    icc: command line warning #10006: ignoring unknown option '-fopenmp'

    The OpenMP options for icc have the -openmp* naming.

     
  • Sylwester Arabas

    This was an autoconf-related issue.
    Autoconf is now not supported anymore (in favour of CMake).
    Closing.
    S.

     
  • Sylwester Arabas

    • status: open-later --> closed-wont-fix
    • Group: --> v1.0 (example)
     

Log in to post a comment.