Calling Clapack functions in Visual Studio 2008 / Windows XP

Post here if you are having problem installing LAPACK on a Windows machine

Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

Postby jocheno » Tue Aug 25, 2009 11:43 am

I made it! I downloaded precompiled binaries (blas_win32.lib and lapack_win32.lib) from this source:
http://www.fi.muni.cz/~xsvobod2/misc/lapack/shared/shared-libs.zip

With those two libs and dlls I compiled and ran the code successfully.

So then I wanted to know if it was the blas or the lapack library that caused the runtime errors before.

Using the blas_win32.lib and the lapack.lib (from the lapack_3.1.1 implementation) libraries, causes a linker error (note that I had to change the DGESV definition to upper case, as lapack.lib only includes upper case definitions!):
1>LINK : fatal error LNK1104: Datei "ifconsol.lib" kann nicht geöffnet werden.

I can't find the file ifconsol.lib on my computer. I googled it and saw that it is part of of the Intel ® Fortran compiler distribution!? Seems like you do have that .lib file as well as these once, that are also required: libifcoremt.lib, libifport.lib, libmmt.lib, libirc.lib, svml_disp.lib.

Using the blas_win32.lib and the lapackD.lib leads to the following:
Code: Select all
1>------ Erstellen gestartet: Projekt: lapack_test_ref_blas, Konfiguration: Debug Win32 ------
1>Verknüpfen...
1>lapackd.lib(xerbla.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_for_write_seq_fmt" in Funktion "_XERBLA".
1>lapackd.lib(dlamch.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_for_write_seq_fmt".
1>lapackd.lib(xerbla.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_for_write_seq_fmt_xmit" in Funktion "_XERBLA".
1>lapackd.lib(xerbla.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_for_stop_core" in Funktion "_XERBLA".
1>lapackd.lib(dgetrf.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_for_emit_diagnostic" in Funktion "_DGETRF".
1>lapackd.lib(ilaenv.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_for_emit_diagnostic".
1>lapackd.lib(dgetf2.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_for_emit_diagnostic".
1>lapackd.lib(dlaswp.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_for_emit_diagnostic".
1>lapackd.lib(dgetrf.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DTRSM" in Funktion "_DGETRF".
1>lapackd.lib(dgetrs.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_DTRSM".
1>lapackd.lib(dgetrf.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DGEMM" in Funktion "_DGETRF".
1>lapackd.lib(ilaenv.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_for_cpystr" in Funktion "_ILAENV".
1>lapackd.lib(dgetf2.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_IDAMAX" in Funktion "_DGETF2".
1>lapackd.lib(dgetf2.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DSWAP" in Funktion "_DGETF2".
1>lapackd.lib(dgetf2.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DSCAL" in Funktion "_DGETF2".
1>lapackd.lib(dgetf2.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DGER" in Funktion "_DGETF2".
1>lapackd.lib(iparmq.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_logf" in Funktion "_IPARMQ".
1>lapackd.lib(iparmq.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_f_lanint_val" in Funktion "_IPARMQ".
1>lapackd.lib(dlamch.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___powr8i4" in Funktion "_DLAMCH".
1>H:\Eigene Dateien\Visual Studio 2008\Projects\lapack_test_ref_blas\Debug\lapack_test_ref_blas.exe : fatal error LNK1120: 14 nicht aufgelöste externe Verweise.
1>Das Buildprotokoll wurde unter "file://h:\Eigene Dateien\Visual Studio 2008\Projects\lapack_test_ref_blas\lapack_test_ref_blas\Debug\BuildLog.htm" gespeichert.
1>lapack_test_ref_blas - 20 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========


Finally, using the libgoto_core2-r1.26.lib and the lapack_win32.lib complies successfully but casuses the same run-time error as before.

To conclude:
To be able to use the lapack_3.1.1 implementation, I am missing the following .lib files: ifconsol.lib,libifcoremt.lib, libifport.lib, libmmt.lib, libirc.lib, svml_disp.lib.
The successfully built optimized gotoBlas library causes a run-time error that I cannot resolve!?


I might gohead using blas_win32.dll and lapack_win32.dll for now. But I would really like to have an optimised blas library, if the performance really depends so much on it.

I might also try Julie's suggestion and use CLAPACK 3.1.2.

For now I will go home as it is 7 p.m. already ;-)

Jochen
Last edited by jocheno on Tue Aug 25, 2009 12:45 pm, edited 2 times in total.
jocheno
 
Posts: 19
Joined: Mon Aug 10, 2009 3:37 am

Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

Postby Julien Langou » Tue Aug 25, 2009 12:08 pm

Jochen,
I just made the CLAPACK 3.2.1 with CMAKE available on netlib.org/clapack
There is no doc yet because it is on-going work.

Just download CMAKE at: http://www.cmake.org.
Install the software on your machine
Download CLAPACK 3.2.1 with CMAKE ( http://netlib.org/clapack/clapack-3.2.1-CMAKE.tgz )
Untar

Open CMAKE:
Point to your folder in the source code folder
Point to a new folder where you want the build to be (not the same is better)
Click configure
Choose Visual Studio Solution or whatever you want.
You may have to click again configure until everything becomes white
Click generate
and you are done.

Look in your "build" folder, you have your CLAPACK VS Projet.
Run all build first then all test.

Feed back welcome.
Julie
Julien Langou
 
Posts: 734
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

Postby jocheno » Wed Aug 26, 2009 2:47 am

I downloaded the "Intel® Visual Fortran Compiler Redistributable Libraries for IA-32" and added the corresponding folder in Visual Studio that includes the missing lib-files (ifconsol.lib,libifcoremt.lib, libifport.lib, libmmt.lib, libirc.lib, svml_disp.lib) and added ifconsol.lib,libifcoremt.lib, libifport.lib, libmmt.lib, libirc.lib & svml_disp.lib under PROJECT/LINKER/INPUT/Additional Dependencies.

Compiling the project using BLAS.lib and LAPACK.lib (Lapack 3.1.1 implementation):
    1.) I have to tell my linker to ignore "libcmt.lib" to get rid of a conflict between MSVCRTD.lib and LIBCMT.lib!
    2.) In the sample code I have to change the DGESV routine definition to upper case!
    3.) The linker produces the following error message:
    1>------ Erstellen gestartet: Projekt: lapack_test_ref_blas, Konfiguration: Debug Win32 ------
    1>Verknüpfen...
    1>libifcoremt.lib(for_diags_intel.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__iob" in Funktion "_for__io_return".
    1>libifcoremt.lib(for_nt_open_proc.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__iob".
    1>libifcoremt.lib(for_init.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___argv" in Funktion "_for_rtl_init_wrap_".
    1>libifcoremt.lib(for_init.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___argc" in Funktion "_for_rtl_init_wrap_".
    1>H:\Eigene Dateien\Visual Studio 2008\Projects\lapack_test_ref_blas\Debug\lapack_test_ref_blas.exe : fatal error LNK1120: 3 nicht aufgelöste externe Verweise.
    1>Das Buildprotokoll wurde unter "file://h:\Eigene Dateien\Visual Studio 2008\Projects\lapack_test_ref_blas\lapack_test_ref_blas\Debug\BuildLog.htm" gespeichert.
    1>lapack_test_ref_blas - 5 Fehler, 0 Warnung(en)
    ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

So there is link to "__iob" in "libifcoremt.lib" that can't be found!? Where can the linker find "__iob"?
jocheno
 
Posts: 19
Joined: Mon Aug 10, 2009 3:37 am

Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

Postby jocheno » Wed Aug 26, 2009 3:15 am

I changed the following setting under
Project options -> Configuration Properties -> C/C++ -> Code generation -> Use run-time library
from "Multithreaded-Debug-DLL (/MDd)" (which seems to be the default setting!?) to "Multithreaded-Debug (/MTd)".

Now the project using BLAS.lib and LAPACK.lib compiles and links successfully and I can properly execute the generated .exe file!!!

I don't know what exactly the run-time library settings "Multithreaded-Debug-DLL" and "Multithreaded-Debug" do, but it works. Strangely the setting "Multithread (/MT)" does not work (the linker then isn't even able to resolve symbols like getchar() or printf()), even though I am using the release versions of BLAS.lib and LAPACK.lib (instead of the debug version BLASd.lib and LAPACKd.lib)!? Does that have anything to do with each other?

Using BLASd.lib and LAPACKd.lib stills leads to an array of errors during the linking process (non resolvable symbols such as "logf" and "powr8i4" in the "lapackd.lib" and symbols such as "qw32used" and "QWINNiceExit" in "libifcoremt.lib")???
jocheno
 
Posts: 19
Joined: Mon Aug 10, 2009 3:37 am

Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

Postby jocheno » Wed Aug 26, 2009 3:28 am

I now also successfully compiled, linked and ran the project using my optimised BLAS library libgoto_core2-r1.26.lib, both with the upper case and the lower case definition of the dgesv routine.

What can I say. I guess that's it for this thread now. Still, I would be happy to learn about that last run-time library setting, what it does and why "Multithreaded-Debug (/MTd)" works and "Multithreaded (/MT)" doesn't...

Anyway. Thank you Olumide for your help and all the time and effort you spent on my problems! I am pretty sure I will speak to you again about more practical problems when I am actually trying to use LAPACK now ;-)

Take care!

Jochen
jocheno
 
Posts: 19
Joined: Mon Aug 10, 2009 3:37 am

Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

Postby graphicsRat » Wed Aug 26, 2009 11:33 am

I'm glad to hear you've solved the problem :-) . It was a due to your project-settings as I suspected! I'll add that bit of information to the HOWTO. There are a few Wikipedia articles on runtime systems and libraries. These should set the stage for the following Visual Studio specific articles:

http://www.davidlenihan.com/2008/01/cho ... untim.html
http://msdn.microsoft.com/en-us/library ... 80%29.aspx

Lastly, can you confirm that Fortran libraries are not required in order to use the LAPACK and BLAS libraries in C/C++ (I don't believe they are).

Here's something I just discovered, which you may find useful: clapack.h (you'll find this file in the include folder of the CLAPACK source) contains the list of all LAPACK C function prototypes, albeit without the extern "C" directives which must be prepended to each declaration if you're programming in C++.
graphicsRat
 
Posts: 84
Joined: Wed Mar 25, 2009 3:08 pm

Previous

Return to Windows

Who is online

Users browsing this forum: No registered users and 1 guest