From: A B on
Hi,

I want to build the Pardiso matlab interface on a Win 64 computer, with Intel Fortran and Visual Studio.

Building the interface is rather complicated and the instruction only are for Linux.
Unfortunately I'm don't know a lot about creating mex files except very simple ones, where you only have to supply the source file.

Maybe someone can help me translating the Linux mex command to the appropriate ones for Windows.

I would be really greatful if anyone could help me with it!

Here's an example they provide:

mex -cxx CXX=g++ CC=g++ LD=g++ -L\home\lib\pardiso - lpardiso
-lmwlapack -lmwblas -lgfortran -lpthread -lm -output pardisoinit
common.cpp matlabmatrix.cpp sparsematrix.cpp pardisoinfo.cpp
pardisoinit.cpp

My Matlab doesn't recognise -lgfortran, -lpthread. What kind of information do I have to provide instead (e.g. for Intel Fortran). Do I also have to use the -cxx command in Windows, because Matlab help says it's only for linux.

Anyway, I tried it removing the -cxx switch, replacing the \home\.. with the directory for the .lib file and then I got the following Linker error:

pardisoinfo.obj : error LNK2019: unresolved external symbol pardisoinit_ referenced in function "public: __cdecl PardisoInfo::PardisoInfo(int,int)" (??0PardisoInfo@@QEAA(a)HH@Z)
pardisoinfo.obj : error LNK2019: unresolved external symbol pardiso_ referenced in function "protected: void __cdecl PardisoInfo::callpardiso(int,int)" (?callpardiso(a)PardisoInfo@@IEAAXHH@Z)
pardisoinit.mexw64 : fatal error LNK1120: 2 unresolved externals


Thanks a lot!!
From: James Tursa on
"A B" <gitsnedbutzi(a)hotmail.com> wrote in message <ht489o$f6h$1(a)fred.mathworks.com>...
> Hi,
>
> I want to build the Pardiso matlab interface on a Win 64 computer, with Intel Fortran and Visual Studio.
>
> Building the interface is rather complicated and the instruction only are for Linux.
> Unfortunately I'm don't know a lot about creating mex files except very simple ones, where you only have to supply the source file.
>
> Maybe someone can help me translating the Linux mex command to the appropriate ones for Windows.
>
> I would be really greatful if anyone could help me with it!
>
> Here's an example they provide:
>
> mex -cxx CXX=g++ CC=g++ LD=g++ -L\home\lib\pardiso - lpardiso
> -lmwlapack -lmwblas -lgfortran -lpthread -lm -output pardisoinit
> common.cpp matlabmatrix.cpp sparsematrix.cpp pardisoinfo.cpp
> pardisoinit.cpp
>
> My Matlab doesn't recognise -lgfortran, -lpthread. What kind of information do I have to provide instead (e.g. for Intel Fortran). Do I also have to use the -cxx command in Windows, because Matlab help says it's only for linux.
>
> Anyway, I tried it removing the -cxx switch, replacing the \home\.. with the directory for the .lib file and then I got the following Linker error:
>
> pardisoinfo.obj : error LNK2019: unresolved external symbol pardisoinit_ referenced in function "public: __cdecl PardisoInfo::PardisoInfo(int,int)" (??0PardisoInfo@@QEAA(a)HH@Z)
> pardisoinfo.obj : error LNK2019: unresolved external symbol pardiso_ referenced in function "protected: void __cdecl PardisoInfo::callpardiso(int,int)" (?callpardiso(a)PardisoInfo@@IEAAXHH@Z)
> pardisoinit.mexw64 : fatal error LNK1120: 2 unresolved externals

I am not that familiar with linux, but it looks like you have some C++ source code and some object libraries in the build command. e.g., the -lpardiso, -lmwlapack, -lmwblas, and -lgfortran mex options are all object libraries. You can find versions of the equivalent BLAS and LAPACK object libraries that are shipped with MATLAB on Windows, but what about the others? You will apparently need them to do the compile. Do you have source code for them? I don't see any Fortran source code in your mex build command, so I don't know why you would need a Fortran compiler.

James Tursa
From: A B on
>
> I am not that familiar with linux, but it looks like you have some C++ source code and some object libraries in the build command. e.g., the -lpardiso, -lmwlapack, -lmwblas, and -lgfortran mex options are all object libraries. You can find versions of the equivalent BLAS and LAPACK object libraries that are shipped with MATLAB on Windows, but what about the others? You will apparently need them to do the compile. Do you have source code for them? I don't see any Fortran source code in your mex build command, so I don't know why you would need a Fortran compiler.
>
> James Tursa

I can link to BLAS and LAPACK, as well as the library Pardiso. This library seems to include Fortran code, which I guess is the reason why -lgfortran (gnu fortran) is also in the command line. As for the others I found out that -lpthread is POSIX, so I would think that all the other things are Linux stuff.

However I still don't know which probably could be omitted, which is necessary and also if I have to use Intel Fortran. Because the linker seems to can't find the external functions, which are Fortran functions.
From: Walter Roberson on
"A B" <gitsnedbutzi(a)hotmail.com> wrote in message <ht489o$f6h$1(a)fred.mathworks.com>...

> I want to build the Pardiso matlab interface on a Win 64 computer, with Intel Fortran and Visual Studio.

> Here's an example they provide:
>
> mex -cxx CXX=g++ CC=g++ LD=g++ -L\home\lib\pardiso - lpardiso
> -lmwlapack -lmwblas -lgfortran -lpthread -lm -output pardisoinit
> common.cpp matlabmatrix.cpp sparsematrix.cpp pardisoinfo.cpp
> pardisoinit.cpp
>
> My Matlab doesn't recognise -lgfortran, -lpthread. What kind of information do I have to provide instead (e.g. for Intel Fortran).

-lpthread means to link in the Posix Threads library.

I have looked around, and I have found POSIX threads implementations for Win32, and I have found implications that the Unix Services For Windows 3.5 _might_ implement pthreads for 2000 and XP, and I have found statements that the Unix Services is now part of Vista and Windows 7. I have also found statements that hint that the Win32 API is usable in Windows 64 bit. None-the-less, I have not found any clear statement that Posix Threads are available for Windows 64 bit in Vista or Windows 7.

I would think that probably -lgfortran would mean to link in the Free Software Foundation GNU fortran library . As someone else pointed out, you do not appear to be compiling any Fortran source so it is not immediately clear as to why that would be desirable.