Includes not considered when computing hash by compile_extension_module

Issue #372 new
Jan Blechta created an issue

compile_extension_module does not trigger recompilation when header files are switched. MWE: run this code

code = """
#include <dolfin/common/Array.h>

namespace dolfin
{

  void foo()
  {
    Array<int> a(2);
    a[5] = 42;
  }

}
"""

from dolfin import *
m = compile_extension_module(code)
m.foo()

with DOLFIN with assertions on and then another DOLFIN with assertions off. Module is not recompiled. Then erase JIT cache and run first with assertions off and then on. Again module is not recompiled and the result is different to previous one.

Comments (11)

  1. Jan Blechta reporter

    @martinal Yes. I think we also put SWIG and NumPy versions into INSTANT_CACHE/ERROR_DIR variables to handle this on our cluster. Not sure whether this is necessary but we had some problems prior to this.

  2. Martin Sandve Alnæs

    There's a manually controlled variable _interface_version in compilemodule.py, only bumped to 3 so far... This is very error prone.

    Hashing all dolfin headers on install is one option, but that results in rejitting on almost every update.

    Hashing only the headers that are used in the jitted code on demand is more complex to implement (finding headers etc).

    Is it possible to get the dolfin build options at runtime? We could at least add those to the signature, that would fix the example code in this issue.

  3. Prof Garth Wells

    There doesn't seem to be a simple fix to this issue. We should at least add the version number to the hash, we can add build options (this will be easy soon because the pybdind11 jit uses pkg-config via the Python pkgconfig package).

    I'm comfortable with users of the dev version having to to some manual setting of the cache dir or cleaning.

    Shall we close this issue and create a new one on adding build options to the hash?

  4. Log in to comment