comp.lang.ada
 help / color / mirror / Atom feed
* gnatmake, gnat2007. Linking to lapack and blas using with Ada.Numerics.Generic_Real_Arrays;
@ 2007-08-10 23:34 Nasser Abbasi
  2007-08-12  1:01 ` Jerry
  0 siblings, 1 reply; 3+ messages in thread
From: Nasser Abbasi @ 2007-08-10 23:34 UTC (permalink / raw)


These are the steps I did to link a small ada program with lapack and
blas libraries which are needed if one uses some of the  the new
packages such as  Ada.Numerics.Generic_Real_Arrays and its linear
algebra functions.

Here is the gnatmake command:

$ gnatmake solve.adb -largs -L/usr/lib  -lgnala -llapack -lblas
gcc -c solve.adb
gnatbind -x solve.ali
gnatlink solve.ali -L/usr/lib -lgnala -llapack -lblas

On linux Ubuntu, I used adept_manger to install blas and lapack, then
after that, added the following symbolic links (which the link above
would fail otherwise):

su -
cd /usr/lib
ln -s liblapack.so.3 liblapack.so
ln -s libblas.so libblas.so.3

This is the ada program (just to test with, no data in matric to do an
actual solve)

--------------- solve.adb--------------
$ cat solve.adb
 with Ada.Numerics.Generic_Real_Arrays;

procedure solve is

   package myReals is new Ada.Numerics.Generic_Real_Arrays(Float);
   use myReals;

   nElements: constant integer:=6;
   A: Real_Matrix(1..nElements,1..nElements):=(others => (others =>
0.0));
   b: Real_Vector(1..nElements):=(Others=>0.0);

   begin
       b:=solve(A,b);

end solve;
------------- solve--------------------

Nasser




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnatmake, gnat2007. Linking to lapack and blas using with Ada.Numerics.Generic_Real_Arrays;
  2007-08-10 23:34 gnatmake, gnat2007. Linking to lapack and blas using with Ada.Numerics.Generic_Real_Arrays; Nasser Abbasi
@ 2007-08-12  1:01 ` Jerry
  2007-08-12  9:53   ` Marc Enzmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry @ 2007-08-12  1:01 UTC (permalink / raw)


Has anyone done this on OS X? I believe that lapack and blas are pre-
installed but might be called clapack and cblas.

Jerry

On Aug 10, 4:34 pm, Nasser Abbasi <n...@12000.org> wrote:
> These are the steps I did to link a small ada program with lapack and
> blas libraries which are needed if one uses some of the  the new
> packages such as  Ada.Numerics.Generic_Real_Arrays and its linear
> algebra functions.
>
> Here is the gnatmake command:
>
> $ gnatmake solve.adb -largs -L/usr/lib  -lgnala -llapack -lblas
> gcc -c solve.adb
> gnatbind -x solve.ali
> gnatlink solve.ali -L/usr/lib -lgnala -llapack -lblas
>
> On linux Ubuntu, I used adept_manger to install blas and lapack, then
> after that, added the following symbolic links (which the link above
> would fail otherwise):
>
> su -
> cd /usr/lib
> ln -s liblapack.so.3 liblapack.so
> ln -s libblas.so libblas.so.3
>
> This is the ada program (just to test with, no data in matric to do an
> actual solve)
>
> --------------- solve.adb--------------
> $ cat solve.adb
>  with Ada.Numerics.Generic_Real_Arrays;
>
> procedure solve is
>
>    package myReals is new Ada.Numerics.Generic_Real_Arrays(Float);
>    use myReals;
>
>    nElements: constant integer:=6;
>    A: Real_Matrix(1..nElements,1..nElements):=(others => (others =>
> 0.0));
>    b: Real_Vector(1..nElements):=(Others=>0.0);
>
>    begin
>        b:=solve(A,b);
>
> end solve;
> ------------- solve--------------------
>
> Nasser





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnatmake, gnat2007. Linking to lapack and blas using with Ada.Numerics.Generic_Real_Arrays;
  2007-08-12  1:01 ` Jerry
@ 2007-08-12  9:53   ` Marc Enzmann
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Enzmann @ 2007-08-12  9:53 UTC (permalink / raw)


Hi Jerry!

The libraries for MacOS -on my MacBook with 10.4-  are libBLAS.dylib
and
libLAPACK.dylib, so no problem here, but:
I had to tinker with the Interfaces.Fortran.BLAS package, which is
used
to write Ada wrappers for the BLAS and LAPACK functions. The
"standard"
i-forbla.ads uses pragma import to access Fortran Routines, which are
not
available on standard Mac OS. I had to replace the Fortran Routines in
the
import with C Routines. Not a clean solution, really.

It works, but I am not sure, whether I mapped all routines correctly.
Not much time to check ...

Send me an e-mail, if you would like to try my workaround.

Best regards,

Marc

On 12 Aug., 03:01, Jerry <lancebo...@qwest.net> wrote:
> Has anyone done this on OS X? I believe that lapack and blas are pre-
> installed but might be called clapack and cblas.
>
> Jerry
>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-12  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10 23:34 gnatmake, gnat2007. Linking to lapack and blas using with Ada.Numerics.Generic_Real_Arrays; Nasser Abbasi
2007-08-12  1:01 ` Jerry
2007-08-12  9:53   ` Marc Enzmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox