Subject: [FFC-dev] Restructure computation of reference tensor to use less memory. [...]

From: [email-masked]
Date: Mon, 05 Dec 2005 18:26:06 +0100

Commit from logg (2005-12-05 18:26 CET)
----------------

Restructure computation of reference tensor to use less memory.

As a side effect, the speed of the computation was actually improved...

Here are some results for compiling the nonlinear term of Navier-Stokes
for quadratics on tets:

         | FFC 0.2.2  | FFC 0.2.3 | Current CVS
--------------------------------------------------
CPU time | 167 s      | 21 s      | 15 s
Memory   | 22 MB      | 489 MB    | 27 MB

The memory usage is actually around 22 MB during most of the computation.
The 27 MB is only during a short peak (while copying some values from
one tensor to another).

FFC 0.2.2 used an old loop-based approach, while FFC 0.2.3 worked
through Numeric. The current CVS works similarly to version 0.2.3, but
instead of building a giant tensor and then doing contractions on that
tensor, there are now loops over the dimensions to be contracted so that
we don't build any tensors larger than the final reference tensor.

Also note that it now takes about 1 second to compile the nonlinear term of
Navier-Stokes for linears. This is a good speedup compared to the initial
130 seconds with FFC version 0.1.4...

  ffc  ChangeLog                                1.104
  ffc  src/ffc/compiler/monomialintegration.py  1.4
  ffc  src/ffc/compiler/referencetensor.py      1.19
  ffc  src/reference/Elasticity.h               1.32
  ffc  src/reference/EnergyNorm.h               1.10
  ffc  src/reference/Mass.h                     1.18
  ffc  src/reference/NavierStokes.h             1.30
  ffc  src/reference/Projection.h               1.7
  ffc  src/reference/Stokes.h                   1.15

---

From: "Johan Hoffman" <[email-masked]>
Date: Tue, 6 Dec 2005 08:26:32 +0100 (MET)

Looks great!

A question regarding Numeric: I hear that Numeric has been replaced by
Numarray in Python? Does that change anything in the installation and
usage of FIAT/FFC?

/Johan

one tensor to another).
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
>

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 06 Dec 2005 09:00:48 +0100

> Numarray in Python? Does that change anything in the installation and

Seems like Numarray is also going to cease in favour of SciPy.

Garth

---

From: Anders Logg <[email-masked]>
Date: Tue, 6 Dec 2005 09:04:06 -0600

> Seems like Numarray is also going to cease in favour of SciPy.

Yes, see http://numeric.scipy.org/.

It looks like the array interface is already included in the SciPy
package that I have installed on my machine (Debian packages
python2.4-scipy 0.3.2-8 and python2.4-scipy-core 0.3.2-4).

Perhaps I will try to update the next release of FFC (which might be
0.3.0) to use SciPy instead of Numeric. Any objections to this?

/Anders

---

From: Matthew Knepley <[email-masked]>
Date: Tue, 06 Dec 2005 09:19:36 -0600

> Seems like Numarray is also going to cease in favour of SciPy.

  Yes, I believe the Numeric 3.0 PEP will be accepted.

       Matt

-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness

---

From: Anders Logg <[email-masked]>
Date: Tue, 6 Dec 2005 09:55:22 -0600

> 0.3.0) to use SciPy instead of Numeric. Any objections to this?

It's probably good if a switch to SciPy is coordinated with a similar
move in FIAT, or otherwise there would still be dependencies to
Numeric (and LinearAlgebra).

Rob, would it be much work to switch FIAT to SciPy from Numeric and
LinearAlgebra?

/Anders

---

From: "Robert C. Kirby" <[email-masked]>
Date: Tue, 6 Dec 2005 09:55:54 -0600

I don't know if it would be -- presumably the API is similar?

On Dec 6, 2005, at 9:55 AM, Anders Logg wrote:

> FIAT-dev mailing list
> [email-masked]
> http://www.fenics.org/cgi-bin/mailman/listinfo/fiat-dev

---

From: Anders Logg <[email-masked]>
Date: Tue, 6 Dec 2005 10:00:58 -0600

Yes, it's very similar.

There is a module in scipy that does search and replace and does an
automatic upgrade (module convertcode) but I haven't tried it.

Perhaps the switch would require very little work. When I have time,
I'll try to make the switch.

/Anders

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/

---

From: Matthew Knepley <[email-masked]>
Date: Tue, 06 Dec 2005 10:02:35 -0600

> Rob, would it be much work to switch FIAT to SciPy from Numeric and

  Actually, I think this would be a waste of time. At the last SciPy conference,
Travis announced he was submitting a PEP to try and get Numeric 3.0 directly
into the core. I think this is likely. Also, it is a separate package from
SciPy, which is quite large.

       Matt

---

From: Anders Logg <[email-masked]>
Date: Tue, 6 Dec 2005 10:42:20 -0600

> SciPy, which is quite large.

Good to know. So the suggestion is to stick to Numeric until it
becomes part of the Python core, or until the PEP is rejected in which
case we switch to SciPy?

/Anders

---

From: Matthew Knepley <[email-masked]>
Date: Tue, 06 Dec 2005 10:45:49 -0600

> becomes part of the Python core, or until the PEP is rejected in which

  Yes.

        Matt