From: Thomas Corrigan on
I having trouble figuring out how to compile/link/run the fengdemo.f with Intel Visual Fortran 11.1. Either by creating a "project" or from the command line.

It doesn't seem to know what to do with fintrf.h, giving ....
: warning #5117: Bad # preprocessor line

And so subsequently it gives syntax errors for

mwpointer engOpen, engGetVariable, mxCreateDoubleMatrix
mwpointer mxGetPr
mwpointer ep, T, D l

Anyone get this to work?
Thanks
From: James Tursa on
"Thomas Corrigan" <tmcorrigan(a)comcast.net.remove.this> wrote in message <hb4p23$fe6$1(a)fred.mathworks.com>...
> I having trouble figuring out how to compile/link/run the fengdemo.f with Intel Visual Fortran 11.1. Either by creating a "project" or from the command line.
>
> It doesn't seem to know what to do with fintrf.h, giving ....
> : warning #5117: Bad # preprocessor line
>
> And so subsequently it gives syntax errors for
>
> mwpointer engOpen, engGetVariable, mxCreateDoubleMatrix
> mwpointer mxGetPr
> mwpointer ep, T, D l
>
> Anyone get this to work?
> Thanks

1) Run mex -setup to select the Fortran compiler
2) Copy the fengdemo.f file into a working directory
3) Make that working directory the current directory
4) Run the following commands (you may need to modify the options variable to exactly match the filename that is in the mexopts directory):

options = [matlabroot '\bin\win32\mexopts\intelf11msvs2008engmatopts.bat']
mex('-f',options,'fengdemo.f')

Then you can run it with the bang operator:

!fengdemo

James Tursa

P.S. All of the Fortran ___opts.bat files have the /fixed option on the COMPFLAGS line. I would suggest you edit all of these files and get rid of that option. If you don't, you will never be able to use free format .f90 source code. e.g., change this:

set COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fixed /fp:source /MD

to this:

rem COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fixed /fp:source /MD
set COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fp:source /MD
From: Thomas Corrigan on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hb5035$t1o$1(a)fred.mathworks.com>...
> "Thomas Corrigan" <tmcorrigan(a)comcast.net.remove.this> wrote in message <hb4p23$fe6$1(a)fred.mathworks.com>...
> > I having trouble figuring out how to compile/link/run the fengdemo.f with Intel Visual Fortran 11.1. Either by creating a "project" or from the command line.
> >
> > It doesn't seem to know what to do with fintrf.h, giving ....
> > : warning #5117: Bad # preprocessor line
> >
> > And so subsequently it gives syntax errors for
> >
> > mwpointer engOpen, engGetVariable, mxCreateDoubleMatrix
> > mwpointer mxGetPr
> > mwpointer ep, T, D l
> >
> > Anyone get this to work?
> > Thanks
>
> 1) Run mex -setup to select the Fortran compiler
> 2) Copy the fengdemo.f file into a working directory
> 3) Make that working directory the current directory
> 4) Run the following commands (you may need to modify the options variable to exactly match the filename that is in the mexopts directory):
>
> options = [matlabroot '\bin\win32\mexopts\intelf11msvs2008engmatopts.bat']
> mex('-f',options,'fengdemo.f')
>
> Then you can run it with the bang operator:
>
> !fengdemo
>
> James Tursa
>
> P.S. All of the Fortran ___opts.bat files have the /fixed option on the COMPFLAGS line. I would suggest you edit all of these files and get rid of that option. If you don't, you will never be able to use free format .f90 source code. e.g., change this:
>
> set COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fixed /fp:source /MD
>
> to this:
>
> rem COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fixed /fp:source /MD
> set COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fp:source /MD

Thanks. Do you actually have an "intell11" version of the bat file? I'd assumed I didn't because I was running 2008b, but now that I installed 2009a there is still nothing more recent than the "intelf10msvs2005opts.bat" file (??)

And ... even though I'm now running version 11 of Intel Fortran, the "mex -setup" command only finds version 9.1 (??)
From: James Tursa on
"Thomas Corrigan" <tmcorrigan(a)comcast.net.remove.this> wrote in message <hc48nq$5fk$1(a)fred.mathworks.com>...
>
> And ... even though I'm now running version 11 of Intel Fortran, the "mex -setup" command only finds version 9.1 (??)

You can give these ifort 11.0 files from the FEX a try:

http://www.mathworks.com/matlabcentral/fileexchange/22290-windows-mex-setup-with-ifort-11-0

James Tursa
From: Thomas Corrigan on
Success! Though not without some problems along the way.

A few observations which may help anyone else trying this ....

1) Intel seems to have a "random install path" generator and each new version chooses a different tree structure.

C:\Program Files\Intel\Compiler\Fortran\9.1\IA32\Bin
C:\Program Files\Intel\Compiler\11.1\046\bin\ia32
And I guess 11.0 was in yet another permutation ....
c:\program files\intel\compiler\11.0\066\Fortran

I can hardly wait to see where they put 11.2, etc. ......

Since the 11.0 path was in the .zip files that were referenced for the mex setup files. Those had to be modified to work with 11.1's paths

2) When you run mex -setup I'd have expected the right answer to
Would you like mex to locate installed compilers [y]/n?
was "y(es)".
However, even with the 'new & improved' version 11.1 files installed, mex returns (after a loooong search)

Select a compiler:
[1] Intel Visual Fortran 9.1 (with Microsoft Visual C++ 2005 linker) in C:\Program Files\Intel\Compiler\Fortran\9.1
[2] Lcc-win32 C 2.4.1 in C:\MatLAB\R2008b\sys\lcc
[3] Microsoft Visual C++ 2005 in C:\Program Files\Microsoft Visual Studio 8

[0] None

so it DID NOT find the newer (11.1) compiler, which IS installed btw.

finally giving up and saying NO (don't locate installed compilers), and (ta-da!) it "almost" worked right . It gave a more complete list, still missing 11.1. Choosing 11.0 seemed to result in it finding 11.1, but not being sure of itself(!)

Select a compiler:
[1] Intel C++ 9.1 (with Microsoft Visual C++ 2005 SP1 linker)
[2] Intel Visual Fortran 11.0 (with Microsoft Visual C++ 2005 SP1 linker)
[3] Intel Visual Fortran 9.1 (with Microsoft Visual C++ 2005 SP1 linker)
[4] Lcc-win32 C 2.4.1
[5] Microsoft Visual C++ 6.0
[6] Microsoft Visual C++ .NET 2003
[7] Microsoft Visual C++ 2005 SP1
[8] Microsoft Visual C++ 2008 Express
[9] Microsoft Visual C++ 2008 SP1
[10] Open WATCOM C++

[0] None

Compiler: 2

The default location for Intel Visual Fortran compilers is C:\Program Files\Intel\Compiler\11.1\046\,
but that directory does not exist on this machine.

Use C:\Program Files\Intel\Compiler\11.1\046\ anyway [y]/n? y

Please verify your choices:

Compiler: Intel Visual Fortran 11.0
Location: C:\Program Files\Intel\Compiler\11.1\046\

Are these correct [y]/n? y

Trying to update options file: C:\Documents and Settings\corritm1\Application Data\MathWorks\MATLAB\R2009a\mexopts.bat
From template: C:\MatLAB\R2009a\bin\win32\mexopts\intelf11msvs2005opts.bat

Done . . .

--------------
then
>> options = [matlabroot '\bin\win32\mexopts\intelf11msvs2005engmatopts.bat']
and
mex('-f',options,'fengdemo.f')
produced the executable fengdemo.exe

and
>> !fengdemo
ran it. as did going to a command window and executing it there.

After all this "mex" fun, by looking in the .bat files it wasn't too much trouble to modify the MFS project so it could be compiled/linked/ and run from there. And that route is a LOT easier to play with, once you get it right.

Note that the "fortran/preprocessor" build setup option is "off" by default witn INTEL Fortran, so it doesn't know what to do with the include "fintrf.h" statement until you turn it to "Yes(/fpp) and put in the include directory so it can find it.