Subject: [FFC-dev] error in compiling

From: Shawn Walker <[email-masked]>
Date: Sat, 20 Jun 2009 19:21:14 -0400 (EDT)

I get the following error when trying run ffc on a simple P2 lagrange 
laplace form:

Compiler stage 5: Formatting code
---------------------------------
   Formatting code for UFC 1.0.
   Writing DOLFIN wrappers.
Traceback (most recent call last):
   File "/home/walker/build/bin/ffc", line 186, in <module>
     sys.exit(main(sys.argv[1:]))
   File "/home/walker/build/bin/ffc", line 130, in main
     execfile(script, {})
   File "Poisson.py", line 31, in <module>
     compile([a, L, M, element], "Poisson", {'log_level': 20, 'format': 
'dolfin', 'form_postfix': True, 'quadrature_order': 'auto', 'precision': 
'15', 'cpp optimize': False, 'cache_dir': None, 'split': False, 
'representation': 'auto', 'optimize': False, 'output_dir': '.'}, 
globals())
   File 
"/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compiler.py", 
line 109, in compile
     format_code(generated_forms, prefix, format, options)
   File 
"/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compiler.py", 
line 214, in format_code
     format.write(generated_forms, prefix, options)
   File 
"/home/walker/build/lib/python2.5/site-packages/ffc/compiler/format/ufcformat.py", 
line 267, in write
     output += _generate_dolfin_wrappers(generated_forms, prefix, options, 
self.format)
   File 
"/home/walker/build/lib/python2.5/site-packages/ffc/compiler/format/ufcformat.py", 
line 663, in _generate_dolfin_wrappers
     return generate_dolfin_code(prefix, "", form_names, common_space, 
False) + "\n\n"
TypeError: generate_dolfin_code() takes exactly 3 arguments (5 given)

- Shawn

---

From: Kristian Oelgaard <[email-masked]>
Date: Sun, 21 Jun 2009 10:53:19 +0200

> I get the following error when trying run ffc on a simple P2 lagrange

Are you using development versions of FFC/UFL and DOLFIN?

Could you send the *.ufl file?

Kristian

> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/mailman/listinfo/ffc-dev
>

---

From: Shawn Walker <[email-masked]>
Date: Sun, 21 Jun 2009 05:36:00 -0400 (EDT)

This is what I tried to compile:

# Compile this form with FFC: ffc -l dolfin Poisson.ufl

element = FiniteElement("Lagrange", triangle, 2)

v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)

a = inner(grad(v), grad(u))*dx
L = v*f*dx

- Shawn

---

From: Kristian Oelgaard <[email-masked]>
Date: Sun, 21 Jun 2009 13:58:05 +0200

> a = inner(grad(v), grad(u))*dx

It works fine here, I think you just need to use the latest versions of FFC, UFL
and DOLFIN and make sure you're paths are set correctly.

Kristian

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 09:57:13 -0400 (EDT)

My paths are probably not set correctly.  But I am not sure how to fix it. 
I just realized this is the first time I have tried to compile a form with 
UFL.  Is there some special connection that I need to make between UFL and 
FFC?

- Shawn

---

From: Anders Logg <[email-masked]>
Date: Mon, 22 Jun 2009 16:10:32 +0200

> UFL.  Is there some special connection that I need to make between UFL and 

No, FFC handles that. Just write a .ufl file and call FFC by

  ffc -l dolfin formname.ufl

-- 
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Mon, 22 Jun 2009 16:11:24 +0200

> UFL.  Is there some special connection that I need to make between UFL and

Just install UFL in the same way you do FFC.

Then source dolfin.conf, if DOLFIN is installed locally since FFC will need
dolfin_utils to generate the DOLFIN wrappers.

Kristian

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 10:22:39 -0400 (EDT)

If my version of SWIG is old (1.3.29) then would that screw up compiling 
with FFC, because it uses instant?

- Shawn

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 10:36:59 -0400 (EDT)

I ran the FFC tests, and I got this error:

walker@box227 ~/FENICS/ffc/test
$ python test.py
Running tests: unit
----------------------------------------------------------------------
...
----------------------------------------------------------------------
Ran 3 tests in 0.030s

OK
.........E..
======================================================================
ERROR: Test that JIT compiler is fast enough.
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test.py", line 237, in testPoisson
     jit(a0)
   File "/home/walker/build/lib/python2.5/site-packages/ffc/jit/jit.py", 
line 58, in jit
     return jit_form(object, options)
   File "/home/walker/build/lib/python2.5/site-packages/ffc/jit/jit.py", 
line 94, in jit_form
     cache_dir = options["cache_dir"])
   File 
"/home/walker/build/lib/python2.5/site-packages/ufc_utils/build.py", line 
53, in build_ufc_module
     (cpp_path, swig_path) = configure_instant()
   File 
"/home/walker/build/lib/python2.5/site-packages/ufc_utils/build.py", line 
82, in configure_instant
     raise OSError, "Your current swig version is %s, it needs to be 1.3.35 
or higher.\n" % swig_version
NameError: global name 'swig_version' is not defined

----------------------------------------------------------------------
Ran 12 tests in 0.450s

FAILED (errors=1)

===================================

Yes, my SWIG version is 1.3.29 only.  However, there is a bug in build.py 
in ../ufc_utils/.  the variable `swig_version' should be 
`get_swig_version()' I think.  Otherwise, `swig_version' is not defined. 
Probably this bug never shows up because most people have the correct SWIG 
version installed.

- Shawn

---

From: Anders Logg <[email-masked]>
Date: Mon, 22 Jun 2009 16:51:32 +0200

I don't think so, and it would certainly not give the error

This indicates that you have an old version of DOLFIN (the module
dolfin_utils).

-- 
Anders

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 10:55:37 -0400 (EDT)

All the info in dolfin.conf is already set in my environment variables.  I 
think it is a problem with me not having the newest SWIG installed.  I had 
been getting by without it before (I wasn't using PyDOLFIN).  But I think 
now I need it (see one of my more recent emails).

- Shawn

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Mon, 22 Jun 2009 17:06:12 +0200

If you're not using PyDOLFIN you don't need the JIT compiler and it
doesn't matter that this particular test fails.

Martin

---

From: Johan Hake <[email-masked]>
Date: Mon, 22 Jun 2009 17:11:10 +0200

> walker@box227 ~/FENICS/ffc/test

Thanks!

This should be fixed now.

Johan

> > It works fine here, I think you just need to use the latest versions of
> > FFC, UFL and DOLFIN and make sure you're paths are set correctly.
> >
> > Kristian
> >
> >> - Shawn
> >>
> >>>>      compile([a, L, M, element], "Poisson", {'log_level': 20,
> >>>> 'format': 'dolfin', 'form_postfix': True, 'quadrature_order': 'auto',
> >>>> 'precision': '15', 'cpp optimize': False, 'cache_dir': None, 'split':
> >>>> False, 'representation': 'auto', 'optimize': False, 'output_dir':
> >>>> '.'}, globals())
> >>>>    File
> >>>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compiler.
> >>>>py", line 109, in compile
> >>>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compiler.
> >>>>py", line 214, in format_code
> >>>>      output += _generate_dolfin_wrappers(generated_forms, prefix,
> >>>> options, self.format)
> >>>>    File
> >

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 11:23:48 -0400 (EDT)

Yes, I think you are right.  I am trying to figure out why I have an old 
dolfin install.

However, I did find a minor bug with FFC involving an undefined 
`swig_version' variable.  I don't have commit authority to do this, and it 
is a quick fix I think.

- Shawn

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 11:35:24 -0400 (EDT)

Yeah, for some reason the wrapper code is old (it is installed under a 
python site-package directory).  I don't know why it isn't updated.  Will 
a scons -clean take care of this?  And then re-install?

- Shawn

---

From: Anders Logg <[email-masked]>
Date: Mon, 22 Jun 2009 17:42:34 +0200

scons install should take care of overwriting it.

-- 
Anders

---

From: Johan Hake <[email-masked]>
Date: Mon, 22 Jun 2009 17:44:25 +0200

On Monday 22 June 2009 17:35:24 Shawn Walker wrote:
> python site-package directory).  I don't know why it isn't updated.  

This is a known bug in the build system of DOLFIN. dolfin_utils is not 
installed if you have not enabled PyDOLFIN. It is on the TODO list for 0.9.3. 
Should be easy to fix, Johannes?

Johan

> Will 

> >>>>>> I get the following error when trying run ffc on a simple P2
> >>>>>> lagrange laplace form:
> >>>>>
> >>>>>> 'format': 'dolfin', 'form_postfix': True, 'quadrature_order':
> >>>>>> 'auto', 'precision': '15', 'cpp optimize': False, 'cache_dir': None,
> >>>>>> 'split': False, 'representation': 'auto', 'optimize': False,
> >>>>>> 'output_dir': '.'}, globals())
> >>>>>>    File
> >>>>>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compile
> >>>>>>r.py", line 109, in compile
> >>>>>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compile
> >>>>>>r.py", line 214, in format_code
> >>>>>>      return generate_dolfin_code(prefix, "", form_names,
> >>>>>> common_space, False) + "\n\n"

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 11:45:32 -0400 (EDT)

ok, I will try it.  But I was sure that I have been installing it 
before...

- Shawn

---

From: Johan Hake <[email-masked]>
Date: Mon, 22 Jun 2009 17:52:21 +0200

On Monday 22 June 2009 17:44:25 Johan Hake wrote:
> installed if you have not enabled PyDOLFIN. It is on the TODO list for
> 0.9.3. Should be easy to fix, Johannes?

Oups, I missread the TODO list! 

This should not be a reported bug...

Johan

> > >> If my version of SWIG is old (1.3.29) then would that screw up
> > >> compiling with FFC, because it uses instant?
> > >>
> > >> - Shawn
> > >>
> > >>> It works fine here, I think you just need to use the latest versions
> > >>> of FFC, UFL and DOLFIN and make sure you're paths are set correctly.
> > >>>
> > >>> Kristian
> > >>>
> > >>>> - Shawn
> > >>>>
> > >>>>>> 'auto', 'precision': '15', 'cpp optimize': False, 'cache_dir':
> > >>>>>> None, 'split': False, 'representation': 'auto', 'optimize': False,
> > >>>>>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compi
> > >>>>>>le r.py", line 109, in compile
> > >>>>>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/compi
> > >>>>>>le r.py", line 214, in format_code
> > >>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/format/u
> > >>>fc format.py",
> > >>>
> > >>>>>> line 267, in write
> > >>> "/home/walker/build/lib/python2.5/site-packages/ffc/compiler/format/u
> > >>>fc format.py",
> > >>>

---

From: Anders Logg <[email-masked]>
Date: Mon, 22 Jun 2009 18:03:49 +0200

> This should not be a reported bug...

I don't understand. Is it a bug?

-- 
Anders

---

From: Johan Hake <[email-masked]>
Date: Mon, 22 Jun 2009 18:25:21 +0200

On Monday 22 June 2009 18:03:49 Anders Logg wrote:
> > > > Yeah, for some reason the wrapper code is old (it is installed under
> > > > a python site-package directory).  I don't know why it isn't updated.
> > >

Sorry, for the unclear messaging here. My rambling is caused by an ambiguous 
TODO bullet point in the wiki.

It is a bug!

dolfin_utils is _not_ installed when enablePyDolfin="no", which is probably 
the cause of Shawns problem. 

Johan

---

From: Anders Logg <[email-masked]>
Date: Mon, 22 Jun 2009 21:04:28 +0200

> the cause of Shawns problem. 

ok. Could you add it to the wiki?

Andy mentioned Roundup (http://roundup.sourceforge.net/) during
FEniCS'09 as a possible replacement for Bugzilla. Once that's been set
up we could give it a try and see if it works better for us than
Bugzilla.

-- 
Anders

---

From: "Garth N. Wells" <[email-masked]>
Date: Mon, 22 Jun 2009 20:17:18 +0100

> ok. Could you add it to the wiki?

I added it a while ago to the wiki which is where Johan found it.

Garth

> ------------------------------------------------------------------------
>

---

From: Anders Logg <[email-masked]>
Date: Mon, 22 Jun 2009 21:22:19 +0200

> I added it a while ago to the wiki which is where Johan found it.

I see that now. I thought Johan meant this bug was confused for
another bug, but it seems to be very clear this is the bug:

  Fix that dolfin_utils is not installed when using "enablePydolfin=no"

-- 
Anders

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 15:23:13 -0400 (EDT)

I got it working by just enabling python with dolfin.  However, that build 
system bug is still there.

- Shawn

---

From: Johan Hake <[email-masked]>
Date: Mon, 22 Jun 2009 21:40:40 +0200

> system bug is still there.

If you mean the swig_version check, this was fixed some hours ago. Because the 
fix is in ufc you need to update to newest version of ufc.

Johan

> >>>>>>> Yeah, for some reason the wrapper code is old (it is installed
> >>>>>>> under a python site-package directory).  I don't know why it isn't
> >>>>>>> updated.
> >>>>>>
> >>>>>> This is a known bug in the build system of DOLFIN. dolfin_utils is
> >>>>>> not installed if you have not enabled PyDOLFIN. It is on the TODO
> >>>>>> list for 0.9.3. Should be easy to fix, Johannes?
> >>>>>
> >>> Sorry, for the unclear messaging here. My rambling is caused by an
> >>> ambiguous TODO bullet point in the wiki.
> >>>
> >>> It is a bug!
> >>>
> >>> dolfin_utils is _not_ installed when enablePyDolfin="no", which is
> >>> probably the cause of Shawns problem.
> >>

---

From: Shawn Walker <[email-masked]>
Date: Mon, 22 Jun 2009 15:43:32 -0400 (EDT)

Yes, I know.  I meant the bug listed below: "dolfin_utils is not installed 
when python disabled".  Thank you for pushing that other fix through!

- Shawn

---

From: Johan Hake <[email-masked]>
Date: Mon, 22 Jun 2009 22:31:50 +0200

On Monday 22 June 2009 21:43:32 Shawn Walker wrote:
> when python disabled".  

Johan

> Thank you for pushing that other fix through! 

> >> I got it working by just enabling python with dolfin.  However, that
> >> build system bug is still there.
> >
> > If you mean the swig_version check, this was fixed some hours ago.
> > Because the fix is in ufc you need to update to newest version of ufc.
> >
> > Johan
> >
> >> - Shawn
> >>
> >>>>>>>>> under a python site-package directory).  I don't know why it
> >>>>>>>>> isn't updated.
> >>>>>>>>