Opened 11 years ago

Closed 10 years ago

#64 closed enhancement (fixed)

improve capability to use precompiled MUMPS library

Reported by: stefan Owned by: andreasw
Priority: major Component: configuration tests
Version: 0.5 Keywords:
Cc:

Description

Hi,

the current way to provide a user-compiled MUMPS library is to specify a directory via --with-mumps-dir. Then the build system assumes to find the MUMPS header files there and the libraries $mumps_dir/lib/libdmumps.$libe, $mumps_dir/lib/libpord.$libe, $mumps_dir/libseq/libmpiseq.$libe. This probably works fine if MUMPS had been compiled with the MUMPS Makefiles.

However, in case that one has a mumps library (maybe as one instead of three files as produced by ThirdParty/Mumps) and header files in other locations, it seem to be extremly difficult to make Ipopt use this library. For other 3rd party codes, one can specify the link line and include flags via --with-PROJ-lib and --with-PROJ-incdir. This seem to offer more flexibility. Further, a --with-mumps-lib would allow to specify mumps-library-specific linking flags, e.g., in case that fortran runtime libraries from a different compiler are needed.

Finally, having also a --enable-mumps-libcheck option would be great, since it allows to build an Ipopt library that includes a Mumps interface without having the MUMPS library actually present or linking.

Thank you, Stefan

Change History (3)

comment:1 Changed 11 years ago by andreasw

  • Status changed from new to assigned

Hi Stefan,

I will be happy to add a patch to coin.m4 if you could write the modification necessary to accommodate what you would like to have added.

Thanks

Andreas

comment:2 Changed 11 years ago by stefan

OK,

here is a modified AC_COIN_HAS_MUMPS function. It should define the same symbols,variables,conditionals,... as before, so there is no change in a configure.ac required.

For the user, the difference is that instead of --mumps-dir, he now has to specify the exact linking flags. Further, only one include dir is allowed, so the user will need to copy the mpi and mumps/pord header files in the same directory. The gain is a higher flexibility on the linking flags, e.g., I was now able to build Ipopt with gcc on machine without Fortran90 compiler using a MUMPS library that was build with an Intel compiler on a different machine.

AC_DEFUN([AC_COIN_HAS_MUMPS],
[
if test "$PACKAGE_NAME" = ThirdPartyMumps; then
  coin_mumpsobjdir=../Mumps
else
  coin_mumpsobjdir=../ThirdParty/Mumps
fi
coin_mumpssrcdir=$abs_source_dir/$coin_mumpsobjdir/MUMPS

MAKEOKFILE=.MakeOk

#check if user provides a MUMPS library (that works)
AC_LANG_PUSH(C)
AC_COIN_HAS_USER_LIBRARY(mumps, MUMPS, dmumps_c.h, dmumps_c)
AC_LANG_POP(C)

if test "$coin_has_mumps" = "true"; then  # user provided mumps library
  use_mumps=yes
  coin_has_mumps=yes

  MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $MUMPSINCDIR\`"
  ADDLIBS="$MUMPSLIB $ADDLIBS"

else # no user provided library, so we try to build our own
  use_mumps=BUILD

  # Check if the MUMPS' ThirdParty project has been configured
  if test "$PACKAGE_NAME" != ThirdPartyMumps; then
    if test -r $coin_mumpsobjdir/.MakeOk; then
      use_mumps=BUILD
      # Mumps needs pthreads
      AC_LANG_PUSH(C)
      save_LIBS="$LIBS"
      LIBS="$LIBS $FLIBS"
      AC_CHECK_LIB([pthread],[pthread_create],[LIBS="-lpthread $save_LIBS"; ADDLIBS="-lpthread $ADDLIBS"],[LIBS="save_LIBS"])
      AC_LANG_POP(C)
  
      MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $coin_mumpssrcdir/libseq\` -I\`\$(CYGPATH_W) $coin_mumpssrcdir/include\`"
    else
      use_mumps=
    fi
  fi

  # if a user provided library is used, then COIN_HAS_USER_LIBRARY takes care of the COIN_HAS_MUMPS conditional and preprocessor symbol
  AM_CONDITIONAL([COIN_HAS_MUMPS],[test x"$use_mumps" != x])
  if test x"$use_mumps" != x; then
    AC_DEFINE([COIN_HAS_MUMPS],[1],[If defined, the MUMPS Library is available.])
    coin_has_mumps=yes
  else
    coin_has_mumps=no
  fi
  AC_MSG_CHECKING([whether MUMPS is available])
  AC_MSG_RESULT([$coin_has_mumps])
fi

if test x"$use_mumps" != x; then
  # we need the Fortran runtime libraries if we want to link with C/C++
  coin_need_flibs=yes

  AC_SUBST(MUMPS_INCFLAGS)
fi

AM_CONDITIONAL([COIN_BUILD_MUMPS],[test "$use_mumps" = BUILD])

]) # AC_COIN_HAS_MUMPS

Best, Stefan

comment:3 Changed 10 years ago by andreasw

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.