Skip to content

Commit

Permalink
Add support for parallel Jacobian evaluation
Browse files Browse the repository at this point in the history
- Parallel Jacobian evaluation will be encapsulated by USE_PARJAC defines.
- Enable parallel Jacobian evaluation passing --enable-parjac to
OMCompiler/configure, which will check for OpenMP support and add
corresponding Flags to simulation makefile and c runtime makefile.
  • Loading branch information
mflehmig authored and adrpo committed Nov 5, 2019
1 parent 388e08b commit 549fe86
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions OMCompiler/SimulationRuntime/c/Makefile.in
Expand Up @@ -14,6 +14,10 @@ CC = @CC@
CXX = @CXX@
CONFIG_CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@
OMPCC = @CC@ @OMPCFLAGS@
OMPCFLAGS=@OMPCFLAGS@


ifeq ($(OMC_MINIMAL_RUNTIME),)
IPOPT_CFLAGS=@IPOPT_CFLAGS@
else
Expand All @@ -31,6 +35,13 @@ LDFLAGS=-L$(OMBUILDDIR)/lib/@host_short@/omc @RT_LDFLAGS@
LDFLAGS_SIM=-L$(OMBUILDDIR)/lib/@host_short@/omc @RT_LDFLAGS_SIM@
endif

USE_PARJAC = @USE_PARJAC@
ifeq (@USE_PARJAC@,yes)
CONFIG_CFLAGS+=@OMPCFLAGS@ -DUSE_PARJAC
LDFLAGS+=@OMPCFLAGS@
else
OMPCFLAGS=
endif
defaultMakefileTarget = Makefile

LIBMAKEFILE = Makefile
Expand Down
24 changes: 24 additions & 0 deletions OMCompiler/configure.ac
Expand Up @@ -468,6 +468,30 @@ AC_MSG_RESULT([$RUNTIMECFLAGS])
CC="$CC_OLD"
CFLAGS="$CFLAGS_OLD"

dnl Parallel Jacobian evaluation in C runtime
dnl OpenMP needs to be available
dnl If enabled, model needs to be compiled using -DUSE_PARJAC (add to RUNTIMECFLAGS)
AC_ARG_ENABLE(
[parjac],
AS_HELP_STRING([--enable-parjac],
[enable parallel symbolical Jacobian evaluation in C runtime]),
[want_parjac=$enableval],
[want_parjac=no]
)
USE_PARJAC="no"
if test x$want_parjac = xyes; then
AC_MSG_CHECKING([for parallel Jacobian evaluation])
if test "$CONFIG_WITH_OPENMP=1"; then
USE_PARJAC="yes"
RUNTIMECFLAGS="$RUNTIMECFLAGS $OMPCFLAGS -DUSE_PARJAC"
else
AC_MSG_WARN([========= OpenMP is not available, not define par. jac])
fi
fi
AC_MSG_RESULT([$USE_PARJAC])
AC_SUBST(USE_PARJAC)


LIBS=""
AC_SEARCH_LIBS(dlopen,dl)
LIBDL="$LIBS"
Expand Down

0 comments on commit 549fe86

Please sign in to comment.