pybind11 JIT does not pass representation to FFC

Issue #937 resolved
Jan Blechta created an issue

This code unexpectedly passes

import dijitso
dijitso.set_log_level('debug')
from dolfin import *
parameters['form_compiler']['representation'] = 'FORTRAN66'
mesh = UnitSquareMesh(3, 3)
assemble(1*dx(mesh))

and investigation of the generated code shows that uflacs has been used instead of FORTRAN66.

This is a critical bug, because representation fixtures in unit tests do not work.

Comments (10)

  1. Chris Richardson

    I'm not sure where is the right place to inject the global parameters.

    import dijitso
    dijitso.set_log_level('debug')
    from dolfin import *
    parameters['form_compiler']['representation'] = 'FORTRAN66'
    mesh = UnitSquareMesh(3, 3)
    assemble(1*dx(mesh), form_compiler_parameters=dict([(k, v.value()) for k, v in parameters['form_compiler'].items()]))
    

    but that does what you want. Where should it be set? In Form, if it gets None as form_compiler_parameters?

  2. Jan Blechta reporter

    No. That's too early. This code fails with SWIG

    from dolfin import *
    mesh = UnitSquareMesh(3, 3)
    A = 1*dx(mesh)
    parameters['form_compiler']['representation'] = 'FORTRAN66'
    assemble(A)
    

    Please, let's try to avoid regressions from SWIG DOLFIN. This is important for user codes.

  3. Jan Blechta reporter

    I believe that global parameters are sent to FFC jit compiler in any case, without tampering the form. It's up to FFC to decide what to do with the UFL object (element or form) and (global) parameters.

  4. Chris Richardson

    These lines (or similar) are needed before JIT. @garth-wells was working on the Parameter system - I am not sure it is quite working for this use case yet. @blechta - sure, let's iron out all regressions before 2018 release.

        # Prepare form compiler parameters with overrides from dolfin and kwargs
        p = ffc_default_parameters()
        p.update(parameters["form_compiler"])
        p.update(form_compiler_parameters or {})
    
  5. Log in to comment