Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Older versions of Intel compiler

arwelHughes
Beginner
505 Views

Hi ,

Is there a way to download older versions of the Intel compilers>? The reason is that I need to use the Fortran compilers to generate mex files on a Mac from Matlab.  I you look at the 'supported compilers' page for Mac here (https://uk.mathworks.com/support/requirements/supported-compilers.html), it lists 'Intel Parallel Studio XE 20XX for Fortran'. However all I can download at the moment is Intel oneAPI. Matlab simply won't recognise this.

Mathworks were no help (they simply told me oneAPI is not currently supported but will be in a future release - thank Mathworks!).  You can see a question detailing the problem here - https://uk.mathworks.com/matlabcentral/answers/864430-compiler-support-for-intel-oneapi-toolkits-for...

 

In the answer on that last link, there is another link detailing an extensive mod of an xml config file to get the C++ compiler to work, but that is a bit beyond me tbh. Being able to download a version of XE would solve my problem. Is it available anywhere?

Cheers,

Arwel

 

0 Kudos
3 Replies
Steve_Lionel
Black Belt Retired Employee
488 Views

If you have paid support, some older versions are available. If you have no paid license, then no. Besides, you don’t need an old version - just because Mathworks hasn’t bothered testing with newer versions that doesn’t mean it won’t work. At most you may have to modify a Matlab script to tell it where to find the oneAPI compiler and libraries. This question comes up a lot, and I do not recall a single case where the user was unable to use the current compiler.

arwelHughes
Beginner
446 Views

Hi Steve,

Yes, it is indeed a matter of modifying a config file, but I really don't know what modifications to make. The xml is attached - maybe this community might be able to suggest what mods I would need to make to get this to work with oneAPI?

 

 

<?xml version="1.0" encoding="UTF-8" ?>

<config

    Name="Intel Fortran Composer XE"

    ShortName="ifort"

    Manufacturer="Intel"

    Version="$IFORT_VERSION"

    Language="FORTRAN"

    Priority="A"

    Location="$IFORT_INSTALLDIR" >

    <Details

        CompilerExecutable="$FC"

        CompilerDefines="$FDEFINES"

        CompilerFlags="$FFLAGS"

        OptimizationFlags="$FOPTIMFLAGS"

        DebugFlags="$FDEBUGFLAGS"

        IncludeFlags="$INCLUDE"

        LinkerLibraries="$LINKLIBS"

        LinkerOptimizationFlags="$LDOPTIMFLAGS"

        LinkerDebugFlags="$LDDEBUGFLAGS"

 

        CompilerDefineFormatter="-D%s"

        LinkerLibrarySwitchFormatter="-l%s"

        LinkerPathFormatter="-L%s"

        />

    <vars

        CMDLINE1="$FC -c $FDEFINES $INCLUDE $FFLAGS $OPTIM $SRC -o $OBJ"

        CMDLINE2="$LDF $LDFLAGSVER $LINKOPTIM $OBJS $FLIBS $LINKLIBS -o $EXE"

        CMDLINE4="xcrun install_name_tool -change libifcore.dylib @rpath/libifcore.dylib $EXE"

        CMDLINE5="xcrun install_name_tool -change libimf.dylib @rpath/libimf.dylib $EXE"

        CMDLINE6="xcrun install_name_tool -change libintlc.dylib @rpath/libintlc.dylib $EXE"

        CMDLINE7="xcrun install_name_tool -change libirc.dylib @rpath/libirc.dylib $EXE"

        CMDLINE8="xcrun install_name_tool -change libsvml.dylib @rpath/libsvml.dylib $EXE"

 

        FC="$IFORT_INSTALLDIR/ifort"

        FDEFINES=""

        FFLAGS="-fexceptions -fpp -mp1 -fp-model source -assume bscc -D__LP64__ "

        INCLUDE="-I&quot;$MATLABROOT/extern/include&quot; -I&quot;$MATLABROOT/simulink/include&quot;"

        FOPTIMFLAGS="-O2"

        FDEBUGFLAGS="-g"

        MACOSX_DEPLOYMENT_TARGET="10.14"

 

 

        LDF="$XCRUN_DIR/xcrun -sdk macosx$SDKVER clang"

        BUNDLEFLAG="-bundle"

        LDFLAGS="-Wl,-twolevel_namespace -undefined error -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -Wl,-syslibroot,$ISYSROOT $LINKEXPORT $BUNDLEFLAG"

        LINKEXPORT="-Wl,-exported_symbols_list,&quot;$MATLABROOT/extern/lib/maci64/fexport.map&quot;"

        LDFLAGSVER="-Wl,-twolevel_namespace -undefined error -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -Wl,-syslibroot,$ISYSROOT $LINKEXPORTVER $BUNDLEFLAG"

        LINKEXPORTVER="-Wl,-exported_symbols_list,&quot;$MATLABROOT/extern/lib/maci64/fortran_exportsmexfileversion.map&quot;"

        LINKLIBS="-L&quot;$MATLABROOT/bin/maci64&quot; -lmx -lmex -lmat -L&quot;$IFORT_LIBDIR&quot; -lifcore -limf -lintlc -lirc -lsvml"

        LDOPTIMFLAGS="-O"

        LDDEBUGFLAGS="-g"

 

        OBJEXT=".o"

        LDEXT=".mexmaci64"

        SETENV="FC=&quot;$FC&quot;

                FFLAGS=&quot;$FFLAGS $FDEFINES&quot;

                FOPTIMFLAGS=&quot;$FOPTIMFLAGS&quot;

                FDEBUGFLAGS=&quot;$FDEBUGFLAGS&quot;

                LDF=&quot;$LDF&quot;

                LDFLAGS=&quot;$LDFLAGS $LINKLIBS $LINKEXPORT&quot;

                LDDEBUGFLAGS=&quot;$LDDEBUGFLAGS&quot;"

 

    />

    <client>

        <engine

            LINKLIBS="-L&quot;$MATLABROOT/bin/maci64&quot; -lmx -lmat -leng -lSystem -L&quot;$IFORT_LIBDIR&quot; &quot;$IFORT_LIBDIR/libifport.a&quot; &quot;$IFORT_LIBDIR/libifcore.a&quot; &quot;$IFORT_LIBDIR/libimf.a&quot;  &quot;$IFORT_LIBDIR/libipgo.a&quot; &quot;$IFORT_LIBDIR/libirc.a&quot; &quot;$IFORT_LIBDIR/libsvml.a&quot; -lcrt1.10.6.o &quot;$IFORT_LIBDIR/for_main.o&quot; &quot;$CLANGRT_DIR/libclang_rt.osx.a&quot;"

            LINKEXPORT=""

            LINKEXPORTVER=""

            LDEXT=""

            BUNDLEFLAG=""

        />

    </client>

    <locationFinder>

        <IFORT_INSTALLDIR>

            <or>

                <and>

                    <or>

                        <envVarExists name="IFORT_COMPILER20" />

                        <envVarExists name="IFORT_COMPILER19" />

                        <envVarExists name="IFORT_COMPILER18" />

                    </or>

                    <dirExists name="$$/bin/intel64" />

                </and>

                <and>

                    <cmdReturns name="which ifort" />

                    <dirExists name="$$" />

                </and>

            </or>

        </IFORT_INSTALLDIR>

        <IFORT_LIBDIR>

            <or>

                <and>

                    <or>

                        <envVarExists name="IFORT_COMPILER20" />

                        <envVarExists name="IFORT_COMPILER19" />

                        <envVarExists name="IFORT_COMPILER18" />

                    </or>

                    <dirExists name="$$/compiler/lib" />

                </and>

                <and>

                    <cmdReturns name="which ifort" />

                    <dirExists name="$$/../../compiler/lib" />

                </and>

            </or>

        </IFORT_LIBDIR>

    <IFORT_VERSION>

        <cmdReturns name="ifort --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | head -1" />

    </IFORT_VERSION>

        <ISYSROOT>

            <cmdReturns name="xcrun -sdk macosx --show-sdk-path"/>

        </ISYSROOT>

        <XCODE_AGREED_VERSION>

            <and diagnostic="Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement." >

                <or>

                    <cmdReturns name="defaults read com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense"/>

                    <cmdReturns name="defaults read /Library/Preferences/com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense"/>

                </or>

                <cmdReturns name="&#10;agreed=$$ &#10; if echo $agreed | grep -E '[\.\&quot;]' >/dev/null; then &#10; lhs=`expr &quot;$agreed&quot; : '\([0-9]*\)[\.].*'` &#10;  rhs=`expr &quot;$agreed&quot; : '[0-9]*[\.]\(.*\)$'` &#10; if echo $rhs | grep -E '[\.&quot;]' >/dev/null; then &#10; rhs=`expr &quot;$rhs&quot; : '\([0-9]*\)[\.].*'` &#10; fi &#10; if [ $lhs -gt 4 ] || ( [ $lhs -eq 4 ] &amp;&amp; [ $rhs -ge 3 ] ); then &#10; echo $agreed &#10; else &#10; exit 1&#10; fi &#10; fi" />

            </and>

        </XCODE_AGREED_VERSION>

        <CLANGRT_DIR>

            <and>

                <cmdReturns name="xcode-select -print-path"/>

                <cmdReturns name="find $$ -name libclang_rt.osx.a" />

                <dirExists name="$$" />

            </and>

        </CLANGRT_DIR>

        <XCRUN_DIR>

            <and>

                <cmdReturns name="which xcrun" />

                <dirExists name="$$" />

            </and>

        </XCRUN_DIR>

        <SDKVER>

            <cmdReturns name="xcrun -sdk macosx --show-sdk-version | awk 'BEGIN {FS=&quot;.&quot;} ; {print $1&quot;.&quot;$2}'"/>

        </SDKVER>

    </locationFinder>

</config>

mecej4
Black Belt
430 Views

Here is my approach to such problems (in essence, building a DLL from Fortran or C source code to work with a third party package such as Matlab). Rather than using Rube Goldbergesque approaches such as XML or Python scripts or complex build tools such as Cmake, or trying to urge one vendor to compensate for another vendor's shortcomings, perceived or real, I build at the command line, relying upon the backward compatibility that Intel compilers generally sport.

The newest version of Matlab that I have is R2013a (64-bit). That is almost a decade old, and inside that Matlab the ver command displays "Windows 8 Version 6.2", although the real OS version is 10.0.19042.1288.

Here is how I build the Mex file from the sources yprimef.F and yprimefg.F that are provided in the Matlab extern\examples\mex directory, using Intel OneAPI 2021.4.0 on Windows 10 64 bit.

  1. Open a 64-bit OneAPI command window from the Start menu of Windows.
  2. Add the respective Matlab directories to the INCLUDE, LIB and PATH variables.
  3. Build the Mex file.

Here are the commands for doing steps 2 and 3.

 

set MDIR=c:\math\ml2013a\extern
set include=%include%;%MDIR%\include
set lib=%lib%;%mdir%\lib\win64\microsoft
path %path%;c:\math\ML2013a\bin\win64
ifort /LD /Od /fpp yprimef.f yprimefg.f libmx.lib libmex.lib /Feyprimef.mexw64 /link /export:MEXFUNCTION

 

If you are able to do something similar, with suitable adaptations for your OS, Xcode and Matlab versions, you can help future users by reporting the results here.

Reply