← Back to team overview

dolfin team mailing list archive

Re: Improvements in generation of SWIG interface

 

On 08/27/2012 04:36 PM, Anders Logg wrote:
> On Sat, Aug 25, 2012 at 01:32:12PM +0200, Johan Hake wrote:
>> Yes, I have seen that...
>>
>> I think we can do 1 of 2 thing.
>>
>>   1) append the relative path to dolfin_utils in the script, which
>>      is an easy fix.
>>
>>   2) prevent running script from within the tree and for example place
>>      them in:
>>
>>        utils/something
> 
> I think (2). I think I remember we decided at some point to put all
> such scripts in cmake/scripts which already contants two
> generate-scripts. I suggest putting the script there and naming it
> generate-foo something.

should be fixed now. Two scripts were added:

  generate-swig-interface
  generate-swig-docstrings

Previously docstrings were generated through the interface script, but
it takes so long time so I splitted it into a separate script.

Johan

> 
> --
> Anders
> 
> 
>> Johan
>>
>>
>> On 08/25/2012 09:39 AM, Garth N. Wells wrote:
>>> Looks like this has re-introduced an old bug. It's not possible to run
>>> generateswigcode.py without DOLFIN being installed. This is a circular
>>> dependency. I get
>>>
>>> Traceback (most recent call last):
>>>   File "generateswigcode.py", line 32, in <module>
>>>     from dolfin_utils.cppparser import *
>>> ImportError: No module named dolfin_utils.cppparser
>>>
>>> Garth
>>>
>>> On 13 August 2012 09:51, Johan Hake <hake.dev@xxxxxxxxx> wrote:
>>>> Hello!
>>>>
>>>> I have improved (hopefully!) the automatic generation of the SWIG
>>>> interface of DOLFIN by reducing the size of the generated
>>>> modulePYTHON_wrap.cxx file, with the result of using less memory during
>>>> compilation of the individual modules. It now peaks at 650 MB instead of
>>>> 1.2 GB. The reduced interface is accomplished by only importing and
>>>> including the dependent dolfin types for each module. Previously we
>>>> exposed the whole dolfin library to all modules.
>>>>
>>>> The reduced import is accomplished by parsing all .h files in the DOLFIN
>>>> tree, and collecting dependencies. For this I used a python module
>>>> called CppHeaderParser. It is released using BSD license and is included
>>>> in dolfin_utils. I have worked together with Jashua Cloutier the
>>>> developer of CppHeaderParser to make it parse the whole DOLFIN library.
>>>>
>>>> CppHeaderParser depends on ply.lex, which is distributed in debian in
>>>> the python-ply package. So one either need to:
>>>>
>>>>   sudo apt-get install python-ply
>>>>
>>>> or
>>>>
>>>>   pip install ply
>>>>
>>>> using PyPI.
>>>>
>>>> JIT compilation of dolfin modules (Expressions and SubDomains) is also
>>>> much faster now, as the JIT compiled DOLFIN code is parsed runtime and
>>>> only dependent files are included or imported when the SWIG interface is
>>>> generated. Running Expression.py unit test takes 42 s instead of 140 s.
>>>>
>>>> Not everything could be automated through the parsing, as the
>>>> Hierarchical class with all its derived classes causes huge pain for
>>>> SWIG. The pain was, however, overcome by two simple hacks in
>>>> generateswigcode.py and compileextensionmodule.py.
>>>>
>>>> Regards,
>>>>
>>>> Johan
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dolfin
>>>> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dolfin
>>>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dolfin
>> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dolfin
>> More help   : https://help.launchpad.net/ListHelp



Follow ups

References