← Back to team overview

dolfin team mailing list archive

Re: SWIG Version 2.0 for DOLFIN

 

On Tuesday March 15 2011 09:58:35 Johannes Ring wrote:
> On Tue, Mar 15, 2011 at 5:25 PM, Johan Hake <johan.hake@xxxxxxxxx> wrote:
> > On Tuesday March 15 2011 09:20:25 Johannes Ring wrote:
> >> On Tue, Mar 15, 2011 at 4:22 PM, Johan Hake <johan.hake@xxxxxxxxx> wrote:
> >> > On Tuesday March 15 2011 01:44:33 Johannes Ring wrote:
> >> >> On Mon, Mar 14, 2011 at 4:59 PM, Johan Hake <johan.hake@xxxxxxxxx> 
wrote:
> >> >> > On Monday March 14 2011 08:10:32 Johannes Ring wrote:
> >> >> >> On Mon, Mar 14, 2011 at 3:23 PM, Johan Hake <johan.hake@xxxxxxxxx>
> > 
> > wrote:
> >> >> >> > On Monday March 14 2011 06:48:10 Johannes Ring wrote:
> >> >> >> >> On Mon, Mar 14, 2011 at 2:36 PM, Johan Hake
> >> >> >> >> <johan.hake@xxxxxxxxx>
> >> > 
> >> > wrote:
> >> >> >> >> > On Monday March 14 2011 05:38:25 Anders Logg wrote:
> >> >> >> >> >> B1;2600;0cOn Mon, Mar 14, 2011 at 01:34:19PM +0100, Johannes
> >> >> >> >> >> Ring
> >> >> > 
> >> >> > wrote:
> >> >> >> >> >> > On Mon, Mar 14, 2011 at 10:44 AM, Johannes Ring
> >> >> >> >> >> > <johannr@xxxxxxxxx>
> >> >> >> > 
> >> >> >> > wrote:
> >> >> >> >> >> > > On Mon, Mar 14, 2011 at 10:40 AM, Garth N. Wells
> >> >> >> >> >> > > <gnw20@xxxxxxxxx>
> >> >> >> >> > 
> >> >> >> >> > wrote:
> >> >> >> >> >> > >> On 14/03/11 09:32, Johannes Ring wrote:
> >> >> >> >> >> > >>> On Mon, Mar 14, 2011 at 5:00 AM, Johan Hake
> >> >> >> >> >> > >>> <johan.hake@xxxxxxxxx>
> >> >> >> >> > 
> >> >> >> >> > wrote:
> >> >> >> >> >> > >>>> Hello!
> >> >> >> >> >> > >>>> 
> >> >> >> >> >> > >>>> I have now removed all traces of SWIG code for
> >> >> >> >> >> > >>>> version < 2.0. Unfortunately I have not been able to
> >> >> >> >> >> > >>>> test it at my buildbot, as the versions has
> >> >> >> >> >> > >>>> diverged, due to a previous merge gone wrong.
> >> >> >> >> >> > >>>> 
> >> >> >> >> >> > >>>> Johannes could you make a new branch of dolfin at my
> >> >> >> >> >> > >>>> buildbot from
> >> >> >> >> >> > >>>> 
> >> >> >> >> >> > >>>>  lp:~dolfin-core/dolfin/hake
> >> >> >> >> >> > >>>> 
> >> >> >> >> >> > >>>> and maybe push force build after that?
> >> >> >> >> >> > >>> 
> >> >> >> >> >> > >>> Done.
> >> >> >> >> >> > >> 
> >> >> >> >> >> > >> Have all the buildbots been updated to SWIG 2.0?
> >> >> >> >> >> > > 
> >> >> >> >> >> > > No, I'm working on it. Only mac-osx and linux64-exp have
> >> >> >> >> >> > > SWIG 2.0 at the moment.
> >> >> >> >> >> > 
> >> >> >> >> >> > I have now upgraded SWIG to version 2.0 on the buildbots.
> >> >> >> >> >> > The lucid-amd64 and maverick-i386 slaves, building
> >> >> >> >> >> > dolfin-main, are using /usr/bin/swig2.0 from the Ubuntu
> >> >> >> >> >> > package (backported from Natty), while the personal
> >> >> >> >> >> > buildbots are using some locally installed SWIG.
> >> >> >> >> >> > 
> >> >> >> >> >> > This results in errors like this on dolfin-main:
> >> >> >> >> >> >   OSError: PyDOLFIN was not compiled with the present
> >> >> >> >> >> > version of swig. Install swig version 2.0.01 or
> >> >> >> >> >> > recompiled PyDOLFIN with present swig
> >> >> >> >> >> 
> >> >> >> >> >>                                            ~~~
> >> >> >> >> >> 
> >> >> >> >> >> Don't know how to fix but there's a typo in there.
> >> >> >> >> > 
> >> >> >> >> > He, he, do not think this is the cause of the problem.
> >> >> >> >> 
> >> >> >> >> No, but where does that extra zero come from?
> >> >> >> > 
> >> >> >> > That is what:
> >> >> >> > 
> >> >> >> >  swig -version
> >> >> >> > 
> >> >> >> > gives you.
> >> >> >> 
> >> >> >> No, "/usr/bin/swig2.0 -version" gives me:
> >> >> >> 
> >> >> >> $ /usr/bin/swig2.0 -version
> >> >> >> 
> >> >> >> SWIG Version 2.0.1
> >> >> >> 
> >> >> >> Compiled with g++ [i686-pc-linux-gnu]
> >> >> >> 
> >> >> >> Configured options: +pcre
> >> >> >> 
> >> >> >> Please see http://www.swig.org for reporting bugs and further
> >> >> >> information
> >> >> > 
> >> >> > Ok, fix on its way. It had to do with how we extract the SWIG
> >> >> > version while we generate the SWIG wrapper code. It is based on a
> >> >> > hexrepresentation of each digit.
> >> >> 
> >> >> This works fine now.
> >> >> 
> >> >> > Johan
> >> >> > 
> >> >> >> >> >> --
> >> >> >> >> >> Anders
> >> >> >> >> >> 
> >> >> >> >> >> > How are we supposed to deal with this? I have used
> >> >> >> >> >> > -DSWIG_EXECUTABLE:FILEPATH=/usr/bin/swig2.0 when building
> >> >> >> >> >> > UFC and DOLFIN but how can this executable be specified
> >> >> >> >> >> > when running the tests?
> >> >> >> >> > 
> >> >> >> >> > This is done by setting:
> >> >> >> >> > 
> >> >> >> >> >  parameters["swig_binary"] = "swig2.0"
> >> >> >> >> > 
> >> >> >> >> > I addressed this problem a while ago. Not sure how to "fix"
> >> >> >> >> > this. Either by setting a global parameters.xml file, if this
> >> >> >> >> > is possible, or patch globalparameters.py where the parameter
> >> >> >> >> > is added.
> >> >> >> >> 
> >> >> >> >> Yes, I remember that and I was looking at that post. We could
> >> >> >> >> rename globalparameters.py to globalparameters.py.in and have
> >> >> >> >> CMake's configure_file command generate globalparameters.py
> >> >> >> >> using the SWIG_EXECUTABLE variable. I can do that if it sounds
> >> >> >> >> okay.
> >> >> >> > 
> >> >> >> > Yes this is probably what we want.
> >> >> >> 
> >> >> >> Yes, I think so too. I tried it but when I run demo_poisson.py I
> >> >> >> still get this error:
> >> >> >> 
> >> >> >> Traceback (most recent call last):
> >> >> >>   File "demo_poisson.py", line 26, in <module>
> >> >> >>     V = FunctionSpace(mesh, "Lagrange", 1)
> >> >> >>   File
> >> >> >> "/tmp/local/lib/python2.6/site-packages/dolfin/function/functionsp
> >> >> >> ace .py ", line 237, in __init__
> >> >> >>     FunctionSpaceBase.__init__(self, mesh, element)
> >> >> >>   File
> >> >> >> "/tmp/local/lib/python2.6/site-packages/dolfin/function/functionsp
> >> >> >> ace .py ", line 44, in __init__
> >> >> >>     ufc_element, ufc_dofmap = jit(self._ufl_element)
> >> >> >>   File
> >> >> >> "/tmp/local/lib/python2.6/site-packages/dolfin/compilemodules/jit.
> >> >> >> py" , line 47, in mpi_jit
> >> >> >>     return local_jit(*args, **kwargs)
> >> >> >>   File
> >> >> >> "/tmp/local/lib/python2.6/site-packages/dolfin/compilemodules/jit.
> >> >> >> py" , line 84, in jit
> >> >> >>     """%cpp.__swigversion__
> >> >> >> OSError: PyDOLFIN was not compiled with the present version of
> >> >> >> swig. Install swig version 2.0.01 or recompiled PyDOLFIN with
> >> >> >> present swig
> >> >> >> 
> >> >> >> It seems that "check_and_set_swig_binary" in instant/config.py
> >> >> >> never gets called.
> >> >> 
> >> >> This is still a problem though. I think the problem is that
> >> >> configure_instant in compilemodules.py is called to late. If I add
> >> >> 
> >> >>     from compilemodules import configure_instant
> >> >>     configure_instant()
> >> >> 
> >> >> at the top in the jit function in jit.py, then it works fine.
> >> >> However, I'm not sure if it's the correct solution.
> >> > 
> >> > Yes, this is definately the problem. I thought this would be taken
> >> > care of within ufc.build. But the check_swig version method is called
> >> > before that time...
> >> > 
> >> > configure_instant does a lot more than just setting the swig_binary. I
> >> > just used the instant method check_and_set_swig_binary
> >> 
> >> Good. The buildbot seems to like this.
> > 
> > Hurray!
> 
> Too early for celebration. One demo is still not able to find the
> correct swig binary:

I dare...

HURRAY!

Johan

> ----------------------------------------------------------------------
> ./../../demo/undocumented/nonmatching-projection/python (Python)
> 
> DOLFIN_NOPLOT set, plotting disabled.
> Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
> Traceback (most recent call last):
>   File "demo_nonmatching-projection.py", line 18, in <module>
>     u0 = Expression("sin(10.0*x[0])*sin(10.0*x[1])", degree=3)
>   File
> "/home/buildbot/buildbots/main/fenics/lib/python2.6/site-packages/dolfin/f
> unction/expression.py", line 522, in __new__
>     cpp_base = compile_expressions([cppcode], [defaults])[0]
>   File
> "/home/buildbot/buildbots/main/fenics/lib/python2.6/site-packages/dolfin/c
> ompilemodules/expressions.py", line 186, in compile_expressions
>     expression_classes =
> compile_expression_code("\n\n".join(code_snippets),classnames)
>   File
> "/home/buildbot/buildbots/main/fenics/lib/python2.6/site-packages/dolfin/c
> ompilemodules/expressions.py", line 121, in compile_expression_code
>     use_numpy_typemaps=False)
>   File
> "/home/buildbot/buildbots/main/fenics/lib/python2.6/site-packages/dolfin/c
> ompilemodules/jit.py", line 47, in mpi_jit
>     return local_jit(*args, **kwargs)
>   File
> "/home/buildbot/buildbots/main/fenics/lib/python2.6/site-packages/dolfin/c
> ompilemodules/compilemodules.py", line 329, in compile_extension_module
>     instant_kwargs = configure_instant()
>   File
> "/home/buildbot/buildbots/main/fenics/lib/python2.6/site-packages/dolfin/c
> ompilemodules/compilemodules.py", line 180, in configure_instant
>     """%ufc.__swigversion__
> OSError: The python extension module of UFC was not compiled with the
> present version of swig.
> Install swig version 2.0.1 or recompile UFC with present swig
> 
> Johannes
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



References