UP

Note describing an update to the Ada LAPACK and BLAS binding

Nasser M. Abbasi

June 7, 2013

Contents

1 Important note
2 Introduction
3 Review of the LAPACK and BLAS Ada binding
4 Installation instruction
5 source code

1 Important note

This page is obsolete now, left here for archive and information only.

The Ada Lapack code is now housed at http://sourceforge.net/projects/ada-lapack/

2 Introduction

I downloaded the original BLAS Ada binding written by Duncan Sands from http://topo.math.u-psud.fr/~sands/Programs/BLAS/index.html and the LAPACK Ada binding written by Wasu Chaopanon from ftp://ftp.cs.kuleuven.be/pub/Ada-Belgium/mirrors/gnu-ada/OLD/contrib/lapack-ada/

and made some minor improvments to the bindings.

This page describes the minor changes made and instructions how to use these bindings from Ada in order call LAPACK and BLAS Fortran functions.

A new tar file for LAPACK and for BLAS with all the changes can be downloaded from the link below.

The changes made to LAPACK binding involve streamlining the source tree structure, writing new Makefiles, simplify the binding to use one package called lapack and also adding the documentation shown below.

Changes for the BLAS binding were minimal. It involved changes to the source tree structure and writing Makefiles and adding the documentation shown below.

3 Review of the LAPACK and BLAS Ada binding

The Ada binding to LAPACK and BLAS is an Ada package which allows one to interface to the native lapack and blas libraries.

The native lapack and blas libraries need to be first installed on the system (on Linux, these libraries will normally be found in /usr/lib/liblapack.so and /usr/lib/libblas.so )

To use LAPACK from Ada, one needs to install both the native LAPACK and BLAS libraries since LAPACK depends on BLAS.

The Ada binding is a thin binding, meaning there is 1-1 mapping between the call to the Ada routine and the corresponding Fortran routine using the same function name in the Fortran libraries.

The following diagram illustrates the use of the LAPACK binding with the needed gnatmake command to compile and link the client Ada program.

PIC

And a similar diagram for the BLAS binding interface

PIC

The source tree structure for LAPACK is described in this diagram

PIC

The full content of the LAPACK tree is listed here lapack_tree_listing.txt

The source tree structure for the BLAS binding is described in this diagram

PIC

4 Installation instruction

These instructions explain how to use the Ada LAPACK and BLAS binding in the updated snapshot tar file.

  1. install native lapack 77 and blas libraries on your system. These will normally be installed in /usr/lib/.
  2. download the updated Ada binding in the zip files given in the links at the bottom of this page. They are ada_lapack_073012.zip and ada_blas_073012.zip
  3. Extract the zip files to some location. This will create 2 source trees as shown in the diagrams above.
  4. At the top of the each source tree, there is a file called common.mk where a Makefile variable is set to point to the directory that contains the native LAPACK and BLAS libraries. This is currently defined to point to /usr/lib. Edit this line to change this location only if the location is different in your system.
  5. To build the binding, just type make from the top of each tree. Make will build the whole tree, including the bindings packages and the test programs.
  6. To run the test program, type make testing from the top of tree for LAPACK and for BLAS.
  7. Examples of clients using the bindings are found in the tests/ directory of each tree.
  8. The binding is in the binding/ directory in each tree. This is the directory that you need to set the -I option to point to when using gnatmake as shown in the diagrams above.
  9. The following is a simple example of using the Ada LAPACK binding to solve Ax =  b mysolve.adb.txt which can also be found in the ada_lapack/tests/pilot/ directory
  10. That is all! Have fun using Ada with LAPACK and BLAS.

5 source code

  1. ada_lapack_073012.zip
  2. ada_blas_073012.zip