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

Access to Visual FORTRAN 9.1 in 2019 and Beyond

Brown__Ainsmar
Beginner
419 Views

Hello,

 

I have been asked to resurrect a legacy program that was created in MATLAB 2007a and Simulink. I need to compile the old code into mex files in that environment and it only recognizes Visual FORTRAN 9.1 natively. We no longer have the original software so in looking for alternatives I ask the following. Can I purchase a new license for the FORTRAN compiler under Parallel Studio XE and then search software archives for Visual FORTRAN 9.1 install files? This is the whole purpose of me purchasing any software to begin with and after getting an initial quote of $599 USD, I want to make sure the purchase will payoff in the way I actually need it to.

 

Thanks for the information in advance,

 

AB

0 Kudos
1 Solution
mecej4
Honored Contributor III
419 Views

Here are the instructions that I used on a Windows 10 X64 PC with Matlab R2007b-64 bit and Ifort19 Update 4. Modify the paths to suit, and choose the 32-bit or 64-bit branches as appropriate.

1. Create a batch file to set the paths to Matlab:

@echo off
set MLDIR=d:\MATH\ml07
set include=%include%;%mldir%\extern\include
set lib=%lib%;%mldir%\extern\lib\win64\microsoft

2. From the Start Menu, launch the command window for Intel Fortran.

3. Change to a working directory. Copy the files yprimef.F and yprimefg.F from the Matlab extern\examples\mex directory to the working directory. Run the batch file created in Step 1.

4. Build the MEX file using the command

ifort /fpp /dll yprimef.F yprimefg.F libmex.lib libmx.lib /link /export:MEXFUNCTION /out:yprimef.MEXW64

5. Start Matlab. In the Matlab command window, change to the directory containing the MEX file created in Step 4, or add the path of that directory to the Matlab path. In the Matlab command window, test the MEX file by entering

y=[1 2 3 4]; yp=yprimef(0,y)

If there were no errors, you should see the following output from Matlab

yp =
  2.0000e+000  8.9685e+000  4.0000e+000 -1.0947e+000
>> 

 

View solution in original post

0 Kudos
4 Replies
mecej4
Honored Contributor III
419 Views

I have built Mex files for older versions of Matlab using recent versions of Intel Fortran and C on numerous occasions, and have never had any trouble, because I build the Mex files from the command line. If you use the Mex script from inside Matlab, you are restricted to using a version of Ifort of roughly the same vintage as the version of Matlab. 

I suggest that you try building a couple of Mex files using the current version of Ifort, which you can obtain for a short duration trial at no cost. If that works, you do not need to think any more about making special arrangements to obtain a very old version of Ifort.

0 Kudos
Brown__Ainsmar
Beginner
419 Views

mecej4 wrote:

I have built Mex files for older versions of Matlab using recent versions of Intel Fortran and C on numerous occasions, and have never had any trouble, because I build the Mex files from the command line. If you use the Mex script from inside Matlab, you are restricted to using a version of Ifort of roughly the same vintage as the version of Matlab. 

I suggest that you try building a couple of Mex files using the current version of Ifort, which you can obtain for a short duration trial at no cost. If that works, you do not need to think any more about making special arrangements to obtain a very old version of Ifort.

 

Thank you very much for the reply. I am not a frequent user of FORTRAN or the mex compiler outside of the built-in support of MATLAB, which is part of my desire to run the setup mentioned. The project does have a compiler config file for that version of MATLAB and Visual FORTRAN which right not is the only resource I have to generate updated mex files successfully.

I am looking around on Google for templates a bit unsure of what I am seeing. Most are setup files to use Parallel Studio inside MATLAB. Any suggestions on how to get started creating a customized setup to compile FORTRAN for R2007a mex files outside of MATLAB?

0 Kudos
mecej4
Honored Contributor III
420 Views

Here are the instructions that I used on a Windows 10 X64 PC with Matlab R2007b-64 bit and Ifort19 Update 4. Modify the paths to suit, and choose the 32-bit or 64-bit branches as appropriate.

1. Create a batch file to set the paths to Matlab:

@echo off
set MLDIR=d:\MATH\ml07
set include=%include%;%mldir%\extern\include
set lib=%lib%;%mldir%\extern\lib\win64\microsoft

2. From the Start Menu, launch the command window for Intel Fortran.

3. Change to a working directory. Copy the files yprimef.F and yprimefg.F from the Matlab extern\examples\mex directory to the working directory. Run the batch file created in Step 1.

4. Build the MEX file using the command

ifort /fpp /dll yprimef.F yprimefg.F libmex.lib libmx.lib /link /export:MEXFUNCTION /out:yprimef.MEXW64

5. Start Matlab. In the Matlab command window, change to the directory containing the MEX file created in Step 4, or add the path of that directory to the Matlab path. In the Matlab command window, test the MEX file by entering

y=[1 2 3 4]; yp=yprimef(0,y)

If there were no errors, you should see the following output from Matlab

yp =
  2.0000e+000  8.9685e+000  4.0000e+000 -1.0947e+000
>> 

 

0 Kudos
Brown__Ainsmar
Beginner
419 Views

mecej4 wrote:

Here are the instructions that I used on a Windows 10 X64 PC with Matlab R2007b-64 bit and Ifort19 Update 4. Modify the paths to suit, and choose the 32-bit or 64-bit branches as appropriate.

1. Create a batch file to set the paths to Matlab:

@echo off
set MLDIR=d:\MATH\ml07
set include=%include%;%mldir%\extern\include
set lib=%lib%;%mldir%\extern\lib\win64\microsoft

2. From the Start Menu, launch the command window for Intel Fortran.

3. Change to a working directory. Copy the files yprimef.F and yprimefg.F from the Matlab extern\examples\mex directory to the working directory. Run the batch file created in Step 1.

4. Build the MEX file using the command

ifort /fpp /dll yprimef.F yprimefg.F libmex.lib libmx.lib /link /export:MEXFUNCTION /out:yprimef.MEXW64

5. Start Matlab. In the Matlab command window, change to the directory containing the MEX file created in Step 4, or add the path of that directory to the Matlab path. In the Matlab command window, test the MEX file by entering

y=[1 2 3 4]; yp=yprimef(0,y)

If there were no errors, you should see the following output from Matlab

yp =
  2.0000e+000  8.9685e+000  4.0000e+000 -1.0947e+000
>> 

 

 

Thank you very much!

0 Kudos
Reply