Filter löschen
Filter löschen

I have a mex -setup file for Intel oneAPI 24 FORTRAN ifort which reports success but mex still insists on running gfortran to compile

18 Ansichten (letzte 30 Tage)
The attached file runs sucessfully in mex setup and reports
MEX configured to use 'Intel oneAPI 2024 for Fortran with Microsoft Visual Studio 2022' for FORTRAN language compilation.
It then sets my roaming profile AppData\Roaming\MathWorks\MATLAB\R2023b\mex_FORTRAN_win64.xml with the following information
COMPILER="ifort"
CMDLINE100="$COMPILER
FORTRANROOT="C:\Program Files (x86)\Intel\oneAPI\2024.0"
Yet when I run mex it insists on looking for gfortran!
>> mex -v -R2018a timestwo.F
Verbose mode is on.
... Looking for compiler 'gfortran' ...
... Looking for environment variable 'MINGWROOT' ...No.
... Looking for file '$$\bin\gfortran.exe' ...No.
Did not find installed compiler 'gfortran'.
Any pointers for getting it to run the ifort compiler would be appreciated.

Antworten (1)

Maneet Kaur Bagga
Maneet Kaur Bagga am 29 Mär. 2024
Hi,
As per my understanding you want to compile a Fortran File using the mex command with the verbose mode enabled (mex -v -R2018a twotimes.F), and MATLAB does not attempt to use the configures "ifort" compiler and it looks for the "gfort" compiler which is not found.
One of the possible workarounds for this is as follows:
Firstly Please refer to the following documentation to refer to the Supported and Compatible Compilers and check if you have all the requirements already setup:
  • Edit "/usr/local/MATLAB/R2016b/bin/glnxa64/mexopts/gfortran.xml"
  • In the line beginning with "LINKLIBS=..." remove both references to gfortranbegin
  • Add "-lgcc_s.1" to the end of that line inside the quotes
  • At the bottom of the file, within the "GFORTRANBEGIN_LIBDIR" block, replace 'dirExists name="$$"' with 'dirExists name="/"'.
  • Save the file and set up the Fortran compiler as normal. This worked for me on Gentoo using gfortran 8.2.0-r6.
The following MATLAB Asnwer has a similar workaround. Please refer to the link below for further understanding:
Hope this helps!
  1 Kommentar
Adrian Cherry
Adrian Cherry am 4 Apr. 2024
Thanks for the reply, I have ifort working perfectly well on Linux, I should have specified this is for Windows platform and for various reasons I want to use the Intel ifort (or ifx) compiler not gfortran.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by