[Ipopt] Octave MEX interface on containerized macOS

Ray Zimmerman rz10 at cornell.edu
Tue Nov 19 23:12:55 EST 2019


Hi all,

I use Octave with IPOPT for continuous integration testing of some of my code via Travis CI. I am able to build a working MEX file in their Linux container, but so far I’m getting MPI runtime errors in their macOS container.

Homebrew is used to install IPOPT and Octave in the macOS container …

brew install ipopt
brew install octave

… then grab the corresponding source from the coin-or.org <http://coin-or.org/> site, and build it using the Makefile below, as follows:

IPOPT_VER=3.12.13
curl -SL https://www.coin-or.org/download/source/Ipopt/Ipopt-${IPOPT_VER}.tgz <https://www.coin-or.org/download/source/Ipopt/Ipopt-$%7BIPOPT_VER%7D.tgz> | tar -xzC $TRAVIS_BUILD_DIR/build
mv $TRAVIS_BUILD_DIR/build/Ipopt-${IPOPT_VER}/Ipopt/contrib/MatlabInterface $TRAVIS_BUILD_DIR/build/ipopt
mv $TRAVIS_BUILD_DIR/.travis/Makefile $TRAVIS_BUILD_DIR/build/ipopt/src
make -C $TRAVIS_BUILD_DIR/build/ipopt/src

It builds fine, but at runtime, when attempting to call the MEX file from Octave, I get the following error:

*** The MPI_Comm_f2c() function was called before MPI_INIT was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[Traviss-Mac-6.local:87648] Local abort before MPI_INIT completed completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!

Any suggestions for how to modify either the homebrew IPOPT install or the MEX build to avoid the use of MPI?

Thanks,

    Ray

————————————————

Makefile contents:

# Copyright 2017 Richard Lincoln. All rights reserved.

OBJS = callbackfunctions.o \
       ipoptoptions.o \
       ipopt.o \
       iterate.o \
       matlabexception.o \
       matlabfunctionhandle.o \
       matlabinfo.o \
       matlabjournal.o \
       matlabprogram.o \
       options.o \
       sparsematrix.o

CXXFLAGS = -fPIC -std=c++11 -O3 -DIPOPT_BUILD -DMATLAB_MEXFILE -DHAVE_CSTDDEF

INCL = `pkg-config --cflags ipopt` -I`mkoctfile -p OCTINCLUDEDIR`
LIBS = `pkg-config --libs ipopt`

all: ipopt.mex

%.o: %.cpp
    g++ $(CXXFLAGS) $(INCL) -o $@ -c $^

ipopt.mex: $(OBJS)
    mkoctfile $(LIBS) -v --mex --output $@ $^

clean:
    rm -f $(OBJS) ipopt.mex

check:
    octave-cli --no-gui -p `pwd`/examples --eval "examplehs038;examplehs051;examplehs071;examplelasso"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20191119/6124f245/attachment-0005.html>


More information about the Ipopt mailing list