###########################################
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.
Subject: lapackers
List archive
- 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:
********************************************** 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.