Skip to Content.
Sympa Menu

lapackers - [lapackers] Fwd: [Lapack] Windows HOWTO for LAPACK and CLAPACK

Subject: lapackers

List archive

[lapackers] Fwd: [Lapack] Windows HOWTO for LAPACK and CLAPACK


Chronological Thread 
  • From: julie langou <julie@cs.utk.edu>
  • To: lapackers <lapackers@cs.berkeley.edu>
  • Subject: [lapackers] Fwd: [Lapack] Windows HOWTO for LAPACK and CLAPACK
  • Date: Mon, 10 Aug 2009 21:48:30 -0600

oups I forgot the Berkeley guys...
Sorry
This is just for info. This user did a great job at gather info and his posts are really helpful for the Windows community.
Julie

Begin forwarded message:

From: julie langou <julie@cs.utk.edu>
Date: August 10, 2009 9:46:11 PM MDT
Subject: [Lapack] Windows HOWTO for LAPACK and CLAPACK

Hi,
I wanted to thank you for your fine contribution to the LAPACK community.
I just read the detailed Windows HOWTO that you posted on the LAPACK forum. It is really great! The Intel trick is nice, I heard about it but I did not know if it was really working.
Also,  is it s ok with you if we include your HOWTO in our packages? We may want to wait for some feedbacks from users to see where we need to add more detailed info but I think your steps are pretty clear.
At the moment, I am working on having CLAPACK and LAPACK running CMAKE to create the VS / nmake  package. It would hopefully ease the installation for Windows users. The CLAPACK CMAKE package should be available before the end of August.
Once again, thank you very much for sharing your knowledge.
Sincerely
Julie




Begin forwarded message:

From: "LAPACK/ScaLAPACK Development" <julie@cs.utk.edu>
Date: August 10, 2009 6:34:55 PM MDT
Subject: [LAPACK Forum] Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

User: graphicsRat (videohead@mail.com)
Subject: Re: Calling Clapack functions in Visual Studio 2008 / Windows XP
: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=1593&p=4430#p4430
Thread: Calling Clapack functions in Visual Studio 2008 / Windows XP
: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=1593
Forum: LAPACK/ScaLAPACK Development « User Discussion
: http://icl.cs.utk.edu/lapack-forum/viewforum.php?f=2
Mode: edit

###########################################

Using LAPACK subroutines in a Visual (Studio) C/C++ Project -- Part 1

###########################################

1. Download the LAPACK source or precompiled binaries from http://icl.cs.utk.edu/lapack-for-windows/ . Sources have been and can be can be compiled into debug and release versions. File names of the precomputed debug libraries end with the letter "d" e.g. BLASd.lib and lapackd.lib (in comparison to the release versions BLAS.lib and lapack.lib).

2. If you chose to compile LAPACK, you will require a Fortran compiler and libraries. I recommend the Intel Fortran compiler (distributed with libraries) [http://software.intel.com/en-us/articles/intel-software-evaluation-center/].
Note: although the evaluation version of the Intel Fortran compiler ceases to run after the 30 days, the libraries that come along with it do not expire).

3. Obtain a tuned version of BLAS for your machine (refer to "Compiling GotoBLAS").

4. Create a Visual Studio project with the following sample C program:
http://www.cs.rochester.edu/~bh/cs400/using_lapack.html

5. rename the prototypes in the above program to
void dgesv_( )
void dgels_( )

to
extern "C" void dgesv_( )
extern "C" void dgels_( )

6. Add the following libraries to the Visual Studio project settings, under Linker -> Input -> Additional Dependencies. For example, on my laptop:
libgoto_banias-r1.26.lib
lapack.lib

Note: because BLAS libraries commonly provide faster versions of some LAPACK subroutines, the BLAS library must be listed before before LAPACK library.
Note: the make sure that the gotoBLAS dll is on your system path e.g. in the WINDOWS\system32 folder, else binary won't run.

7. Compile the project and run the resulting executable. You should get the output:
The solution is -0.661082 9.456125 -16.014625


Prologue:
Part 2 of this HOWTO will briefly explain what "dgesv" means and how to call it and other LAPACK subroutines with the appropriate arguments.
Actions
[reply]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=reply&f=2&t=1593
[quote]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=quote&f=2&p=4430
[edit]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=edit&f=2&p=4430
[delete]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=delete&f=2&p=4430
[info]: http://icl.cs.utk.edu/lapack-forum/mcp.php?i=main&mode=post_details&f=2&p=4430
[pm]: http://icl.cs.utk.edu/lapack-forum/ucp.php?i=pm&mode=compose&action="quotepost&p=4430
[email]: http://icl.cs.utk.edu/lapack-forum/memberlist.php?mode=email&u=2989
IP/Host: 79.77.81.144 / 79-77-81-144.dynamic.dsl.as9105.com
Begin forwarded message:

From: "LAPACK/ScaLAPACK Development" <julie@cs.utk.edu>
Date: August 10, 2009 7:00:08 PM MDT
Subject: [LAPACK Forum] Re: Calling Clapack functions in Visual Studio 2008 / Windows XP

User: graphicsRat (videohead@mail.com)
Subject: Re: Calling Clapack functions in Visual Studio 2008 / Windows XP
: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=1593&p=4429#p4429
Thread: Calling Clapack functions in Visual Studio 2008 / Windows XP
: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=1593
Forum: LAPACK/ScaLAPACK Development « User Discussion
: http://icl.cs.utk.edu/lapack-forum/viewforum.php?f=2
Mode: edit

This is the first part of a HOWTO that I'm writing on using LAPACK with Visual Studio. In doing so, I've made the assumption that the reader, although probably an expert in some other discipline that requires a linear equation solver, is a novice when it comes to LAPACK -- just as I was when I started. For this reason, I've tried to explain the whys rather than dispense instructions.

Thanks to Evgenii Rudnyi and Mark Hoemmen at http://groups.google.com/group/matrixprogramming their early suggestions and the reading the draft of this HOWTO. Any inaccuracies in this document are mine. Use with care.

Soon to follow, part 2: Using LAPACK subroutines in a Visual (Studio) C/C++ Project

###########################################

Part 1: Compiling GotoBLAS
(Cygwin required -- http://cygwin.org/ )

###########################################

Preamble
LAPACK [http://www.netlib.org/lapack/] is designed as a two-tiered Fortran library, comprising higher level subroutines and "lower-level Basic Linear Algebra Subprograms (BLAS) in order to effectively exploit the caches on modern cache-based architectures" [http://en.wikipedia.org/wiki/LAPACK]. For reference purposes, the LAPACK installation provides a(n untuned) version of the BLAS which is not optimized for any architecture. This reference BLAS implementation may be orders of magnitude slower than optimized implementations, for matrix factorizations and other computationally intensive matrix operations. Optimized implementations the BLAS are available from a number of vendors and projects such as: Intel (commercial), AMD, and ATLAS, but my favorite is GotoBLAS because it is:

- currently the fastest BLAS implementation
[see research report "Choosing the optimal BLAS and LAPACK library" at http://tinyurl.com/m6lmqs ]
- trivial to compile
- is free (available without cost) for research/academic use.

You can read about sole author of this library Kazushige Goto (pronounced "Goat toe") at http://en.wikipedia.org/wiki/Kazushige_Goto

[Links to other BLAS implementations]
MKL - http://software.intel.com/en-us/intel-mkl/
AMD (AMCL) -- http://developer.amd.com/cpu/Libraries/ ... fault.aspx
ATLAS -- http://math-atlas.sourceforge.net/ (I was unable to build this library. I found the instructions too lengthy, complicated, and often ambiguous. Nevertheless, the goal of the ATLAS project is an admirable one. It aims to, by self-discovery, automatically generate an optimized BLAS library. However, its performance trails that of other libraries http://en.wikipedia.org/wiki/Automatica ... a_Software )

Compiling GotoBLAS
The GotoBLAS source is available from http://www.tacc.utexas.edu/resources/software/#blas (there's short registration
form to fill), and can be compiled for Windows with Cygwin. No changes need to be made to GotoBLAS' config file
Makefile.rule, unless a particular compiler is preferred. Happily, the config file automatically enables multithreading if more than one processor is available.

1. Download and extract the GotoBLAS source to any directory of choice, and make any desired changes to the config file (the default option should also work well).

2. In Cygwin, "cd" to the top-level directory containing the source, and type "make"

3. The result of this process should be a file libgoto_<processor_class>-r<a_number>.a, and a (symbolic) link libgoto.a pointing to this file. (For example, libgoto_banias-r1.26.a)

4. Rename the *.a files to *.lib

5. In preparation for the next step (building a Windows library (*.lib) and dll), run the Visual Studio config batch command vcvars32.bat in Cygwin. vcvars32.bat is in Visual Studio subdirectory: Microsoft_Visual_Studio_Top_Level_Directory\Vc_Number\bin e.g. C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin. This batch file "informs" Cygwin of paths to various binaries that Cygwin will require to make the *.lib and *.dll -- next step).

6. cd to "exports" subdirectory of GotoBLAS and run the command "make dll", result: libgoto_<processor_class>-r<a_number>.lib and libgoto_<processor_class>-r<a_number>.dll . For example: libgoto_banias-r1.26.dll
Actions
[reply]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=reply&f=2&t=1593
[quote]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=quote&f=2&p=4429
[edit]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=edit&f=2&p=4429
[delete]: http://icl.cs.utk.edu/lapack-forum/posting.php?mode=delete&f=2&p=4429
[info]: http://icl.cs.utk.edu/lapack-forum/mcp.php?i=main&mode=post_details&f=2&p=4429
[pm]: http://icl.cs.utk.edu/lapack-forum/ucp.php?i=pm&mode=compose&action="quotepost&p=4429
[email]: http://icl.cs.utk.edu/lapack-forum/memberlist.php?mode=email&u=2989
IP/Host: 79.77.81.144 / 79-77-81-144.dynamic.dsl.as9105.com

**********************************************
Julie Langou; Research Associate in Computer Science
Innovative Computing Laboratory;
University of Tennessee from Denver, Colorado ;-)







_______________________________________________
Lapack mailing list
Lapack@cs.utk.edu
http://lists.eecs.utk.edu/mailman/listinfo/lapack

**********************************************
Julie Langou; Research Associate in Computer Science
Innovative Computing Laboratory;
University of Tennessee from Denver, Colorado ;-)









  • [lapackers] Fwd: [Lapack] Windows HOWTO for LAPACK and CLAPACK, julie langou, 08/10/2009

Archive powered by MHonArc 2.6.16.

Top of Page