HOWTO LAPACK/CLAPACK for Windows

Open discussion regarding features, bugs, issues, vendors, etc.

Did it work?

Yes
37
76%
No
12
24%
 
Total votes : 49

Re: HOWTO LAPACK/CLAPACK for Windows

Postby mesakimya » Thu Jun 21, 2012 6:37 pm

What would solve this problem Thank you.
mesakimya
 
Posts: 1
Joined: Thu Jun 21, 2012 6:30 pm

Re: HOWTO LAPACK/CLAPACK for Windows

Postby admin » Tue Jul 17, 2012 4:59 pm

CLAPACK is no longer maintained.
We released LAPACKE a Standard C Interface to LAPACK, a year ago.
You do not need a Fortran Compiler under Windows to use it and it is easily integrated into VS.
We are providing all and associated lib files.
See http://icl.cs.utk.edu/lapack-for-window ... index.html for more info
admin
Site Admin
 
Posts: 436
Joined: Wed Dec 08, 2004 7:07 pm

Re: HOWTO LAPACK/CLAPACK for Windows

Postby TomCZek » Fri Nov 09, 2012 7:52 pm

Hello,
I'm using your prebuilt libraries blas.lib, libf2c.lib, lapack.lib and the haeders clapack.h, f2c.h. I'm using Eclipse in Win7 64bit and I'm building code of my pregram like this:
gcc "-LD:\\Programovani\\Eclipse\\Workspace\\letiste\\src" -o letiste.exe "src\\letiste_rqfnb.o" -lblas -llapack -llibf2c -lblas -llapack -llibf2c
First few functions are ok, but later it's going like this:
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x4): undefined reference to `__security_cookie'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x11a): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x2cd): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x4ce): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x5cf): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x61d): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x650): more undefined references to `@__security_check_cookie@4' follow
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x10b1): undefined reference to `_ftol2_sse'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x10c0): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x10d8): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x10f0): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x111a): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x1144): undefined reference to `@__security_check_cookie@4'
D:\Programovani\Eclipse\Workspace\letiste\src/lapack.lib(./lapack.dir/Release/ilaenv.obj):(.text[_ilaenv_]+0x1172): more undefined references to `@__security_check_cookie@4' follow
D:\Programovani\Eclipse\Workspace\letiste\src/libf2c.lib(./f2c.dir/Release/i_nint.obj):(.text[_i_nint]+0x26): undefined reference to `_ftol2_sse'
D:\Programovani\Eclipse\Workspace\letiste\src/libf2c.lib(./f2c.dir/Release/i_nint.obj):(.text[_i_nint]+0x3e): undefined reference to `_ftol2_sse'
collect2.exe: error: ld returned 1 exit status

Do you think it's because your prebuilt libraries were build unter Visual Studio 2008 and I'm using Eclipse? But I really want to stick with it..


I tried to build my own libraries, but there are only instructions for Visual Basic, again.. :( I used Cmake with MinGW settings (I hope) but I dont know, how to use MinGW32-make to make libraries. (*.lib)
Can you help me, please?
Thank you a lot.
TomCZek
 
Posts: 1
Joined: Fri Nov 09, 2012 6:49 pm

Re: HOWTO LAPACK/CLAPACK for Windows

Postby sanbowo » Sun Dec 02, 2012 10:00 pm

Ok I needed to put project properties->linker->optimization->references to default to let it work in release mode.

But now if I compare the time it takes to do a matrix-vector multiplication with this optimized BLAS library and with Matlab, Matlab is still a bit faster. Is this normal? Did anyone else compare the speed between these?
sanbowo
 
Posts: 1
Joined: Sun Dec 02, 2012 9:53 pm

Re: HOWTO LAPACK/CLAPACK for Windows

Postby graphicsRat » Wed Jan 23, 2013 2:03 pm

It is no longer news that GotoBLAS is no longer maintained and as such is gradually becoming obsolete. Fortunately GotoBLAS2 has been forked as OpenBLAS, under commercially-friendly BSD license. OpenBLAS is very install, but takes ages to complete. Here's how in Cygwin, mingw or the Linux bash shell :
(Note: compiling in the mingw environment produces a *.lib and *.dll file that I guess can be used Visual Studio)

1. clone the project
git clone git://github.com/xianyi/OpenBLAS

2. build
make FC=gfortran (for a 32 bit OS) or
make FC=gfortran BINARY=64 (for a 64 bit OS)

3. install (optional)
make install *or* make install PREFIX=your_installation_directory

OpenBLAS detects the number of cores and your processor architecture.

I'll update with info on how to build a Windows lib file and dll from the Cygwin build.

Another massive improvement to the HOWTO is that it is no longer necessary to manually write function prototypes for LAPACK subroutines. This has already been done in clapack.h, even the extern "C" directive that C++ requires. The only caveat is that C/C++ typedefs for LAPACK types must now be used e.g. "integer, "doublereal", "logical" etc. Fortunately these typedefs for these are available in f2c.h

Code: Select all
// from f2c.h
typedef long int integer;
typedef unsigned long int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
typedef long int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
...


Finally, f2c.h must appear before clapack.h as shown below

Code: Select all
// TestOpenBLAS.cpp
#include <stdio.h>
#include "f2c.h"
#include "clapack.h"

int main(void)
{
    /* 3x3 matrix A
     * 76 25 11
     * 27 89 51
     * 18 60 32
     */
    double A[9] = {76, 27, 18, 25, 89, 60, 11, 51, 32};
    double b[3] = {10, 7, 43};

    integer N = 3;
    integer nrhs = 1;
    integer lda = 3;
    integer ipiv[3];
    integer ldb = 3;
    integer info;
   
    dgesv_(&N, &nrhs, A, &lda, ipiv, b, &ldb, &info);

    if(info == 0) /* succeed */
   printf("The solution is %lf %lf %lf\n", b[0], b[1], b[2]);
    else
   fprintf(stderr, "dgesv_ fails %d\n", info);


    return info;
}


g++ TestOpenBLAS.cpp -lopenblas

Expected program output:
The solution is -0.661082 9.456125 -16.014625

I'd appreciate feedback on how OpenBLAS performs copes with very large (dense) linear systems to confirm that it performs as well as GotoBLAS2. I haven't solved any large liner systems in a while (working on other stuff ATM).

I'll update the HOWTO before too long.
graphicsRat
 
Posts: 84
Joined: Wed Mar 25, 2009 3:08 pm

Previous

Return to User Discussion

Who is online

Users browsing this forum: No registered users and 0 guests