← Back to team overview

dolfin team mailing list archive

Re: SWIG Version 2.0 for DOLFIN

 

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/functionspace.py",
>> line 237, in __init__
>>     FunctionSpaceBase.__init__(self, mesh, element)
>>   File
>> "/tmp/local/lib/python2.6/site-packages/dolfin/function/functionspace.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.

Johannes



Follow ups

References