Skip to content

Commit

Permalink
Recompiled Octave 6.4.0 mex files for windows and linux, updated scri…
Browse files Browse the repository at this point in the history
…pts and submodules

(cherry picked from commit b353948)
  • Loading branch information
wahln committed Mar 23, 2023
1 parent 4f436df commit c274d6d
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 24 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added ompMC/omc_matrad.mexoct640a64
Binary file not shown.
Binary file added ompMC/omc_matrad.mexoct640w64
Binary file not shown.
Binary file removed ompMC/omc_matrad.mexocta64
Binary file not shown.
Binary file removed ompMC/omc_matrad.mexoctmac64
Binary file not shown.
Binary file removed ompMC/omc_matrad.mexoctw64
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# How to compile the IPOPT mex interface for Octave 5.2.0 (64-bit) in Windows
# How to compile the IPOPT mex interface for Octave 6.4.0 (64-bit) in Windows
# matRad only includes the IPOPT mex interface compiled for Matlab. It is also possible to compile the interface from the MSYS/MinGW distribution included in Octave for Windows.
# The following has been tested for Octave 5.2.0 in 64 bit version to allow 64-bit algebra. Start this script from a octave mingw shell. You can open such a shell by running "cmdshell.bat" from your Octave install directory
# The following has been tested for Octave 6.4.0 in 64 bit version to allow 64-bit algebra. Start this script from an octave mingw shell. You can open such a shell by running "cmdshell.bat" (potentially as administrator)from your Octave install directory

pacman -Sy
pacman -S --noconfirm --needed wget which git
# pacman -S --noconfirm --needed wget which git
pacman -S --noconfirm --needed which

# Run the following commands to create directories and get the IPOPT source. We dont need lapack and blas, since Octave comes with lapack and openblas

Expand All @@ -25,6 +26,8 @@ cd $IPOPTDIR/ThirdParty/Lapack
cd $IPOPTDIR/ThirdParty/Metis
./get.Metis
cd $IPOPTDIR/ThirdParty/Mumps
# First we need to replace the url as the version can no longer be downloaded
sed -i 's,http://mumps.enseeiht.fr/,http://coin-or-tools.github.io/ThirdParty-Mumps/,g' get.Mumps
./get.Mumps

cd $IPOPTDIR
Expand All @@ -48,7 +51,7 @@ cd ../..
# If everything worked, you should see some (static) libraries when doing ls /usr/local/lib
# we can get the mex interface

git clone https://github.com/ebertolazzi/mexIPOPT
git clone --depth 1 --branch 1.0.0 https://github.com/ebertolazzi/mexIPOPT

# and compile it.
mkoctfile --mex -ImexIPOPT/src -I$IPOPTINSTALLDIR/include/coin mexIPOPT/src/ipopt.cc mexIPOPT/src/IpoptInterfaceCommon.cc -v -DMATLAB_MEXFILE -DHAVE_CSTDDEF -DIPOPT_INTERFACE_MISSING_COPY_N -lipopt -lcoinmumps -lcoinmetis -lcoinlapack -lcoinblas -lgfortran -L$IPOPTINSTALLDIR/lib
Expand Down
46 changes: 46 additions & 0 deletions optimization/optimizer/compile_ipopt_ubuntu22_octave64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
mkdir IpoptMUMPS
export IPOPTDIR=`pwd`

mkdir install
cd install
export IPOPTINSTALLDIR=`pwd`
cd ..

mkdir source
cd source
export IPOPTSRCDIR=`pwd`

wget --no-check-certificate https://www.coin-or.org/download/source/Ipopt/Ipopt-3.12.13.tgz
tar -zxvf Ipopt-3.12.13.tgz
mv Ipopt-3.12.13/* ./

# Here we can also download the new Ipopt and link against lapack / blas?
# git clone https://github.com/coin-or/Ipopt
# git clone https://github.com/coin-or-tools/ThirdParty-Mumps
# For both we do
# configure --enable-static --disable-shared ADD_CXXFLAGS="-fPIC" ADD_CFLAGS="-fPIC" ADD_FFLAGS="-fallow-argument-mismatch -fPIC" ADD_FCFLAGS="-fallow-argument-mismatch -fPIC"

cd $IPOPTSRCDIR/ThirdParty/Blas
./get.Blas
cd $IPOPTSRCDIR/ThirdParty/Lapack
./get.Lapack
cd $IPOPTSRCDIR/ThirdParty/Metis
./get.Metis
cd $IPOPTSRCDIR/ThirdParty/Mumps
# First we need to replace the url as the version can no longer be downloaded
sed -i 's,http://mumps.enseeiht.fr/,http://coin-or-tools.github.io/ThirdParty-Mumps/,g' get.Mumps
./get.Mumps

cd $IPOPTDIR

# Now lets start the build process
mkdir build
cd build
export IPOPTBUILDDIR=`pwd`

$IPOPTSRCDIR/configure --prefix=$IPOPTINSTALLDIR --disable-shared --enable-static

make
make install


Binary file added optimization/optimizer/ipopt.mexoct640a64
Binary file not shown.
Binary file added optimization/optimizer/ipopt.mexoct640w64
Binary file not shown.
Binary file removed optimization/optimizer/ipopt.mexocta64
Binary file not shown.
Binary file removed optimization/optimizer/ipopt.mexoctmac64
Binary file not shown.
Binary file removed optimization/optimizer/ipopt.mexoctw64
Binary file not shown.
Binary file removed optimization/optimizer/ipopt.mexw32
Binary file not shown.
2 changes: 1 addition & 1 deletion submodules/MCsquare
Submodule MCsquare updated 1 files
+0 −0 MCsquare
2 changes: 1 addition & 1 deletion submodules/ompMC
32 changes: 14 additions & 18 deletions tools/matRad_checkMexFileExists.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
% filename: name of the mex file (without extension)
% linkOctave: (optional: default true) If set to true, the function will check
% for a custom build mex file for octave with our custom extension
% mexoct<system>. If such a file exists, it will create a link to
% the file as filename.mex since octave not uses system-specific
% extensions by default. If false, the function will only check
% for an existing .mex file for octave.
% mexoct<version><system>. If such a file exists, it will create
% a link to the file as filename.mex since octave not uses system-
% specific extensions by default. If false, the function will only
% check for an existing .mex file for octave.
% output:
% fileExists: true if the mex file exists (or can be linked), and false
% otherwise
Expand Down Expand Up @@ -46,16 +46,10 @@
%For octave we have experimental precompiled files for Octave 5 64 bit
[env,ver] = matRad_getEnvironment();

if ~fileExists && strcmp(env,'OCTAVE') && linkOctave
if ~fileExists && matRad_cfg.isOctave && linkOctave

%Check Octave 5
versplit = strsplit(ver,'.');
isOctave5 = str2double(versplit{1}) == 5;

if ~isOctave5
fileExists = false;
return;
end
%versionstring
verStripped = erase(ver,'.');

%Check Architecture
[~,maxArraySize] = computer();
Expand All @@ -65,13 +59,15 @@
else
bitExt = '32';
end



systemext = ['mexoct' verStripped];
if ispc
systemext = 'mexoctw';
systemext = [systemext 'w'];
elseif ismac
systemext = 'mexoctmac';
systemext = [systemext 'mac'];
elseif isunix
systemext = 'mexocta';
systemext = [systemext 'a'];
else
%No file for unknown operating system
fileExists = false;
Expand Down Expand Up @@ -100,7 +96,7 @@
[status,msg] = link(oldpath,linkpath);

if status == 0
matRad_cfg.dispWarning('Trying to use a precompiled mex for Octave 5. This is experimental!');
matRad_cfg.dispWarning('Trying to use a precompiled mex for Octave %s. This is experimental!',ver);
fileExists = true;
else
matRad_cfg.dispWarning('Could not link existing precompiled mex file %s to %s\n',octfilename,mexFileName);
Expand Down

0 comments on commit c274d6d

Please sign in to comment.