* Memory leak in BLAS/LINPACK - GNAT on OS X
@ 2008-04-16 23:06 tkrauss
2008-04-18 21:43 ` Jerry
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: tkrauss @ 2008-04-16 23:06 UTC (permalink / raw)
There have been a few messages on the GNAT-OSX mailing list about an
apparent memory leak in the Ada.Numerics.Long_Real_Arrays
implementation. The setup is an OS X box (10.4) with the GNAT 4.3
compiler from the macada.org site. The Ada.Numerics.Long_Real_Arrays
is using the Apple-supplied BLAS and LINPACK libraries under the
hood. The code snippet below (plagiarized from Jerry's post on the
mailing list) leaks memory (as reported by top). Note that the same
code but with Long_Complex types does not appear to have this problem.
Has anyone seen this problem on other platforms? Do other languages
on OS X behave this way? I'm not sure how to track down the guilty
party here. Is it Apple's BLAS or LINPACK libraries or something in
the GNAT Long_Real_Arrays multiply method?
with Ada.Numerics.Long_Real_Arrays;
use Ada.Numerics.Long_Real_Arrays;
procedure tst_simple is
v : Real_Vector(1 .. 100_000) := (others => 1.23);
res : Real_Vector(1 .. 100_000);
begin
for i in 1..1000 loop
res := 123.456 * v;
end loop;
end tst_simple;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Memory leak in BLAS/LINPACK - GNAT on OS X
2008-04-16 23:06 Memory leak in BLAS/LINPACK - GNAT on OS X tkrauss
@ 2008-04-18 21:43 ` Jerry
2008-04-18 21:43 ` Jerry
2008-04-19 6:57 ` Per Sandberg
2 siblings, 0 replies; 6+ messages in thread
From: Jerry @ 2008-04-18 21:43 UTC (permalink / raw)
On Apr 16, 4:06 pm, tkrauss <thomas.kra...@gmail.com> wrote:
> There have been a few messages on the GNAT-OSX mailing list about an
> apparent memory leak in the Ada.Numerics.Long_Real_Arrays
> implementation. The setup is an OS X box (10.4) with the GNAT 4.3
> compiler from the macada.org site. The Ada.Numerics.Long_Real_Arrays
> is using the Apple-supplied BLAS and LINPACK libraries under the
> hood. The code snippet below (plagiarized from Jerry's post on the
> mailing list) leaks memory (as reported by top). Note that the same
> code but with Long_Complex types does not appear to have this problem.
>
> Has anyone seen this problem on other platforms? Do other languages
> on OS X behave this way? I'm not sure how to track down the guilty
> party here. Is it Apple's BLAS or LINPACK libraries or something in
> the GNAT Long_Real_Arrays multiply method?
>
> with Ada.Numerics.Long_Real_Arrays;
> use Ada.Numerics.Long_Real_Arrays;
>
> procedure tst_simple is
> v : Real_Vector(1 .. 100_000) := (others => 1.23);
> res : Real_Vector(1 .. 100_000);
> begin
> for i in 1..1000 loop
> res := 123.456 * v;
> end loop;
> end tst_simple;
I'm really interested to see what comments people have about this
problem. The sample program given by the original poster hits 1 GB of
RAM use in only a few seconds. (I kill it then.)
As he says, the complex-number version of the same program does not
leak. Also, the following program which implements a local version of
scalar-vector multiplication does not leak.
It looks like either the * operator is hosed in GNAT or there is
something wrong with Apple's BLAS. Clearly programs that do this
operation are not practical at this time.
Here's the program with a local override of "*" for scalar-vector
multiplication that behaves well.
with Ada.Numerics.Long_Real_Arrays; use
Ada.Numerics.Long_Real_Arrays;
procedure tst_mult_2 is
v : Real_Vector(1 .. 100_000) := (others => 1.23);
res : Real_Vector(1 .. 100_000);
function "*" (a : Long_Float; x : Real_Vector) return Real_Vector is
Result : Real_Vector (x'range);
begin
for index in x'range loop
Result(index) := a * x(index);
end loop;
return Result;
end "*";
begin
for i in 1..100 loop
res := 123.456 * v;
end loop;
end tst_mult_2;
Jerry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Memory leak in BLAS/LINPACK - GNAT on OS X
2008-04-16 23:06 Memory leak in BLAS/LINPACK - GNAT on OS X tkrauss
2008-04-18 21:43 ` Jerry
@ 2008-04-18 21:43 ` Jerry
2008-04-19 6:57 ` Per Sandberg
2 siblings, 0 replies; 6+ messages in thread
From: Jerry @ 2008-04-18 21:43 UTC (permalink / raw)
On Apr 16, 4:06 pm, tkrauss <thomas.kra...@gmail.com> wrote:
> There have been a few messages on the GNAT-OSX mailing list about an
> apparent memory leak in the Ada.Numerics.Long_Real_Arrays
> implementation. The setup is an OS X box (10.4) with the GNAT 4.3
> compiler from the macada.org site. The Ada.Numerics.Long_Real_Arrays
> is using the Apple-supplied BLAS and LINPACK libraries under the
> hood. The code snippet below (plagiarized from Jerry's post on the
> mailing list) leaks memory (as reported by top). Note that the same
> code but with Long_Complex types does not appear to have this problem.
>
> Has anyone seen this problem on other platforms? Do other languages
> on OS X behave this way? I'm not sure how to track down the guilty
> party here. Is it Apple's BLAS or LINPACK libraries or something in
> the GNAT Long_Real_Arrays multiply method?
>
> with Ada.Numerics.Long_Real_Arrays;
> use Ada.Numerics.Long_Real_Arrays;
>
> procedure tst_simple is
> v : Real_Vector(1 .. 100_000) := (others => 1.23);
> res : Real_Vector(1 .. 100_000);
> begin
> for i in 1..1000 loop
> res := 123.456 * v;
> end loop;
> end tst_simple;
I'm really interested to see what comments people have about this
problem. The sample program given by the original poster hits 1 GB of
RAM use in only a few seconds. (I kill it then.)
As he says, the complex-number version of the same program does not
leak. Also, the following program which implements a local version of
scalar-vector multiplication does not leak.
It looks like either the * operator is hosed in GNAT or there is
something wrong with Apple's BLAS. Clearly programs that do this
operation are not practical at this time.
Here's the program with a local override of "*" for scalar-vector
multiplication that behaves well.
with Ada.Numerics.Long_Real_Arrays; use
Ada.Numerics.Long_Real_Arrays;
procedure tst_mult_2 is
v : Real_Vector(1 .. 100_000) := (others => 1.23);
res : Real_Vector(1 .. 100_000);
function "*" (a : Long_Float; x : Real_Vector) return Real_Vector is
Result : Real_Vector (x'range);
begin
for index in x'range loop
Result(index) := a * x(index);
end loop;
return Result;
end "*";
begin
for i in 1..100 loop
res := 123.456 * v;
end loop;
end tst_mult_2;
Jerry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Memory leak in BLAS/LINPACK - GNAT on OS X
2008-04-16 23:06 Memory leak in BLAS/LINPACK - GNAT on OS X tkrauss
2008-04-18 21:43 ` Jerry
2008-04-18 21:43 ` Jerry
@ 2008-04-19 6:57 ` Per Sandberg
2008-04-19 22:08 ` Jerry
2008-04-19 22:12 ` Jerry
2 siblings, 2 replies; 6+ messages in thread
From: Per Sandberg @ 2008-04-19 6:57 UTC (permalink / raw)
Thought it i recognized this problem so i checked it out and found:
It is corrected in the Latest GNATPro version (the problem is in the
compiler).
/Per
tkrauss wrote:
> There have been a few messages on the GNAT-OSX mailing list about an
> apparent memory leak in the Ada.Numerics.Long_Real_Arrays
> implementation. The setup is an OS X box (10.4) with the GNAT 4.3
> compiler from the macada.org site. The Ada.Numerics.Long_Real_Arrays
> is using the Apple-supplied BLAS and LINPACK libraries under the
> hood. The code snippet below (plagiarized from Jerry's post on the
> mailing list) leaks memory (as reported by top). Note that the same
> code but with Long_Complex types does not appear to have this problem.
>
> Has anyone seen this problem on other platforms? Do other languages
> on OS X behave this way? I'm not sure how to track down the guilty
> party here. Is it Apple's BLAS or LINPACK libraries or something in
> the GNAT Long_Real_Arrays multiply method?
>
>
> with Ada.Numerics.Long_Real_Arrays;
> use Ada.Numerics.Long_Real_Arrays;
>
> procedure tst_simple is
> v : Real_Vector(1 .. 100_000) := (others => 1.23);
> res : Real_Vector(1 .. 100_000);
> begin
> for i in 1..1000 loop
> res := 123.456 * v;
> end loop;
> end tst_simple;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Memory leak in BLAS/LINPACK - GNAT on OS X
2008-04-19 6:57 ` Per Sandberg
@ 2008-04-19 22:08 ` Jerry
2008-04-19 22:12 ` Jerry
1 sibling, 0 replies; 6+ messages in thread
From: Jerry @ 2008-04-19 22:08 UTC (permalink / raw)
On Apr 18, 11:57 pm, Per Sandberg <per.sandb...@bredband.net> wrote:
> Thought it i recognized this problem so i checked it out and found:
> It is corrected in the Latest GNATPro version (the problem is in the
> compiler).
>
> /Per
Thanks for that info, Per.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Memory leak in BLAS/LINPACK - GNAT on OS X
2008-04-19 6:57 ` Per Sandberg
2008-04-19 22:08 ` Jerry
@ 2008-04-19 22:12 ` Jerry
1 sibling, 0 replies; 6+ messages in thread
From: Jerry @ 2008-04-19 22:12 UTC (permalink / raw)
On Apr 18, 11:57 pm, Per Sandberg <per.sandb...@bredband.net> wrote:
> Thought it i recognized this problem so i checked it out and found:
> It is corrected in the Latest GNATPro version (the problem is in the
> compiler).
>
> /Per
Thanks for that info, Per.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-19 22:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-16 23:06 Memory leak in BLAS/LINPACK - GNAT on OS X tkrauss
2008-04-18 21:43 ` Jerry
2008-04-18 21:43 ` Jerry
2008-04-19 6:57 ` Per Sandberg
2008-04-19 22:08 ` Jerry
2008-04-19 22:12 ` Jerry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox