[Ipopt] Octave MEX interface on containerized macOS
Ted Ralphs
ted at lehigh.edu
Thu Nov 21 15:08:04 EST 2019
Ah yes, very good point about bash on OS X. You absolutely need to install
and use Homebrew bash. I will add it to the documentation.
For the problem with pkg-config search path, you can just set the
environment variable PKG_CONFIG_PATH. I do something like
INCL = `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --cflags ipopt`
-I`mkoctfile -p OCTINCLUDEDIR`
LIBS = `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --libs ipopt`
Cheers,
Ted
On Thu, Nov 21, 2019 at 12:56 PM Ray Zimmerman <rz10 at cornell.edu> wrote:
> Thanks Ted. This is helpful.
>
> FYI, when I tried using coinbrew to install from source, I got an error
> due to macOS bash being older than required. So I believe bash needs to be
> added to the brew installs listed here
> <https://coin-or.github.io/user_introduction.html#os-x-1> that should be
> done before running coinbrew.
>
> I’m able to build IPOPT from source now, both 3.13 (which I discovered no
> longer includes the files to build the Matlab interface) and 3.12 (which
> does). My (hopefully last) remaining roadblock is collecting the correct
> include and lib options to use to make the MEX interface.
>
> The Makefile I used to build successfully with Homebrew installed ipopt
> has the following lines …
>
> INCL = `pkg-config --cflags ipopt` -I`mkoctfile -p OCTINCLUDEDIR`
> LIBS = `pkg-config --libs ipopt`
>
> And pkg-config complains that *"Package ipopt was not found in the
> pkg-config search path."*
> Can anyone offer a suggestion on how to modify them for an installation of
> IPOPT that was built from source?
>
> Thanks,
>
> Ray
>
>
> On Nov 20, 2019, at 9:24 AM, Ted Ralphs <ted at lehigh.edu> wrote:
>
> I don't know that much about Mumps, but it looks like the Ipopt homebrew
> recipe builds Ipopt with the MPI version of Mumps. The formula is here:
>
> https://github.com/Homebrew/homebrew-core/blob/master/Formula/ipopt.rb
>
> It looks to me like the easiest solution is just to build Ipopt yourself
> instead of with Homebrew. You are already downloading the Ipopt code
> anyway, so this would seem to be straightforward. If you really need to
> install from homebrew, I just found another tap that provides an Ipopt
> recipe and expicitly allows the option not to use MPI:
>
> https://github.com/dpo/homebrew-openblas
> <https://github.com/dpo/homebrew-openblas/tree/master/Formula>
>
> You could either use this one or submit a PR to Homebrew core to ask that
> this option be added (not sure how successful this will be).
>
> Cheers,
>
> Ted
>
>
>
> On Tue, Nov 19, 2019 at 11:18 PM Ray Zimmerman <rz10 at cornell.edu> wrote:
>
>> 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 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 |
>> 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"
>>
>> _______________________________________________
>> Ipopt mailing list
>> Ipopt at list.coin-or.org
>> https://list.coin-or.org/mailman/listinfo/ipopt
>>
>
>
> --
> Dr. Ted Ralphs
> Professor, Industrial and Systems Engineering
> Lehigh University
> (610) 628-1280
> ted 'at' lehigh 'dot' edu
> coral.ie.lehigh.edu/~ted
>
>
>
--
Dr. Ted Ralphs
Professor, Industrial and Systems Engineering
Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20191121/1adfc6ed/attachment.html>
More information about the Ipopt
mailing list