Skip to content

Commit

Permalink
build MA28 interface if single-precision version of MA28 available
Browse files Browse the repository at this point in the history
- though ThirdParty-HSL cannot build a MA28s at the moment
  • Loading branch information
svigerske committed Nov 25, 2020
1 parent 1e65019 commit c9500e2
Show file tree
Hide file tree
Showing 10 changed files with 403 additions and 37 deletions.
106 changes: 95 additions & 11 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -23849,8 +23849,90 @@ $as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $ac_cv_h
as_fn_error $? "Provided package HSL is not working or does not contain MA27." "$LINENO" 5
fi

# extra check for MA28, since that decides whether we have to build IpMa28Partition.F
if test -n "$F77" && test $precision = double ; then
# extra check for MA28(s), since that decides whether we have to build IpMa28(s)Partition.F
if test -n "$F77" ; then
case $precision in
single )

ac_save_LIBS="$LIBS"
LIBS="$HSLLIB_LFLAGS $LIBS"


ma28a_namemangling=unknown

for ac_extra in "no extra underscore" ; do
for ac_case in "lower case" "upper case" ; do
for ac_trail in "underscore" "no underscore" ; do
case $ac_case in
"lower case")
ac_name=ma28a
;;
"upper case")
ac_name=MA28A
;;
esac
if test "$ac_trail" = underscore ; then
ac_name=${ac_name}_
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5
$as_echo_n "checking for function $ac_name in $LIBS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_name ();
#ifdef F77_DUMMY_MAIN

# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }

#endif
int
main ()
{
return $ac_name ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ma28a_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}"
ac_success=yes
else
ac_success=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5
$as_echo "$ac_success" >&6; }
if test $ac_success = yes ; then
break 3
fi
done
done
done
LIBS=$ac_save_LIBS

if test $ac_success = yes ; then

if test "$ma28a_namemangling" != "$ac_cv_f77_mangling" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&5
$as_echo "$as_me: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&2;}
else
have_ma28=yes
fi


fi
;;
double )

ac_save_LIBS="$LIBS"
LIBS="$HSLLIB_LFLAGS $LIBS"
Expand Down Expand Up @@ -23920,16 +24002,18 @@ $as_echo "$ac_success" >&6; }

if test $ac_success = yes ; then

if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&5
if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&5
$as_echo "$as_me: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&2;}
else
have_ma28=yes
fi
else
have_ma28=yes
fi


fi

;;
* ) as_fn_error $? "HSL cannot be used with --with-precision=$precision" "$LINENO" 5 ;;
esac
fi
fi
if test "$have_ma28" = yes; then
Expand Down Expand Up @@ -24959,7 +25043,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 24962 "configure" */
/* #line 25046 "configure" */
public class Test {
}
EOF
Expand Down Expand Up @@ -25445,7 +25529,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 25448 "configure" */
/* #line 25532 "configure" */
public class Test {
}
EOF
Expand Down Expand Up @@ -25479,7 +25563,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
/* [#]line 25482 "configure" */
/* [#]line 25566 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);
Expand Down
30 changes: 21 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,27 @@ if test "$coin_has_hsl" = yes ; then
AC_MSG_ERROR([Provided package HSL is not working or does not contain MA27.])
fi

# extra check for MA28, since that decides whether we have to build IpMa28Partition.F
if test -n "$F77" && test $precision = double ; then
AC_COIN_TRY_LINK([ma28ad],[$HSLLIB_LFLAGS],,[
if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then
AC_MSG_WARN([Name mangling of MA28 different than Fortran. This will not link. Disabling MA28])
else
have_ma28=yes
fi
])
# extra check for MA28(s), since that decides whether we have to build IpMa28(s)Partition.F
if test -n "$F77" ; then
case $precision in
single )
AC_COIN_TRY_LINK([ma28a],[$HSLLIB_LFLAGS],,[
if test "$ma28a_namemangling" != "$ac_cv_f77_mangling" ; then
AC_MSG_WARN([Name mangling of MA28 different than Fortran. This will not link. Disabling MA28])
else
have_ma28=yes
fi
]) ;;
double )
AC_COIN_TRY_LINK([ma28ad],[$HSLLIB_LFLAGS],,[
if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then
AC_MSG_WARN([Name mangling of MA28 different than Fortran. This will not link. Disabling MA28])
else
have_ma28=yes
fi
]) ;;
* ) AC_MSG_ERROR([HSL cannot be used with --with-precision=$precision]) ;;
esac
fi
fi
AM_CONDITIONAL([HAVE_MA28],[test "$have_ma28" = yes])
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void RegisterOptions_LinearSolvers(
IterativeWsmpSolverInterface::RegisterOptions(roptions);
#endif

#if defined(COINHSL_HAS_MA28) && defined(F77_FUNC) && !defined(IPOPT_SINGLE)
#if ((defined(COINHSL_HAS_MA28) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA28S) && defined(IPOPT_SINGLE))) && defined(F77_FUNC)
roptions->SetRegisteringCategory("MA28 Linear Solver");
Ma28TDependencyDetector::RegisterOptions(roptions);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithm/LinearSolvers/IpMa28Partition.F
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ subroutine MA28PART(TASK, N, M, NZ, A, IROW, ICOL, PIVTOL,
C Title
C-------------------------------------------------------------------------------
C
CT Interface to MA28 for detecting degenerate constraints
CT Interface to MA28 double precision for detecting degenerate constraints
C
C-------------------------------------------------------------------------------
C Programm description
Expand Down
6 changes: 3 additions & 3 deletions src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "CoinHslConfig.h"
#endif

// if we have MA28 in HSL or the linear solver loader, and build for double precision, then we want to build the MA28 interface
#if defined(COINHSL_HAS_MA28) && defined(F77_FUNC) && !defined(IPOPT_SINGLE)
// if we have MA28 in HSL and can compile Fortran code, then we want to build the MA28 interface
#if ((defined(COINHSL_HAS_MA28) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA28S) && defined(IPOPT_SINGLE))) && defined(F77_FUNC)

#include "IpMa28TDependencyDetector.hpp"

Expand Down Expand Up @@ -140,4 +140,4 @@ bool Ma28TDependencyDetector::DetermineDependentRows(

} // namespace Ipopt

#endif /* COINHSL_HAS_MA28 */
#endif /* COINHSL_HAS_MA28(s) */
Loading

0 comments on commit c9500e2

Please sign in to comment.